[inspector] introduced StackFrame::IsWasm flag

We don't need to do any kind of translation for non-wasm frames. And we need this knowledge for lazy symbolization.
Capturing stack trace is ~7% faster.

BUG=v8:6189
R=dgozman@chromium.org,yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2795103004
Cr-Commit-Position: refs/heads/master@{#44502}
This commit is contained in:
kozyatinskiy 2017-04-08 15:26:22 -07:00 committed by Commit bot
parent d9691952c1
commit c0c1d76028
6 changed files with 15 additions and 2 deletions

View File

@ -1646,6 +1646,11 @@ class V8_EXPORT StackFrame {
* constructor via "new".
*/
bool IsConstructor() const;
/**
* Returns whether or not the associated functions is defined in wasm.
*/
bool IsWasm() const;
};

View File

@ -2930,6 +2930,7 @@ bool StackFrame::IsConstructor() const {
return Utils::OpenHandle(this)->is_constructor();
}
bool StackFrame::IsWasm() const { return Utils::OpenHandle(this)->is_wasm(); }
// --- N a t i v e W e a k M a p ---

View File

@ -40,8 +40,10 @@ V8StackTraceImpl::Frame toFrame(v8::Local<v8::StackFrame> frame,
int sourceColumn = frame->GetColumn() - 1;
// TODO(clemensh): Figure out a way to do this translation only right before
// sending the stack trace over wire.
wasmTranslation->TranslateWasmScriptLocationToProtocolLocation(
&scriptId, &sourceLineNumber, &sourceColumn);
if (frame->IsWasm()) {
wasmTranslation->TranslateWasmScriptLocationToProtocolLocation(
&scriptId, &sourceLineNumber, &sourceColumn);
}
return V8StackTraceImpl::Frame(functionName, scriptId, sourceName,
sourceLineNumber + 1, sourceColumn + 1);
}

View File

@ -679,6 +679,7 @@ class CaptureStackTraceHelper {
if (options_ & StackTrace::kIsConstructor) {
frame->set_is_constructor(summ.is_constructor());
}
frame->set_is_wasm(false);
return frame;
}
@ -707,6 +708,7 @@ class CaptureStackTraceHelper {
if (options_ & StackTrace::kScriptId) {
info->set_script_id(summ.script()->id());
}
info->set_is_wasm(true);
return info;
}

View File

@ -5819,6 +5819,7 @@ ACCESSORS(StackFrameInfo, function_name, Object, kFunctionNameIndex)
SMI_ACCESSORS(StackFrameInfo, flag, kFlagIndex)
BOOL_ACCESSORS(StackFrameInfo, flag, is_eval, kIsEvalBit)
BOOL_ACCESSORS(StackFrameInfo, flag, is_constructor, kIsConstructorBit)
BOOL_ACCESSORS(StackFrameInfo, flag, is_wasm, kIsWasmBit)
ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray,

View File

@ -10112,6 +10112,7 @@ class StackFrameInfo : public Struct {
DECL_ACCESSORS(function_name, Object)
DECL_BOOLEAN_ACCESSORS(is_eval)
DECL_BOOLEAN_ACCESSORS(is_constructor)
DECL_BOOLEAN_ACCESSORS(is_wasm)
DECL_INT_ACCESSORS(flag)
DECLARE_CAST(StackFrameInfo)
@ -10135,6 +10136,7 @@ class StackFrameInfo : public Struct {
// Bit position in the flag, from least significant bit position.
static const int kIsEvalBit = 0;
static const int kIsConstructorBit = 1;
static const int kIsWasmBit = 2;
DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrameInfo);
};