| 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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
| (...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 #undef EXPORT_PRIVATE_SYMBOL | 2075 #undef EXPORT_PRIVATE_SYMBOL |
| 2076 | 2076 |
| 2077 #define EXPORT_PUBLIC_SYMBOL(NAME, DESCRIPTION) \ | 2077 #define EXPORT_PUBLIC_SYMBOL(NAME, DESCRIPTION) \ |
| 2078 Handle<String> NAME##_name = factory->NewStringFromAsciiChecked(#NAME); \ | 2078 Handle<String> NAME##_name = factory->NewStringFromAsciiChecked(#NAME); \ |
| 2079 JSObject::AddProperty(container, NAME##_name, factory->NAME(), NONE); | 2079 JSObject::AddProperty(container, NAME##_name, factory->NAME(), NONE); |
| 2080 PUBLIC_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) | 2080 PUBLIC_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) |
| 2081 WELL_KNOWN_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) | 2081 WELL_KNOWN_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) |
| 2082 #undef EXPORT_PUBLIC_SYMBOL | 2082 #undef EXPORT_PUBLIC_SYMBOL |
| 2083 | 2083 |
| 2084 { | 2084 { |
| 2085 Handle<JSFunction> apply = InstallFunction( | |
| 2086 container, "reflect_apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | |
| 2087 MaybeHandle<JSObject>(), Builtins::kReflectApply); | |
| 2088 apply->shared()->DontAdaptArguments(); | |
| 2089 apply->shared()->set_length(3); | |
| 2090 native_context->set_reflect_apply(*apply); | |
| 2091 } | |
| 2092 | |
| 2093 { | |
| 2094 Handle<JSFunction> construct = InstallFunction( | |
| 2095 container, "reflect_construct", JS_OBJECT_TYPE, JSObject::kHeaderSize, | |
| 2096 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); | |
| 2097 construct->shared()->DontAdaptArguments(); | |
| 2098 construct->shared()->set_length(2); | |
| 2099 native_context->set_reflect_construct(*construct); | |
| 2100 } | |
| 2101 | |
| 2102 { | |
| 2103 Handle<JSFunction> to_string = InstallFunction( | 2085 Handle<JSFunction> to_string = InstallFunction( |
| 2104 container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2086 container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 2105 MaybeHandle<JSObject>(), Builtins::kObjectProtoToString); | 2087 MaybeHandle<JSObject>(), Builtins::kObjectProtoToString); |
| 2106 to_string->shared()->DontAdaptArguments(); | 2088 to_string->shared()->DontAdaptArguments(); |
| 2107 to_string->shared()->set_length(0); | 2089 to_string->shared()->set_length(0); |
| 2108 native_context->set_object_to_string(*to_string); | 2090 native_context->set_object_to_string(*to_string); |
| 2109 } | 2091 } |
| 2110 | 2092 |
| 2111 Handle<JSObject> iterator_prototype; | 2093 Handle<JSObject> iterator_prototype; |
| 2112 | 2094 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 Handle<JSFunction> define_property = | 2388 Handle<JSFunction> define_property = |
| 2407 SimpleCreateFunction(isolate(), factory->defineProperty_string(), | 2389 SimpleCreateFunction(isolate(), factory->defineProperty_string(), |
| 2408 Builtins::kReflectDefineProperty, 3, true); | 2390 Builtins::kReflectDefineProperty, 3, true); |
| 2409 native_context()->set_reflect_define_property(*define_property); | 2391 native_context()->set_reflect_define_property(*define_property); |
| 2410 | 2392 |
| 2411 Handle<JSFunction> delete_property = | 2393 Handle<JSFunction> delete_property = |
| 2412 SimpleCreateFunction(isolate(), factory->deleteProperty_string(), | 2394 SimpleCreateFunction(isolate(), factory->deleteProperty_string(), |
| 2413 Builtins::kReflectDeleteProperty, 2, true); | 2395 Builtins::kReflectDeleteProperty, 2, true); |
| 2414 native_context()->set_reflect_delete_property(*delete_property); | 2396 native_context()->set_reflect_delete_property(*delete_property); |
| 2415 | 2397 |
| 2398 Handle<JSFunction> apply = SimpleCreateFunction( |
| 2399 isolate(), factory->apply_string(), Builtins::kReflectApply, 3, false); |
| 2400 native_context()->set_reflect_apply(*apply); |
| 2401 |
| 2402 Handle<JSFunction> construct = |
| 2403 SimpleCreateFunction(isolate(), factory->construct_string(), |
| 2404 Builtins::kReflectConstruct, 2, false); |
| 2405 native_context()->set_reflect_construct(*construct); |
| 2406 |
| 2416 if (!FLAG_harmony_reflect) return; | 2407 if (!FLAG_harmony_reflect) return; |
| 2417 | 2408 |
| 2418 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 2409 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
| 2419 native_context()->global_object())); | 2410 native_context()->global_object())); |
| 2420 Handle<String> reflect_string = factory->NewStringFromStaticChars("Reflect"); | 2411 Handle<String> reflect_string = factory->NewStringFromStaticChars("Reflect"); |
| 2421 Handle<JSObject> reflect = | 2412 Handle<JSObject> reflect = |
| 2422 factory->NewJSObject(isolate()->object_function(), TENURED); | 2413 factory->NewJSObject(isolate()->object_function(), TENURED); |
| 2423 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 2414 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |
| 2424 | 2415 |
| 2425 InstallFunction(reflect, define_property, factory->defineProperty_string()); | 2416 InstallFunction(reflect, define_property, factory->defineProperty_string()); |
| 2426 InstallFunction(reflect, delete_property, factory->deleteProperty_string()); | 2417 InstallFunction(reflect, delete_property, factory->deleteProperty_string()); |
| 2418 InstallFunction(reflect, apply, factory->apply_string()); |
| 2419 InstallFunction(reflect, construct, factory->construct_string()); |
| 2427 | 2420 |
| 2428 SimpleInstallFunction(reflect, factory->get_string(), | 2421 SimpleInstallFunction(reflect, factory->get_string(), |
| 2429 Builtins::kReflectGet, 2, false); | 2422 Builtins::kReflectGet, 2, false); |
| 2430 SimpleInstallFunction(reflect, factory->getOwnPropertyDescriptor_string(), | 2423 SimpleInstallFunction(reflect, factory->getOwnPropertyDescriptor_string(), |
| 2431 Builtins::kReflectGetOwnPropertyDescriptor, 2, true); | 2424 Builtins::kReflectGetOwnPropertyDescriptor, 2, true); |
| 2432 SimpleInstallFunction(reflect, factory->getPrototypeOf_string(), | 2425 SimpleInstallFunction(reflect, factory->getPrototypeOf_string(), |
| 2433 Builtins::kReflectGetPrototypeOf, 1, true); | 2426 Builtins::kReflectGetPrototypeOf, 1, true); |
| 2434 SimpleInstallFunction(reflect, factory->has_string(), | 2427 SimpleInstallFunction(reflect, factory->has_string(), |
| 2435 Builtins::kReflectHas, 2, true); | 2428 Builtins::kReflectHas, 2, true); |
| 2436 SimpleInstallFunction(reflect, factory->isExtensible_string(), | 2429 SimpleInstallFunction(reflect, factory->isExtensible_string(), |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3680 } | 3673 } |
| 3681 | 3674 |
| 3682 | 3675 |
| 3683 // Called when the top-level V8 mutex is destroyed. | 3676 // Called when the top-level V8 mutex is destroyed. |
| 3684 void Bootstrapper::FreeThreadResources() { | 3677 void Bootstrapper::FreeThreadResources() { |
| 3685 DCHECK(!IsActive()); | 3678 DCHECK(!IsActive()); |
| 3686 } | 3679 } |
| 3687 | 3680 |
| 3688 } // namespace internal | 3681 } // namespace internal |
| 3689 } // namespace v8 | 3682 } // namespace v8 |
| OLD | NEW |