Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 39840310288d26d77d0b2cb56fe8458885977345..71e43d48efa8f5fcf480a037f355ef7d14306042 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -1003,12 +1003,19 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global, |
JSObject::AddProperty(prototype, factory->constructor_string(), error_fun, |
DONT_ENUM); |
- Handle<JSFunction> to_string_fun = |
- SimpleInstallFunction(prototype, factory->toString_string(), |
- Builtins::kErrorPrototypeToString, 0, true); |
- to_string_fun->shared()->set_native(true); |
+ if (context_index == Context::ERROR_FUNCTION_INDEX) { |
+ Handle<JSFunction> to_string_fun = |
+ SimpleInstallFunction(prototype, factory->toString_string(), |
+ Builtins::kErrorPrototypeToString, 0, true); |
+ to_string_fun->shared()->set_native(true); |
+ isolate->native_context()->set_error_to_string(*to_string_fun); |
+ } else { |
+ DCHECK(context_index != Context::ERROR_FUNCTION_INDEX); |
+ DCHECK(isolate->native_context()->error_to_string()->IsJSFunction()); |
+ |
+ InstallFunction(prototype, isolate->error_to_string(), |
+ factory->toString_string(), DONT_ENUM); |
- if (context_index != Context::ERROR_FUNCTION_INDEX) { |
Handle<JSFunction> global_error = isolate->error_function(); |
CHECK(JSReceiver::SetPrototype(error_fun, global_error, false, |
Object::THROW_ON_ERROR) |
@@ -2698,6 +2705,13 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, |
Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); |
} |
} |
+ |
+ { // -- E r r o r |
+ Handle<JSFunction> make_err_fun = InstallFunction( |
+ container, "make_generic_error", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
+ isolate->initial_object_prototype(), Builtins::kMakeGenericError); |
+ make_err_fun->shared()->DontAdaptArguments(); |
+ } |
} |