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

Side by Side Diff: src/bootstrapper.cc

Issue 2636903002: Assert that context creation doesn't throw (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 2989
2990 DCHECK(context->IsNativeContext()); 2990 DCHECK(context->IsNativeContext());
2991 2991
2992 Handle<JSFunction> fun = 2992 Handle<JSFunction> fun =
2993 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, 2993 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info,
2994 context); 2994 context);
2995 Handle<Object> receiver = isolate->factory()->undefined_value(); 2995 Handle<Object> receiver = isolate->factory()->undefined_value();
2996 2996
2997 // For non-extension scripts, run script to get the function wrapper. 2997 // For non-extension scripts, run script to get the function wrapper.
2998 Handle<Object> wrapper; 2998 Handle<Object> wrapper;
2999 if (!Execution::Call(isolate, fun, receiver, 0, NULL).ToHandle(&wrapper)) { 2999 if (!Execution::TryCall(isolate, fun, receiver, 0, nullptr, nullptr)
3000 .ToHandle(&wrapper)) {
3000 return false; 3001 return false;
3001 } 3002 }
3002 // Then run the function wrapper. 3003 // Then run the function wrapper.
3003 return !Execution::Call(isolate, Handle<JSFunction>::cast(wrapper), receiver, 3004 return !Execution::TryCall(isolate, Handle<JSFunction>::cast(wrapper),
3004 argc, argv).is_null(); 3005 receiver, argc, argv, nullptr)
3006 .is_null();
3005 } 3007 }
3006 3008
3007 3009
3008 bool Genesis::CallUtilsFunction(Isolate* isolate, const char* name) { 3010 bool Genesis::CallUtilsFunction(Isolate* isolate, const char* name) {
3009 Handle<JSObject> utils = 3011 Handle<JSObject> utils =
3010 Handle<JSObject>::cast(isolate->natives_utils_object()); 3012 Handle<JSObject>::cast(isolate->natives_utils_object());
3011 Handle<String> name_string = 3013 Handle<String> name_string =
3012 isolate->factory()->NewStringFromAsciiChecked(name); 3014 isolate->factory()->NewStringFromAsciiChecked(name);
3013 Handle<Object> fun = JSObject::GetDataProperty(utils, name_string); 3015 Handle<Object> fun = JSObject::GetDataProperty(utils, name_string);
3014 Handle<Object> receiver = isolate->factory()->undefined_value(); 3016 Handle<Object> receiver = isolate->factory()->undefined_value();
3015 Handle<Object> args[] = {utils}; 3017 Handle<Object> args[] = {utils};
3016 return !Execution::Call(isolate, fun, receiver, 1, args).is_null(); 3018 return !Execution::TryCall(isolate, fun, receiver, 1, args, nullptr)
3019 .is_null();
3017 } 3020 }
3018 3021
3019 3022
3020 bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) { 3023 bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
3021 Factory* factory = isolate->factory(); 3024 Factory* factory = isolate->factory();
3022 HandleScope scope(isolate); 3025 HandleScope scope(isolate);
3023 Handle<SharedFunctionInfo> function_info; 3026 Handle<SharedFunctionInfo> function_info;
3024 3027
3025 Handle<String> source = 3028 Handle<String> source =
3026 isolate->factory() 3029 isolate->factory()
(...skipping 21 matching lines...) Expand all
3048 3051
3049 // Set up the function context. Conceptually, we should clone the 3052 // Set up the function context. Conceptually, we should clone the
3050 // function before overwriting the context but since we're in a 3053 // function before overwriting the context but since we're in a
3051 // single-threaded environment it is not strictly necessary. 3054 // single-threaded environment it is not strictly necessary.
3052 Handle<JSFunction> fun = 3055 Handle<JSFunction> fun =
3053 factory->NewFunctionFromSharedFunctionInfo(function_info, context); 3056 factory->NewFunctionFromSharedFunctionInfo(function_info, context);
3054 3057
3055 // Call function using either the runtime object or the global 3058 // Call function using either the runtime object or the global
3056 // object as the receiver. Provide no parameters. 3059 // object as the receiver. Provide no parameters.
3057 Handle<Object> receiver = isolate->global_object(); 3060 Handle<Object> receiver = isolate->global_object();
3058 return !Execution::Call(isolate, fun, receiver, 0, NULL).is_null(); 3061 return !Execution::TryCall(isolate, fun, receiver, 0, nullptr, nullptr)
3062 .is_null();
3059 } 3063 }
3060 3064
3061 3065
3062 static Handle<JSObject> ResolveBuiltinIdHolder(Handle<Context> native_context, 3066 static Handle<JSObject> ResolveBuiltinIdHolder(Handle<Context> native_context,
3063 const char* holder_expr) { 3067 const char* holder_expr) {
3064 Isolate* isolate = native_context->GetIsolate(); 3068 Isolate* isolate = native_context->GetIsolate();
3065 Factory* factory = isolate->factory(); 3069 Factory* factory = isolate->factory();
3066 Handle<JSGlobalObject> global(native_context->global_object()); 3070 Handle<JSGlobalObject> global(native_context->global_object());
3067 const char* period_pos = strchr(holder_expr, '.'); 3071 const char* period_pos = strchr(holder_expr, '.');
3068 if (period_pos == NULL) { 3072 if (period_pos == NULL) {
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
4762 } 4766 }
4763 4767
4764 4768
4765 // Called when the top-level V8 mutex is destroyed. 4769 // Called when the top-level V8 mutex is destroyed.
4766 void Bootstrapper::FreeThreadResources() { 4770 void Bootstrapper::FreeThreadResources() {
4767 DCHECK(!IsActive()); 4771 DCHECK(!IsActive());
4768 } 4772 }
4769 4773
4770 } // namespace internal 4774 } // namespace internal
4771 } // namespace v8 4775 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698