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

Side by Side Diff: src/isolate.cc

Issue 516913003: Do not expose termination exceptions to the Exception API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comment Created 6 years, 3 months 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 | « src/isolate.h ('k') | src/json-parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 if (data_obj == isolate->heap()->undefined_value()) return NULL; 638 if (data_obj == isolate->heap()->undefined_value()) return NULL;
639 639
640 return AccessCheckInfo::cast(data_obj); 640 return AccessCheckInfo::cast(data_obj);
641 } 641 }
642 642
643 643
644 void Isolate::ReportFailedAccessCheck(Handle<JSObject> receiver, 644 void Isolate::ReportFailedAccessCheck(Handle<JSObject> receiver,
645 v8::AccessType type) { 645 v8::AccessType type) {
646 if (!thread_local_top()->failed_access_check_callback_) { 646 if (!thread_local_top()->failed_access_check_callback_) {
647 Handle<String> message = factory()->InternalizeUtf8String("no access"); 647 Handle<String> message = factory()->InternalizeUtf8String("no access");
648 ScheduleThrow(*factory()->NewTypeError(message)); 648 Handle<Object> error;
649 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
650 this, error, factory()->NewTypeError(message), /* void */);
651 ScheduleThrow(*error);
649 return; 652 return;
650 } 653 }
651 654
652 DCHECK(receiver->IsAccessCheckNeeded()); 655 DCHECK(receiver->IsAccessCheckNeeded());
653 DCHECK(context()); 656 DCHECK(context());
654 657
655 // Get the data object from access check info. 658 // Get the data object from access check info.
656 HandleScope scope(this); 659 HandleScope scope(this);
657 Handle<Object> data; 660 Handle<Object> data;
658 { DisallowHeapAllocation no_gc; 661 { DisallowHeapAllocation no_gc;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 return heap()->exception(); 858 return heap()->exception();
856 } 859 }
857 860
858 861
859 Object* Isolate::ThrowIllegalOperation() { 862 Object* Isolate::ThrowIllegalOperation() {
860 if (FLAG_stack_trace_on_illegal) PrintStack(stdout); 863 if (FLAG_stack_trace_on_illegal) PrintStack(stdout);
861 return Throw(heap_.illegal_access_string()); 864 return Throw(heap_.illegal_access_string());
862 } 865 }
863 866
864 867
865 Object* Isolate::ThrowInvalidStringLength() {
866 return Throw(*factory()->NewRangeError(
867 "invalid_string_length", HandleVector<Object>(NULL, 0)));
868 }
869
870
871 void Isolate::ScheduleThrow(Object* exception) { 868 void Isolate::ScheduleThrow(Object* exception) {
872 // When scheduling a throw we first throw the exception to get the 869 // When scheduling a throw we first throw the exception to get the
873 // error reporting if it is uncaught before rescheduling it. 870 // error reporting if it is uncaught before rescheduling it.
874 Throw(exception); 871 Throw(exception);
875 PropagatePendingExceptionToExternalTryCatch(); 872 PropagatePendingExceptionToExternalTryCatch();
876 if (has_pending_exception()) { 873 if (has_pending_exception()) {
877 thread_local_top()->scheduled_exception_ = pending_exception(); 874 thread_local_top()->scheduled_exception_ = pending_exception();
878 thread_local_top()->external_caught_exception_ = false; 875 thread_local_top()->external_caught_exception_ = false;
879 clear_pending_exception(); 876 clear_pending_exception();
880 } 877 }
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2354 heap()->set_microtask_queue(heap()->empty_fixed_array()); 2351 heap()->set_microtask_queue(heap()->empty_fixed_array());
2355 2352
2356 for (int i = 0; i < num_tasks; i++) { 2353 for (int i = 0; i < num_tasks; i++) {
2357 HandleScope scope(this); 2354 HandleScope scope(this);
2358 Handle<Object> microtask(queue->get(i), this); 2355 Handle<Object> microtask(queue->get(i), this);
2359 if (microtask->IsJSFunction()) { 2356 if (microtask->IsJSFunction()) {
2360 Handle<JSFunction> microtask_function = 2357 Handle<JSFunction> microtask_function =
2361 Handle<JSFunction>::cast(microtask); 2358 Handle<JSFunction>::cast(microtask);
2362 SaveContext save(this); 2359 SaveContext save(this);
2363 set_context(microtask_function->context()->native_context()); 2360 set_context(microtask_function->context()->native_context());
2361 MaybeHandle<Object> maybe_exception;
2362 MaybeHandle<Object> result =
2363 Execution::TryCall(microtask_function, factory()->undefined_value(),
2364 0, NULL, &maybe_exception);
2365 // If execution is terminating, just bail out.
2364 Handle<Object> exception; 2366 Handle<Object> exception;
2365 MaybeHandle<Object> result = Execution::TryCall( 2367 if (result.is_null() && maybe_exception.is_null()) {
2366 microtask_function, factory()->undefined_value(),
2367 0, NULL, &exception);
2368 // If execution is terminating, just bail out.
2369 if (result.is_null() &&
2370 !exception.is_null() &&
2371 *exception == heap()->termination_exception()) {
2372 // Clear out any remaining callbacks in the queue. 2368 // Clear out any remaining callbacks in the queue.
2373 heap()->set_microtask_queue(heap()->empty_fixed_array()); 2369 heap()->set_microtask_queue(heap()->empty_fixed_array());
2374 set_pending_microtask_count(0); 2370 set_pending_microtask_count(0);
2375 return; 2371 return;
2376 } 2372 }
2377 } else { 2373 } else {
2378 Handle<CallHandlerInfo> callback_info = 2374 Handle<CallHandlerInfo> callback_info =
2379 Handle<CallHandlerInfo>::cast(microtask); 2375 Handle<CallHandlerInfo>::cast(microtask);
2380 v8::MicrotaskCallback callback = 2376 v8::MicrotaskCallback callback =
2381 v8::ToCData<v8::MicrotaskCallback>(callback_info->callback()); 2377 v8::ToCData<v8::MicrotaskCallback>(callback_info->callback());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 if (prev_ && prev_->Intercept(flag)) return true; 2413 if (prev_ && prev_->Intercept(flag)) return true;
2418 // Then check whether this scope intercepts. 2414 // Then check whether this scope intercepts.
2419 if ((flag & intercept_mask_)) { 2415 if ((flag & intercept_mask_)) {
2420 intercepted_flags_ |= flag; 2416 intercepted_flags_ |= flag;
2421 return true; 2417 return true;
2422 } 2418 }
2423 return false; 2419 return false;
2424 } 2420 }
2425 2421
2426 } } // namespace v8::internal 2422 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698