code = frames[i].code(); Handle offset(Smi::FromInt(frames[i].offset()), this); // The stack trace API should not expose receivers and function // objects on frames deeper than the top-most one with a strict // mode function. The number of non-strict frames is stored as // first element in the result array. if (!encountered_strict_function) { if (!fun->shared()->is_classic_mode()) { encountered_strict_function = true; } else { non_strict_frames++; } } elements->set(cursor++, *recv); elements->set(cursor++, *fun); elements->set(cursor++, *code); elements->set(cursor++, *offset); } } } elements->set(0, Smi::FromInt(non_strict_frames)); Handle result = factory()->NewJSArrayWithElements(elements); result->set_length(Smi::FromInt(cursor)); return result; } void Isolate::CaptureAndSetDetailedStackTrace(Handle error_object) { if (capture_stack_trace_for_uncaught_exceptions_) { // Capture stack trace for a detailed exception message. Handle key = factory()->hidden_stack_trace_string(); Handle stack_trace = CaptureCurrentStackTrace( stack_trace_for_uncaught_exceptions_frame_limit_, stack_trace_for_uncaught_exceptions_options_); JSObject::SetHiddenProperty(error_object, key, stack_trace); } } Handle Isolate::CaptureCurrentStackTrace( int frame_limit, StackTrace::StackTraceOptions options) { // Ensure no negative values. int limit = Max(frame_limit, 0); Handle stack_trace = factory()->NewJSArray(frame_limit); Handle column_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("column")); Handle line_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("lineNumber")); Handle script_id_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("scriptId")); Handle script_name_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("scriptName")); Handle script_name_or_source_url_key = factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("scriptNameOrSourceURL")); Handle function_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("functionName")); Handle eval_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isEval")); Handle constructor_key = factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isConstructor")); StackTraceFrameIterator it(this); int frames_seen = 0; while (!it.done() && (frames_seen < limit)) { JavaScriptFrame* frame = it.frame(); // Set initial size to the maximum inlining level + 1 for the outermost // function. List frames(FLAG_max_inlining_levels + 1); frame->Summarize(&frames); for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { // Create a JSObject to hold the information for the StackFrame. Handle stack_frame = factory()->NewJSObject(object_function()); Handle fun = frames[i].function(); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册