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 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 // Setup the methods on the %FunctionPrototype%. | 1141 // Setup the methods on the %FunctionPrototype%. |
1142 SimpleInstallFunction(prototype, factory->apply_string(), | 1142 SimpleInstallFunction(prototype, factory->apply_string(), |
1143 Builtins::kFunctionPrototypeApply, 2, false); | 1143 Builtins::kFunctionPrototypeApply, 2, false); |
1144 SimpleInstallFunction(prototype, factory->bind_string(), | 1144 SimpleInstallFunction(prototype, factory->bind_string(), |
1145 Builtins::kFunctionPrototypeBind, 1, false); | 1145 Builtins::kFunctionPrototypeBind, 1, false); |
1146 SimpleInstallFunction(prototype, factory->call_string(), | 1146 SimpleInstallFunction(prototype, factory->call_string(), |
1147 Builtins::kFunctionPrototypeCall, 1, false); | 1147 Builtins::kFunctionPrototypeCall, 1, false); |
1148 SimpleInstallFunction(prototype, factory->toString_string(), | 1148 SimpleInstallFunction(prototype, factory->toString_string(), |
1149 Builtins::kFunctionPrototypeToString, 0, false); | 1149 Builtins::kFunctionPrototypeToString, 0, false); |
1150 | 1150 |
1151 // Install the @@hasInstance function. | |
1152 Handle<JSFunction> has_instance = InstallFunction( | |
1153 prototype, factory->has_instance_symbol(), JS_OBJECT_TYPE, | |
1154 JSObject::kHeaderSize, MaybeHandle<JSObject>(), | |
1155 Builtins::kFunctionHasInstance, | |
1156 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); | |
1157 | |
1158 // Set the expected parameters for @@hasInstance to 1; required by builtin. | |
1159 has_instance->shared()->set_internal_formal_parameter_count(1); | |
1160 | |
1161 // Set the length for the function to satisfy ECMA-262. | |
1162 has_instance->shared()->set_length(1); | |
1163 | |
1164 // Install the "constructor" property on the %FunctionPrototype%. | 1151 // Install the "constructor" property on the %FunctionPrototype%. |
1165 JSObject::AddProperty(prototype, factory->constructor_string(), | 1152 JSObject::AddProperty(prototype, factory->constructor_string(), |
1166 function_fun, DONT_ENUM); | 1153 function_fun, DONT_ENUM); |
1167 | 1154 |
1168 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); | 1155 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); |
1169 strict_function_map_writable_prototype_->SetConstructor(*function_fun); | 1156 strict_function_map_writable_prototype_->SetConstructor(*function_fun); |
1170 native_context()->strong_function_map()->SetConstructor(*function_fun); | 1157 native_context()->strong_function_map()->SetConstructor(*function_fun); |
1171 } | 1158 } |
1172 | 1159 |
1173 { // --- A r r a y --- | 1160 { // --- A r r a y --- |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 JSGlobalObject::cast(native_context()->global_object())); | 2508 JSGlobalObject::cast(native_context()->global_object())); |
2522 Isolate* isolate = global->GetIsolate(); | 2509 Isolate* isolate = global->GetIsolate(); |
2523 Factory* factory = isolate->factory(); | 2510 Factory* factory = isolate->factory(); |
2524 | 2511 |
2525 InstallJSProxyMaps(); | 2512 InstallJSProxyMaps(); |
2526 | 2513 |
2527 // Create the Proxy object. | 2514 // Create the Proxy object. |
2528 Handle<String> name = factory->Proxy_string(); | 2515 Handle<String> name = factory->Proxy_string(); |
2529 Handle<Code> code(isolate->builtins()->ProxyConstructor()); | 2516 Handle<Code> code(isolate->builtins()->ProxyConstructor()); |
2530 | 2517 |
2531 Handle<JSFunction> proxy_function = | 2518 Handle<JSFunction> proxy_function = factory->NewFunction( |
2532 factory->NewFunction(isolate->proxy_function_map(), | 2519 isolate->proxy_function_map(), factory->Proxy_string(), code); |
2533 factory->Proxy_string(), MaybeHandle<Code>(code)); | |
2534 | 2520 |
2535 JSFunction::SetInitialMap(proxy_function, | 2521 JSFunction::SetInitialMap(proxy_function, |
2536 Handle<Map>(native_context()->proxy_map(), isolate), | 2522 Handle<Map>(native_context()->proxy_map(), isolate), |
2537 factory->null_value()); | 2523 factory->null_value()); |
2538 | 2524 |
2539 proxy_function->shared()->set_construct_stub( | 2525 proxy_function->shared()->set_construct_stub( |
2540 *isolate->builtins()->ProxyConstructor_ConstructStub()); | 2526 *isolate->builtins()->ProxyConstructor_ConstructStub()); |
2541 proxy_function->shared()->set_internal_formal_parameter_count(2); | 2527 proxy_function->shared()->set_internal_formal_parameter_count(2); |
2542 proxy_function->shared()->set_length(2); | 2528 proxy_function->shared()->set_length(2); |
2543 | 2529 |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3649 } | 3635 } |
3650 | 3636 |
3651 | 3637 |
3652 // Called when the top-level V8 mutex is destroyed. | 3638 // Called when the top-level V8 mutex is destroyed. |
3653 void Bootstrapper::FreeThreadResources() { | 3639 void Bootstrapper::FreeThreadResources() { |
3654 DCHECK(!IsActive()); | 3640 DCHECK(!IsActive()); |
3655 } | 3641 } |
3656 | 3642 |
3657 } // namespace internal | 3643 } // namespace internal |
3658 } // namespace v8 | 3644 } // namespace v8 |
OLD | NEW |