Commit 5557a63b authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

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

This reverts commit c48ae2d9.

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/+/2555384Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71345}
parent 9820f02d
...@@ -53,22 +53,6 @@ BUILTIN(CallSitePrototypeGetColumnNumber) { ...@@ -53,22 +53,6 @@ BUILTIN(CallSitePrototypeGetColumnNumber) {
return PositiveNumberOrNull(it.Frame()->GetColumnNumber(), isolate); 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) { BUILTIN(CallSitePrototypeGetEvalOrigin) {
HandleScope scope(isolate); HandleScope scope(isolate);
CHECK_CALLSITE(recv, "getEvalOrigin"); CHECK_CALLSITE(recv, "getEvalOrigin");
......
...@@ -367,8 +367,6 @@ namespace internal { ...@@ -367,8 +367,6 @@ namespace internal {
\ \
/* CallSite */ \ /* CallSite */ \
CPP(CallSitePrototypeGetColumnNumber) \ CPP(CallSitePrototypeGetColumnNumber) \
CPP(CallSitePrototypeGetEnclosingColumnNumber) \
CPP(CallSitePrototypeGetEnclosingLineNumber) \
CPP(CallSitePrototypeGetEvalOrigin) \ CPP(CallSitePrototypeGetEvalOrigin) \
CPP(CallSitePrototypeGetFileName) \ CPP(CallSitePrototypeGetFileName) \
CPP(CallSitePrototypeGetFunction) \ CPP(CallSitePrototypeGetFunction) \
......
...@@ -514,26 +514,6 @@ int JSStackFrame::GetColumnNumber() { ...@@ -514,26 +514,6 @@ int JSStackFrame::GetColumnNumber() {
return kNone; 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 { int JSStackFrame::GetPromiseIndex() const {
return (is_promise_all_ || is_promise_any_) ? offset_ : kNone; return (is_promise_all_ || is_promise_any_) ? offset_ : kNone;
} }
...@@ -622,12 +602,6 @@ int WasmStackFrame::GetPosition() const { ...@@ -622,12 +602,6 @@ int WasmStackFrame::GetPosition() const {
int WasmStackFrame::GetColumnNumber() { return GetModuleOffset(); } 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 { int WasmStackFrame::GetModuleOffset() const {
const int function_offset = const int function_offset =
GetWasmFunctionOffset(wasm_instance_->module(), wasm_func_index_); GetWasmFunctionOffset(wasm_instance_->module(), wasm_func_index_);
...@@ -698,26 +672,6 @@ int AsmJsWasmStackFrame::GetColumnNumber() { ...@@ -698,26 +672,6 @@ int AsmJsWasmStackFrame::GetColumnNumber() {
return Script::GetColumnNumber(script, GetPosition()) + 1; 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, FrameArrayIterator::FrameArrayIterator(Isolate* isolate,
Handle<FrameArray> array, int frame_ix) Handle<FrameArray> array, int frame_ix)
: isolate_(isolate), array_(array), frame_ix_(frame_ix) {} : isolate_(isolate), array_(array), frame_ix_(frame_ix) {}
......
...@@ -87,9 +87,6 @@ class StackFrameBase { ...@@ -87,9 +87,6 @@ class StackFrameBase {
// Return 0-based Wasm function index. Returns -1 for non-Wasm frames. // Return 0-based Wasm function index. Returns -1 for non-Wasm frames.
virtual int GetWasmFunctionIndex(); virtual int GetWasmFunctionIndex();
virtual int GetEnclosingColumnNumber() = 0;
virtual int GetEnclosingLineNumber() = 0;
// Returns the index of the rejected promise in the Promise combinator input, // Returns the index of the rejected promise in the Promise combinator input,
// or -1 if this frame is not a Promise combinator frame. // or -1 if this frame is not a Promise combinator frame.
virtual int GetPromiseIndex() const = 0; virtual int GetPromiseIndex() const = 0;
...@@ -136,9 +133,6 @@ class JSStackFrame : public StackFrameBase { ...@@ -136,9 +133,6 @@ class JSStackFrame : public StackFrameBase {
int GetLineNumber() override; int GetLineNumber() override;
int GetColumnNumber() override; int GetColumnNumber() override;
int GetEnclosingColumnNumber() override;
int GetEnclosingLineNumber() override;
int GetPromiseIndex() const override; int GetPromiseIndex() const override;
bool IsNative() override; bool IsNative() override;
...@@ -189,8 +183,6 @@ class WasmStackFrame : public StackFrameBase { ...@@ -189,8 +183,6 @@ class WasmStackFrame : public StackFrameBase {
int GetPosition() const override; int GetPosition() const override;
int GetLineNumber() override { return 0; } int GetLineNumber() override { return 0; }
int GetColumnNumber() override; int GetColumnNumber() override;
int GetEnclosingColumnNumber() override;
int GetEnclosingLineNumber() override { return 0; }
int GetWasmFunctionIndex() override { return wasm_func_index_; } int GetWasmFunctionIndex() override { return wasm_func_index_; }
int GetPromiseIndex() const override { return GetPosition(); } int GetPromiseIndex() const override { return GetPosition(); }
...@@ -239,9 +231,6 @@ class AsmJsWasmStackFrame : public WasmStackFrame { ...@@ -239,9 +231,6 @@ class AsmJsWasmStackFrame : public WasmStackFrame {
int GetLineNumber() override; int GetLineNumber() override;
int GetColumnNumber() override; int GetColumnNumber() override;
int GetEnclosingColumnNumber() override;
int GetEnclosingLineNumber() override;
private: private:
friend class FrameArrayIterator; friend class FrameArrayIterator;
AsmJsWasmStackFrame() = default; AsmJsWasmStackFrame() = default;
......
...@@ -4202,10 +4202,6 @@ void Genesis::InitializeCallSiteBuiltins() { ...@@ -4202,10 +4202,6 @@ void Genesis::InitializeCallSiteBuiltins() {
FunctionInfo infos[] = { FunctionInfo infos[] = {
{"getColumnNumber", Builtins::kCallSitePrototypeGetColumnNumber}, {"getColumnNumber", Builtins::kCallSitePrototypeGetColumnNumber},
{"getEnclosingColumnNumber",
Builtins::kCallSitePrototypeGetEnclosingColumnNumber},
{"getEnclosingLineNumber",
Builtins::kCallSitePrototypeGetEnclosingLineNumber},
{"getEvalOrigin", Builtins::kCallSitePrototypeGetEvalOrigin}, {"getEvalOrigin", Builtins::kCallSitePrototypeGetEvalOrigin},
{"getFileName", Builtins::kCallSitePrototypeGetFileName}, {"getFileName", Builtins::kCallSitePrototypeGetFileName},
{"getFunction", Builtins::kCallSitePrototypeGetFunction}, {"getFunction", Builtins::kCallSitePrototypeGetFunction},
......
...@@ -439,23 +439,3 @@ var constructor = new Error().stack[0].constructor; ...@@ -439,23 +439,3 @@ var constructor = new Error().stack[0].constructor;
assertThrows(() => constructor.call()); assertThrows(() => constructor.call());
assertThrows(() => constructor.call( assertThrows(() => constructor.call(
null, {}, () => undefined, {valueOf() { return 0 }}, false)); 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;
}
...@@ -154,18 +154,3 @@ function generateOverflowWasmFromAsmJs() { ...@@ -154,18 +154,3 @@ function generateOverflowWasmFromAsmJs() {
['f', 135, 12] // -- ['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());
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment