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 sloppy frames is stored as // first element in the result array. if (!encountered_strict_function) { if (is_strict(fun->shared()->language_mode())) { encountered_strict_function = true; } else { sloppy_frames++; } } elements->set(cursor++, *recv); elements->set(cursor++, *fun); elements->set(cursor++, *code); elements->set(cursor++, *offset); frames_seen++; } } elements->set(0, Smi::FromInt(sloppy_frames)); elements->Shrink(cursor); Handle result = factory()->NewJSArrayWithElements(elements); result->set_length(Smi::FromInt(cursor)); // TODO(yangguo): Queue this structured stack trace for preprocessing on GC. return result; } 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, JSObject::SetProperty(error_object, key, stack_trace, STRICT), JSObject); } return error_object; } MaybeHandle Isolate::CaptureAndSetSimpleStackTrace( Handle error_object, Handle caller) { // Capture stack trace for simple stack trace string formatting. Handle key = factory()->stack_trace_symbol(); Handle stack_trace = CaptureSimpleStackTrace(error_object, caller); RETURN_ON_EXCEPTION( this, JSObject::SetProperty(error_object, key, stack_trace, STRICT), JSObject); 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); if (!capture_stack_trace_for_uncaught_exceptions_) return Handle(); // Try to get details from simple stack trace. Handle detailed_stack_trace = GetDetailedFromSimpleStackTrace(error_object); if (!detailed_stack_trace.is_null()) { // Save the detailed stack since the simple one might be withdrawn later. JSObject::SetProperty(error_object, key_detailed, detailed_stack_trace, STRICT).Assert(); } return detailed_stack_trace; } 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(Handle fun, int position, bool is_constructor) { Handle stack_frame = factory()->NewJSObject(isolate_->object_function()); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册