diff options
Diffstat (limited to 'deps/v8/src/messages.cc')
-rw-r--r-- | deps/v8/src/messages.cc | 96 |
1 files changed, 61 insertions, 35 deletions
diff --git a/deps/v8/src/messages.cc b/deps/v8/src/messages.cc index a1c228ec59..3d98da4e63 100644 --- a/deps/v8/src/messages.cc +++ b/deps/v8/src/messages.cc @@ -305,10 +305,9 @@ void JSStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array, const int flags = array->Flags(frame_ix)->value(); is_constructor_ = (flags & FrameArray::kIsConstructor) != 0; is_strict_ = (flags & FrameArray::kIsStrict) != 0; + is_async_ = (flags & FrameArray::kIsAsync) != 0; } -JSStackFrame::JSStackFrame() {} - JSStackFrame::JSStackFrame(Isolate* isolate, Handle<Object> receiver, Handle<JSFunction> function, Handle<AbstractCode> code, int offset) @@ -317,6 +316,7 @@ JSStackFrame::JSStackFrame(Isolate* isolate, Handle<Object> receiver, function_(function), code_(code), offset_(offset), + is_async_(false), is_constructor_(false), is_strict_(false) {} @@ -386,6 +386,13 @@ Handle<Object> JSStackFrame::GetMethodName() { } Handle<String> name(function_->shared()->Name(), isolate_); + + // The static initializer function is not a method, so don't add a + // class name, just return the function name. + if (name->IsUtf8EqualTo(CStrVector("<static_fields_initializer>"), true)) { + return name; + } + // ES2015 gives getters and setters name prefixes which must // be stripped to find the property name. if (name->IsUtf8EqualTo(CStrVector("get "), true) || @@ -599,9 +606,13 @@ MaybeHandle<String> JSStackFrame::ToString() { Handle<Object> function_name = GetFunctionName(); const bool is_toplevel = IsToplevel(); + const bool is_async = IsAsync(); const bool is_constructor = IsConstructor(); const bool is_method_call = !(is_toplevel || is_constructor); + if (is_async) { + builder.AppendCString("async "); + } if (is_method_call) { AppendMethodCall(isolate_, this, &builder); } else if (is_constructor) { @@ -635,8 +646,6 @@ Handle<Script> JSStackFrame::GetScript() const { return handle(Script::cast(function_->shared()->script()), isolate_); } -WasmStackFrame::WasmStackFrame() {} - void WasmStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix) { // This function is called for compiled and interpreted wasm frames, and for @@ -728,8 +737,6 @@ Handle<Script> WasmStackFrame::GetScript() const { return handle(wasm_instance_->module_object()->script(), isolate_); } -AsmJsWasmStackFrame::AsmJsWasmStackFrame() {} - void AsmJsWasmStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix) { @@ -851,8 +858,9 @@ MaybeHandle<Object> ConstructCallSite(Isolate* isolate, handle(isolate->native_context()->callsite_function(), isolate); Handle<JSObject> obj; - ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, JSObject::New(target, target), - Object); + ASSIGN_RETURN_ON_EXCEPTION( + isolate, obj, + JSObject::New(target, target, Handle<AllocationSite>::null()), Object); Handle<Symbol> key = isolate->factory()->call_site_frame_array_symbol(); RETURN_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes( @@ -947,39 +955,55 @@ MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate, Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements()), isolate); - // If there's a user-specified "prepareStackFrames" function, call it on the - // frames and use its result. + const bool in_recursion = isolate->formatting_stack_trace(); + if (!in_recursion) { + if (isolate->HasPrepareStackTraceCallback()) { + Handle<Context> error_context = error->GetCreationContext(); + DCHECK(!error_context.is_null() && error_context->IsNativeContext()); + PrepareStackTraceScope scope(isolate); - Handle<JSFunction> global_error = isolate->error_function(); - Handle<Object> prepare_stack_trace; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, prepare_stack_trace, - JSFunction::GetProperty(isolate, global_error, "prepareStackTrace"), - Object); + Handle<Object> result; + ASSIGN_RETURN_ON_EXCEPTION( + isolate, result, + isolate->RunPrepareStackTraceCallback(error_context, error), Object); + return result; + } else { + Handle<JSFunction> global_error = isolate->error_function(); - const bool in_recursion = isolate->formatting_stack_trace(); - if (prepare_stack_trace->IsJSFunction() && !in_recursion) { - PrepareStackTraceScope scope(isolate); + // If there's a user-specified "prepareStackTrace" function, call it on + // the frames and use its result. - isolate->CountUsage(v8::Isolate::kErrorPrepareStackTrace); + Handle<Object> prepare_stack_trace; + ASSIGN_RETURN_ON_EXCEPTION( + isolate, prepare_stack_trace, + JSFunction::GetProperty(isolate, global_error, "prepareStackTrace"), + Object); - Handle<JSArray> sites; - ASSIGN_RETURN_ON_EXCEPTION(isolate, sites, GetStackFrames(isolate, elems), - Object); + if (prepare_stack_trace->IsJSFunction()) { + PrepareStackTraceScope scope(isolate); - const int argc = 2; - ScopedVector<Handle<Object>> argv(argc); + isolate->CountUsage(v8::Isolate::kErrorPrepareStackTrace); - argv[0] = error; - argv[1] = sites; + Handle<JSArray> sites; + ASSIGN_RETURN_ON_EXCEPTION(isolate, sites, + GetStackFrames(isolate, elems), Object); - Handle<Object> result; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, result, Execution::Call(isolate, prepare_stack_trace, - global_error, argc, argv.start()), - Object); + const int argc = 2; + ScopedVector<Handle<Object>> argv(argc); + argv[0] = error; + argv[1] = sites; + + Handle<Object> result; - return result; + ASSIGN_RETURN_ON_EXCEPTION( + isolate, result, + Execution::Call(isolate, prepare_stack_trace, global_error, argc, + argv.start()), + Object); + + return result; + } + } } // Otherwise, run our internal formatting logic. @@ -1107,8 +1131,10 @@ MaybeHandle<Object> ErrorUtils::Construct( // 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%ErrorPrototype%", // « [[ErrorData]] »). Handle<JSObject> err; - ASSIGN_RETURN_ON_EXCEPTION(isolate, err, - JSObject::New(target, new_target_recv), Object); + ASSIGN_RETURN_ON_EXCEPTION( + isolate, err, + JSObject::New(target, new_target_recv, Handle<AllocationSite>::null()), + Object); // 3. If message is not undefined, then // a. Let msg be ? ToString(message). |