OLD | NEW |
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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 factory->empty_string(), DONT_ENUM); | 1049 factory->empty_string(), DONT_ENUM); |
1050 JSObject::AddProperty(prototype, factory->constructor_string(), error_fun, | 1050 JSObject::AddProperty(prototype, factory->constructor_string(), error_fun, |
1051 DONT_ENUM); | 1051 DONT_ENUM); |
1052 | 1052 |
1053 if (context_index == Context::ERROR_FUNCTION_INDEX) { | 1053 if (context_index == Context::ERROR_FUNCTION_INDEX) { |
1054 Handle<JSFunction> to_string_fun = | 1054 Handle<JSFunction> to_string_fun = |
1055 SimpleInstallFunction(prototype, factory->toString_string(), | 1055 SimpleInstallFunction(prototype, factory->toString_string(), |
1056 Builtins::kErrorPrototypeToString, 0, true); | 1056 Builtins::kErrorPrototypeToString, 0, true); |
1057 isolate->native_context()->set_error_to_string(*to_string_fun); | 1057 isolate->native_context()->set_error_to_string(*to_string_fun); |
1058 } else { | 1058 } else { |
1059 DCHECK(context_index != Context::ERROR_FUNCTION_INDEX); | |
1060 DCHECK(isolate->native_context()->error_to_string()->IsJSFunction()); | 1059 DCHECK(isolate->native_context()->error_to_string()->IsJSFunction()); |
1061 | 1060 |
1062 InstallFunction(prototype, isolate->error_to_string(), | 1061 InstallFunction(prototype, isolate->error_to_string(), |
1063 factory->toString_string(), DONT_ENUM); | 1062 factory->toString_string(), DONT_ENUM); |
1064 | 1063 |
1065 Handle<JSFunction> global_error = isolate->error_function(); | 1064 Handle<JSFunction> global_error = isolate->error_function(); |
1066 CHECK(JSReceiver::SetPrototype(error_fun, global_error, false, | 1065 CHECK(JSReceiver::SetPrototype(error_fun, global_error, false, |
1067 Object::THROW_ON_ERROR) | 1066 Object::THROW_ON_ERROR) |
1068 .FromMaybe(false)); | 1067 .FromMaybe(false)); |
1069 CHECK(JSReceiver::SetPrototype(prototype, | 1068 CHECK(JSReceiver::SetPrototype(prototype, |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 Context::MAKE_TYPE_ERROR_INDEX); | 1904 Context::MAKE_TYPE_ERROR_INDEX); |
1906 } | 1905 } |
1907 | 1906 |
1908 { // -- U R I E r r o r | 1907 { // -- U R I E r r o r |
1909 InstallError(isolate, global, factory->URIError_string(), | 1908 InstallError(isolate, global, factory->URIError_string(), |
1910 Context::URI_ERROR_FUNCTION_INDEX); | 1909 Context::URI_ERROR_FUNCTION_INDEX); |
1911 InstallMakeError(isolate, isolate->builtins()->MakeURIError(), | 1910 InstallMakeError(isolate, isolate->builtins()->MakeURIError(), |
1912 Context::MAKE_URI_ERROR_INDEX); | 1911 Context::MAKE_URI_ERROR_INDEX); |
1913 } | 1912 } |
1914 | 1913 |
| 1914 { // -- C o m p i l e E r r o r |
| 1915 Handle<JSObject> dummy = factory->NewJSObject(isolate->object_function()); |
| 1916 InstallError(isolate, dummy, factory->CompileError_string(), |
| 1917 Context::WASM_COMPILE_ERROR_FUNCTION_INDEX); |
| 1918 |
| 1919 // -- R u n t i m e E r r o r |
| 1920 InstallError(isolate, dummy, factory->RuntimeError_string(), |
| 1921 Context::WASM_RUNTIME_ERROR_FUNCTION_INDEX); |
| 1922 } |
| 1923 |
1915 // Initialize the embedder data slot. | 1924 // Initialize the embedder data slot. |
1916 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1925 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
1917 native_context()->set_embedder_data(*embedder_data); | 1926 native_context()->set_embedder_data(*embedder_data); |
1918 | 1927 |
1919 { // -- J S O N | 1928 { // -- J S O N |
1920 Handle<String> name = factory->InternalizeUtf8String("JSON"); | 1929 Handle<String> name = factory->InternalizeUtf8String("JSON"); |
1921 Handle<JSFunction> cons = factory->NewFunction(name); | 1930 Handle<JSFunction> cons = factory->NewFunction(name); |
1922 JSFunction::SetInstancePrototype(cons, | 1931 JSFunction::SetInstancePrototype(cons, |
1923 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1932 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1924 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1933 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); |
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4433 } | 4442 } |
4434 | 4443 |
4435 | 4444 |
4436 // Called when the top-level V8 mutex is destroyed. | 4445 // Called when the top-level V8 mutex is destroyed. |
4437 void Bootstrapper::FreeThreadResources() { | 4446 void Bootstrapper::FreeThreadResources() { |
4438 DCHECK(!IsActive()); | 4447 DCHECK(!IsActive()); |
4439 } | 4448 } |
4440 | 4449 |
4441 } // namespace internal | 4450 } // namespace internal |
4442 } // namespace v8 | 4451 } // namespace v8 |
OLD | NEW |