Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Side by Side Diff: src/builtins.cc

Issue 12901: Reporting uncaught errors at the boundary between C++ and JS instead of tryin... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/execution.cc » ('j') | src/execution.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 return Top::Throw(*obj); 347 return Top::Throw(*obj);
348 } 348 }
349 349
350 Object* raw_call_data = fun_data->call_code(); 350 Object* raw_call_data = fun_data->call_code();
351 if (!raw_call_data->IsUndefined()) { 351 if (!raw_call_data->IsUndefined()) {
352 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); 352 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data);
353 Object* callback_obj = call_data->callback(); 353 Object* callback_obj = call_data->callback();
354 v8::InvocationCallback callback = 354 v8::InvocationCallback callback =
355 v8::ToCData<v8::InvocationCallback>(callback_obj); 355 v8::ToCData<v8::InvocationCallback>(callback_obj);
356 Object* data_obj = call_data->data(); 356 Object* data_obj = call_data->data();
357 Object* result;
358 357
359 v8::Local<v8::Object> self = 358 v8::Local<v8::Object> self =
360 v8::Utils::ToLocal(Handle<JSObject>::cast(receiver)); 359 v8::Utils::ToLocal(Handle<JSObject>::cast(receiver));
361 Handle<Object> data_handle(data_obj); 360 Handle<Object> data_handle(data_obj);
362 v8::Local<v8::Value> data = v8::Utils::ToLocal(data_handle); 361 v8::Local<v8::Value> data = v8::Utils::ToLocal(data_handle);
363 ASSERT(raw_holder->IsJSObject()); 362 ASSERT(raw_holder->IsJSObject());
364 v8::Local<v8::Function> callee = v8::Utils::ToLocal(function); 363 v8::Local<v8::Function> callee = v8::Utils::ToLocal(function);
365 Handle<JSObject> holder_handle(JSObject::cast(raw_holder)); 364 Handle<JSObject> holder_handle(JSObject::cast(raw_holder));
366 v8::Local<v8::Object> holder = v8::Utils::ToLocal(holder_handle); 365 v8::Local<v8::Object> holder = v8::Utils::ToLocal(holder_handle);
367 LOG(ApiObjectAccess("call", JSObject::cast(*receiver))); 366 LOG(ApiObjectAccess("call", JSObject::cast(*receiver)));
368 v8::Arguments args = v8::ImplementationUtilities::NewArguments( 367 v8::Arguments args = v8::ImplementationUtilities::NewArguments(
369 data, 368 data,
370 holder, 369 holder,
371 callee, 370 callee,
372 is_construct, 371 is_construct,
373 reinterpret_cast<void**>(__argv__ - 1), 372 reinterpret_cast<void**>(__argv__ - 1),
374 __argc__ - 1); 373 __argc__ - 1);
375 374
376 v8::Handle<v8::Value> value; 375 v8::Handle<v8::Value> value;
377 { 376 {
378 // Leaving JavaScript. 377 // Leaving JavaScript.
379 VMState state(OTHER); 378 VMState state(OTHER);
380 value = callback(args); 379 value = callback(args);
381 } 380 }
381 Object* result;
382 if (value.IsEmpty()) { 382 if (value.IsEmpty()) {
383 result = Heap::undefined_value(); 383 result = Heap::undefined_value();
384 } else { 384 } else {
385 result = *reinterpret_cast<Object**>(*value); 385 result = *reinterpret_cast<Object**>(*value);
386 } 386 }
387 if (result->IsException()) {
388 ASSERT(Top::has_pending_exception());
389 Top::ReportPendingMessages();
Mads Ager (chromium) 2008/12/03 15:44:48 I'm not sure I understand why we need to check her
olehougaard 2008/12/04 08:44:35 This was a remnant from an earlier effort to get t
390 }
387 391
388 RETURN_IF_SCHEDULED_EXCEPTION(); 392 RETURN_IF_SCHEDULED_EXCEPTION();
389 if (!is_construct || result->IsJSObject()) return result; 393 if (!is_construct || result->IsJSObject()) return result;
390 } 394 }
391 395
392 return *receiver; 396 return *receiver;
393 } 397 }
394 BUILTIN_END 398 BUILTIN_END
395 399
396 400
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 if (entry->contains(pc)) { 698 if (entry->contains(pc)) {
695 return names_[i]; 699 return names_[i];
696 } 700 }
697 } 701 }
698 } 702 }
699 return NULL; 703 return NULL;
700 } 704 }
701 705
702 706
703 } } // namespace v8::internal 707 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/execution.cc » ('j') | src/execution.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698