Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
5962d42
tools: add new ESLint rule: prefer-primordials
targos May 16, 2021
5068db6
tools,lib: tighten prefer-primordials rules for Error statics
aduh95 Nov 7, 2020
1687197
tools,lib: recommend using safe primordials
aduh95 Nov 7, 2020
538ec98
timers: cleanup abort listener on awaitable timers
targos May 16, 2021
2fd37db
lib: add %TypedArray% abstract constructor to primordials
ExE-Boss Nov 7, 2020
1f38c63
module: refactor to use more primordials
aduh95 Nov 7, 2020
64c5f62
tools: update ESLint to 7.11.0
cjihrig Oct 9, 2020
8b2df0c
tools: update ESLint to 7.12.0
cjihrig Oct 25, 2020
8e4a055
tools: update ESLint to 7.12.1
cjihrig Oct 27, 2020
17c8484
tools: update ESLint to 7.13.0
lpinca Nov 8, 2020
845f3ae
test: use `.then(common.mustCall())` for all async IIFEs
addaleax Jul 14, 2020
02233af
tools: add linting rule for async IIFEs
addaleax Jul 14, 2020
1f3fff3
test: add Actions annotation output
mmarchini Aug 1, 2020
22bf488
stream: fix legacy pipe error handling
ronag Sep 18, 2020
ef7d3b1
doc: document changes for `*/promises` alias modules
ExE-Boss Jun 21, 2020
b566802
child_process: refactor to use more primordials
aduh95 Nov 6, 2020
483c1a1
lib,tools: enforce access to prototype from primordials
aduh95 Nov 7, 2020
8c743ca
timers: refactor to use more primordials
targos May 16, 2021
4d35416
http2: add support for TypedArray to getUnpackedSettings
aduh95 Nov 16, 2020
986e79a
lib: refactor to use more primordials
aduh95 Nov 15, 2020
34984f3
errors: refactor to use more primordials
aduh95 Nov 18, 2020
f4cb54d
src: fix label indentation
Trott Nov 21, 2020
abecf46
tools: update ESLint to 7.14.0
cjihrig Nov 21, 2020
66597bc
tools: enable no-nonoctal-decimal-escape lint rule
cjihrig Nov 21, 2020
73b5aa7
lib: refactor primordials.uncurryThis
aduh95 Nov 21, 2020
f59ee44
deps: V8: cherry-pick 86991d0587a1
Nov 25, 2020
ac47032
policy: refactor to use more primordials
aduh95 Nov 15, 2020
b641c26
tty: refactor to use more primordials
Lxxyx Nov 26, 2020
1462d59
os: refactor to use more primordials
aduh95 Nov 20, 2020
d49ec9b
v8: refactor to use more primordials
aduh95 Nov 20, 2020
5a3192d
perf_hooks: refactor to use more primordials
aduh95 Nov 21, 2020
47b822f
errors: display original symbol name
Nov 8, 2020
9a6e47e
buffer: refactor to use more primordials
aduh95 Nov 18, 2020
b41bd4f
timers: reject with AbortError on cancellation
targos May 16, 2021
6d63861
worker: refactor to use more primordials
aduh95 Nov 16, 2020
937e270
path: refactor to use more primordials
aduh95 Nov 18, 2020
3f919b3
src: use transferred consistently
danbev Dec 1, 2020
aa23776
querystring: refactor to use more primordials
aduh95 Nov 18, 2020
878907d
module: refactor to use more primordials
aduh95 Nov 21, 2020
beae340
zlib: refactor to use more primordials
aduh95 Nov 20, 2020
d43e1ae
dgram: refactor to use more primordials
aduh95 Nov 19, 2020
efbec9d
readline: refactor to use more primordials
aduh95 Nov 15, 2020
965c963
buffer: refactor to use primordials instead of Array#reduce
aduh95 Dec 4, 2020
16b684e
string_decoder: refactor to use more primordials
aduh95 Nov 21, 2020
bc92cbd
lib: add uncurried accessor properties to `primordials`
ExE-Boss Nov 30, 2020
5c7779d
net: refactor to use more primordials
aduh95 Nov 17, 2020
b39e71b
tools: enable no-unused-expressions lint rule
targos Nov 24, 2020
86867dc
dns: refactor to use more primordials
aduh95 Nov 20, 2020
1a197eb
doc: document ABORT_ERR code
benjamingr Nov 29, 2020
e5de7b6
tools: update ESLint to 7.15.0
cjihrig Dec 6, 2020
a67e392
tools: enable no-unsafe-optional-chaining lint rule
cjihrig Dec 6, 2020
3b54ec5
inspector: refactor to use more primordials
aduh95 Nov 21, 2020
bb8c716
util: simplify constructor retrieval in inspect()
Trott Dec 10, 2020
336d5fb
build: fix make test-npm
ruyadorno Dec 3, 2020
8488818
tools: update ESLint to 7.16.0
Dec 19, 2020
7babb64
tools: update ESLint to 7.17.0
cjihrig Jan 2, 2021
a988af4
lib: refactor to use more primordials in internal/histogram.js
RaisinTen Dec 9, 2020
bf998e3
v8: refactor to use more primordials
aduh95 Dec 5, 2020
4cf665b
doc: expand openssl instructions
mhdawson Dec 17, 2020
74e8cc2
deps: V8: cherry-pick dfcdf7837e23
Dec 18, 2020
c260d98
events: refactor to use more primordials
aduh95 Nov 17, 2020
40df0dc
deps: V8: cherry-pick 035c305ce776
targos May 1, 2021
55d0cd8
deps: update ICU to 69.1
targos Apr 9, 2021
c46dd77
deps: V8: backport 4bf051d536a1
addaleax Dec 11, 2020
0e077a5
src: use correct outer Context’s microtask queue
addaleax Dec 8, 2020
df3d763
src: use correct microtask queue for checkpoints
addaleax Dec 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
deps: V8: cherry-pick 86991d0587a1
Adds methods for fetching stack trace information about
enclosing function.

Refs #36042

Original commit message:

    Reland "stack-trace-api: implement getEnclosingLine/Column"

    This reverts commit 5557a63beb5a53c93e9b590eaf2933e21bcb3768.

    Reason for revert: Sheriff's mistake, failing test was previously flaking.

    Original change's description:
    > Revert "stack-trace-api: implement getEnclosingLine/Column"
    >
    > This reverts commit c48ae2d96cbfdc2216706a5e9a79ae1dce5a638b.
    >
    > Reason for revert: Breaks a profiling test:
    > https://ci.chromium.org/p/v8/builders/ci/V8%20Win32/30010
    >
    > Original change's description:
    > > stack-trace-api: implement getEnclosingLine/Column
    > >
    > > Introduces getEnclosingColumn and getEnclosingLine on CallSite
    > > so that the position can be used to lookup the original symbol
    > > for function when source maps are used.
    > >
    > > BUG=v8:11157
    > >
    > > Change-Id: I06c4c374d172d206579abb170c7b7a2bd3bb159f
    > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2547218
    > > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    > > Commit-Queue: Benjamin Coe <bencoe@google.com>
    > > Cr-Commit-Position: refs/heads/master@{#71343}
    >
    > TBR=jkummerow@chromium.org,yangguo@chromium.org,bencoe@google.com
    >
    > Change-Id: Iab5c250c1c4fbdab86971f4a7e40abc8f87cf79c
    > No-Presubmit: true
    > No-Tree-Checks: true
    > No-Try: true
    > Bug: v8:11157
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2555384
    > Reviewed-by: Bill Budge <bbudge@chromium.org>
    > Commit-Queue: Bill Budge <bbudge@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#71345}

    TBR=bbudge@chromium.org,jkummerow@chromium.org,yangguo@chromium.org,bencoe@google.com

    # Not skipping CQ checks because this is a reland.

    Bug: v8:11157
    Change-Id: I8dba19ceb29a24594469d2cf79626f741dc4cad3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2555499
    Reviewed-by: Bill Budge <bbudge@chromium.org>
    Commit-Queue: Bill Budge <bbudge@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71348}

Refs: v8/v8@86991d0

PR-URL: #36254
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
Benjamin Coe authored and targos committed May 16, 2021
commit f59ee44d6237bdd796c53341d4145d9c40084f26
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.64',
'v8_embedder_string': '-node.65',

##### V8 defaults for Node.js #####

Expand Down
16 changes: 16 additions & 0 deletions deps/v8/src/builtins/builtins-callsite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ BUILTIN(CallSitePrototypeGetColumnNumber) {
return PositiveNumberOrNull(it.Frame()->GetColumnNumber(), isolate);
}

BUILTIN(CallSitePrototypeGetEnclosingColumnNumber) {
HandleScope scope(isolate);
CHECK_CALLSITE(recv, "getEnclosingColumnNumber");
FrameArrayIterator it(isolate, GetFrameArray(isolate, recv),
GetFrameIndex(isolate, recv));
return PositiveNumberOrNull(it.Frame()->GetEnclosingColumnNumber(), isolate);
}

BUILTIN(CallSitePrototypeGetEnclosingLineNumber) {
HandleScope scope(isolate);
CHECK_CALLSITE(recv, "getEnclosingLineNumber");
FrameArrayIterator it(isolate, GetFrameArray(isolate, recv),
GetFrameIndex(isolate, recv));
return PositiveNumberOrNull(it.Frame()->GetEnclosingLineNumber(), isolate);
}

BUILTIN(CallSitePrototypeGetEvalOrigin) {
HandleScope scope(isolate);
CHECK_CALLSITE(recv, "getEvalOrigin");
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/builtins/builtins-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ namespace internal {
\
/* CallSite */ \
CPP(CallSitePrototypeGetColumnNumber) \
CPP(CallSitePrototypeGetEnclosingColumnNumber) \
CPP(CallSitePrototypeGetEnclosingLineNumber) \
CPP(CallSitePrototypeGetEvalOrigin) \
CPP(CallSitePrototypeGetFileName) \
CPP(CallSitePrototypeGetFunction) \
Expand Down
46 changes: 46 additions & 0 deletions deps/v8/src/execution/messages.cc
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,26 @@ int JSStackFrame::GetColumnNumber() {
return kNone;
}

int JSStackFrame::GetEnclosingLineNumber() {
if (HasScript()) {
Handle<SharedFunctionInfo> shared = handle(function_->shared(), isolate_);
return Script::GetLineNumber(GetScript(),
shared->function_token_position()) + 1;
} else {
return kNone;
}
}

int JSStackFrame::GetEnclosingColumnNumber() {
if (HasScript()) {
Handle<SharedFunctionInfo> shared = handle(function_->shared(), isolate_);
return Script::GetColumnNumber(GetScript(),
shared->function_token_position()) + 1;
} else {
return kNone;
}
}

int JSStackFrame::GetPromiseIndex() const {
return is_promise_all_ ? offset_ : kNone;
}
Expand Down Expand Up @@ -601,6 +621,12 @@ int WasmStackFrame::GetPosition() const {

int WasmStackFrame::GetColumnNumber() { return GetModuleOffset(); }

int WasmStackFrame::GetEnclosingColumnNumber() {
const int function_offset =
GetWasmFunctionOffset(wasm_instance_->module(), wasm_func_index_);
return function_offset;
}

int WasmStackFrame::GetModuleOffset() const {
const int function_offset =
GetWasmFunctionOffset(wasm_instance_->module(), wasm_func_index_);
Expand Down Expand Up @@ -669,6 +695,26 @@ int AsmJsWasmStackFrame::GetColumnNumber() {
return Script::GetColumnNumber(script, GetPosition()) + 1;
}

int AsmJsWasmStackFrame::GetEnclosingLineNumber() {
DCHECK_LE(0, GetPosition());
Handle<Script> script(wasm_instance_->module_object().script(), isolate_);
DCHECK(script->IsUserJavaScript());
int byte_offset = GetSourcePosition(wasm_instance_->module(),
wasm_func_index_, 0,
is_at_number_conversion_);
return Script::GetLineNumber(script, byte_offset) + 1;
}

int AsmJsWasmStackFrame::GetEnclosingColumnNumber() {
DCHECK_LE(0, GetPosition());
Handle<Script> script(wasm_instance_->module_object().script(), isolate_);
DCHECK(script->IsUserJavaScript());
int byte_offset = GetSourcePosition(wasm_instance_->module(),
wasm_func_index_, 0,
is_at_number_conversion_);
return Script::GetColumnNumber(script, byte_offset) + 1;
}

FrameArrayIterator::FrameArrayIterator(Isolate* isolate,
Handle<FrameArray> array, int frame_ix)
: isolate_(isolate), array_(array), frame_ix_(frame_ix) {}
Expand Down
11 changes: 11 additions & 0 deletions deps/v8/src/execution/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class StackFrameBase {
// Return 0-based Wasm function index. Returns -1 for non-Wasm frames.
virtual int GetWasmFunctionIndex();

virtual int GetEnclosingColumnNumber() = 0;
virtual int GetEnclosingLineNumber() = 0;

// Returns index for Promise.all() async frames, or -1 for other frames.
virtual int GetPromiseIndex() const = 0;

Expand Down Expand Up @@ -130,6 +133,9 @@ class JSStackFrame : public StackFrameBase {
int GetLineNumber() override;
int GetColumnNumber() override;

int GetEnclosingColumnNumber() override;
int GetEnclosingLineNumber() override;

int GetPromiseIndex() const override;

bool IsNative() override;
Expand Down Expand Up @@ -178,6 +184,8 @@ class WasmStackFrame : public StackFrameBase {
int GetPosition() const override;
int GetLineNumber() override { return 0; }
int GetColumnNumber() override;
int GetEnclosingColumnNumber() override;
int GetEnclosingLineNumber() override { return 0; }
int GetWasmFunctionIndex() override { return wasm_func_index_; }

int GetPromiseIndex() const override { return GetPosition(); }
Expand Down Expand Up @@ -225,6 +233,9 @@ class AsmJsWasmStackFrame : public WasmStackFrame {
int GetLineNumber() override;
int GetColumnNumber() override;

int GetEnclosingColumnNumber() override;
int GetEnclosingLineNumber() override;

private:
friend class FrameArrayIterator;
AsmJsWasmStackFrame() = default;
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/init/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4079,6 +4079,10 @@ void Genesis::InitializeCallSiteBuiltins() {

FunctionInfo infos[] = {
{"getColumnNumber", Builtins::kCallSitePrototypeGetColumnNumber},
{"getEnclosingColumnNumber",
Builtins::kCallSitePrototypeGetEnclosingColumnNumber},
{"getEnclosingLineNumber",
Builtins::kCallSitePrototypeGetEnclosingLineNumber},
{"getEvalOrigin", Builtins::kCallSitePrototypeGetEvalOrigin},
{"getFileName", Builtins::kCallSitePrototypeGetFileName},
{"getFunction", Builtins::kCallSitePrototypeGetFunction},
Expand Down
20 changes: 20 additions & 0 deletions deps/v8/test/mjsunit/stack-traces.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,23 @@ var constructor = new Error().stack[0].constructor;
assertThrows(() => constructor.call());
assertThrows(() => constructor.call(
null, {}, () => undefined, {valueOf() { return 0 }}, false));

// Test stack frames populated with line/column information for both call site
// and enclosing function:
Error.prepareStackTrace = function(e, frames) {
assertMatches(/stack-traces\.js/, frames[0].getFileName());
assertEquals(3, frames[0].getEnclosingColumnNumber());
assertEquals(11, frames[0].getColumnNumber());
assertTrue(frames[0].getEnclosingLineNumber() < frames[0].getLineNumber());
}
try {
function a() {
b();
}
function b() {
throw Error('hello world');
}
a();
} catch (err) {
err.stack;
}
15 changes: 15 additions & 0 deletions deps/v8/test/mjsunit/wasm/asm-wasm-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,18 @@ function generateOverflowWasmFromAsmJs() {
['f', 135, 12] // --
]);
})();

(function EnclosingFunctionOffsets() {
const fun = generateWasmFromAsmJs(this, {throwFunc: throwException});
assertTrue(%IsWasmCode(fun));
let e = null;
try {
fun(0);
} catch (ex) {
e = ex;
}
assertEquals(68, e.stack[2].getLineNumber());
assertEquals(15, e.stack[2].getColumnNumber());
assertEquals(65, e.stack[2].getEnclosingLineNumber());
assertEquals(3, e.stack[2].getEnclosingColumnNumber());
})();