diff options
| author | Steve Block <steveblock@google.com> | 2011-05-24 12:43:12 +0100 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2011-05-24 13:42:09 +0100 |
| commit | 1e0659c275bb392c045087af4f6b0d7565cb3d77 (patch) | |
| tree | 09febd313ccef178417974f7b7098e89e20bfd93 /src/messages.cc | |
| parent | b8e0da25ee8efac3bb05cd6b2730aafbd96119f4 (diff) | |
| download | android_external_v8-1e0659c275bb392c045087af4f6b0d7565cb3d77.tar.gz android_external_v8-1e0659c275bb392c045087af4f6b0d7565cb3d77.tar.bz2 android_external_v8-1e0659c275bb392c045087af4f6b0d7565cb3d77.zip | |
Update V8 to r6768 as required by WebKit r78450
Change-Id: Ib8868ff7147a76547a8d1d85f257ebe8546a3d3f
Diffstat (limited to 'src/messages.cc')
| -rw-r--r-- | src/messages.cc | 85 |
1 files changed, 33 insertions, 52 deletions
diff --git a/src/messages.cc b/src/messages.cc index 42fc3c9b..990000a3 100644 --- a/src/messages.cc +++ b/src/messages.cc @@ -62,67 +62,48 @@ void MessageHandler::ReportMessage(const char* msg) { } -Handle<Object> MessageHandler::MakeMessageObject( +Handle<JSMessageObject> MessageHandler::MakeMessageObject( const char* type, MessageLocation* loc, Vector< Handle<Object> > args, Handle<String> stack_trace, Handle<JSArray> stack_frames) { - // Build error message object - v8::HandleScope scope; // Instantiate a closeable HandleScope for EscapeFrom. - Handle<Object> type_str = Factory::LookupAsciiSymbol(type); - Handle<Object> array = Factory::NewJSArray(args.length()); - for (int i = 0; i < args.length(); i++) - SetElement(Handle<JSArray>::cast(array), i, args[i]); - - Handle<JSFunction> fun(Top::global_context()->make_message_fun()); - int start, end; - Handle<Object> script; + Handle<String> type_handle = Factory::LookupAsciiSymbol(type); + Handle<FixedArray> arguments_elements = + Factory::NewFixedArray(args.length()); + for (int i = 0; i < args.length(); i++) { + arguments_elements->set(i, *args[i]); + } + Handle<JSArray> arguments_handle = + Factory::NewJSArrayWithElements(arguments_elements); + + int start = 0; + int end = 0; + Handle<Object> script_handle = Factory::undefined_value(); if (loc) { start = loc->start_pos(); end = loc->end_pos(); - script = GetScriptWrapper(loc->script()); - } else { - start = end = 0; - script = Factory::undefined_value(); + script_handle = GetScriptWrapper(loc->script()); } - Handle<Object> start_handle(Smi::FromInt(start)); - Handle<Object> end_handle(Smi::FromInt(end)); - Handle<Object> stack_trace_val = stack_trace.is_null() - ? Factory::undefined_value() - : Handle<Object>::cast(stack_trace); - Handle<Object> stack_frames_val = stack_frames.is_null() - ? Factory::undefined_value() - : Handle<Object>::cast(stack_frames); - const int argc = 7; - Object** argv[argc] = { type_str.location(), - array.location(), - start_handle.location(), - end_handle.location(), - script.location(), - stack_trace_val.location(), - stack_frames_val.location() }; - - // Setup a catch handler to catch exceptions in creating the message. This - // handler is non-verbose to avoid calling MakeMessage recursively in case of - // an exception. - v8::TryCatch catcher; - catcher.SetVerbose(false); - catcher.SetCaptureMessage(false); - - // Format the message. - bool caught_exception = false; - Handle<Object> message = - Execution::Call(fun, Factory::undefined_value(), argc, argv, - &caught_exception); - - // If creating the message (in JS code) resulted in an exception, we - // skip doing the callback. This usually only happens in case of - // stack overflow exceptions being thrown by the parser when the - // stack is almost full. - if (caught_exception) return Handle<Object>(); - - return message.EscapeFrom(&scope); + + Handle<Object> stack_trace_handle = stack_trace.is_null() + ? Factory::undefined_value() + : Handle<Object>::cast(stack_trace); + + Handle<Object> stack_frames_handle = stack_frames.is_null() + ? Factory::undefined_value() + : Handle<Object>::cast(stack_frames); + + Handle<JSMessageObject> message = + Factory::NewJSMessageObject(type_handle, + arguments_handle, + start, + end, + script_handle, + stack_trace_handle, + stack_frames_handle); + + return message; } |
