code(exit_frame->LookupCode(), this); const int offset = static_cast(exit_frame->pc() - code->instruction_start()); int flags = 0; if (helper.IsStrictFrame(*fun)) flags |= FrameArray::kIsStrict; if (exit_frame->IsConstructor()) flags |= FrameArray::kForceConstructor; elements = FrameArray::AppendJSFrame(elements, recv, fun, Handle::cast(code), offset, flags); } break; case StackFrame::WASM: { WasmFrame* wasm_frame = WasmFrame::cast(frame); Handle instance(wasm_frame->wasm_instance(), this); const int wasm_function_index = wasm_frame->function_index(); Code* code = wasm_frame->unchecked_code(); Handle abstract_code(AbstractCode::cast(code), this); const int offset = static_cast(wasm_frame->pc() - code->instruction_start()); // TODO(wasm): The wasm object returned by the WasmFrame should always // be a wasm object. DCHECK(wasm::IsWasmInstance(*instance) || instance->IsUndefined(this)); int flags = wasm::WasmIsAsmJs(*instance, this) ? FrameArray::kIsAsmJsWasmFrame : FrameArray::kIsWasmFrame; elements = FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, abstract_code, offset, flags); } break; default: break; } } elements->ShrinkToFit(); // TODO(yangguo): Queue this structured stack trace for preprocessing on GC. return factory()->NewJSArrayWithElements(elements); } MaybeHandle Isolate::CaptureAndSetDetailedStackTrace( Handle error_object) { if (capture_stack_trace_for_uncaught_exceptions_) { // Capture stack trace for a detailed exception message. Handle key = factory()->detailed_stack_trace_symbol(); Handle stack_trace = CaptureCurrentStackTrace( stack_trace_for_uncaught_exceptions_frame_limit_, stack_trace_for_uncaught_exceptions_options_); RETURN_ON_EXCEPTION( this, JSReceiver::SetProperty(error_object, key, stack_trace, STRICT), JSReceiver); } return error_object; } MaybeHandle Isolate::CaptureAndSetSimpleStackTrace( Handle error_object, FrameSkipMode mode, Handle caller) { // Capture stack trace for simple stack trace string formatting. Handle key = factory()->stack_trace_symbol(); Handle stack_trace = CaptureSimpleStackTrace(error_object, mode, caller); RETURN_ON_EXCEPTION( this, JSReceiver::SetProperty(error_object, key, stack_trace, STRICT), JSReceiver); return error_object; } Handle Isolate::GetDetailedStackTrace(Handle error_object) { Handle key_detailed = factory()->detailed_stack_trace_symbol(); Handle stack_trace = JSReceiver::GetDataProperty(error_object, key_detailed); if (stack_trace->IsJSArray()) return Handle::cast(stack_trace); return Handle(); } class CaptureStackTraceHelper { public: CaptureStackTraceHelper(Isolate* isolate, StackTrace::StackTraceOptions options) : isolate_(isolate) { if (options & StackTrace::kColumnOffset) { column_key_ = factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("column")); } if (options & StackTrace::kLineNumber) { line_key_ = factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("lineNumber")); } if (options & StackTrace::kScriptId) { script_id_key_ = factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptId")); } if (options & StackTrace::kScriptName) { script_name_key_ = factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptName")); } if (options & StackTrace::kScriptNameOrSourceURL) { script_name_or_source_url_key_ = factory()->InternalizeOneByteString( STATIC_CHAR_VECTOR("scriptNameOrSourceURL")); } if (options & StackTrace::kFunctionName) { function_key_ = factory()->InternalizeOneByteString( STATIC_CHAR_VECTOR("functionName")); } if (options & StackTrace::kIsEval) { eval_key_ = factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); } if (options & StackTrace::kIsConstructor) { constructor_key_ = factory()->InternalizeOneByteString( STATIC_CHAR_VECTOR("isConstructor")); } } Handle NewStackFrameObject(FrameSummary& summ) { int position = summ.abstract_code()->SourcePosition(summ.code_offset()); return NewStackFrameObject(summ.function(), position, summ.is_constructor()); } Handle NewStackFrameObject(Handle fun, int position, bool is_constructor) { Handle stack_frame = factory()->NewJSObject(isolate_->object_function()); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册