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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 Builtins::kFunctionPrototypeBind, 1, false); | 1182 Builtins::kFunctionPrototypeBind, 1, false); |
1183 SimpleInstallFunction(prototype, factory->call_string(), | 1183 SimpleInstallFunction(prototype, factory->call_string(), |
1184 Builtins::kFunctionPrototypeCall, 1, false); | 1184 Builtins::kFunctionPrototypeCall, 1, false); |
1185 SimpleInstallFunction(prototype, factory->toString_string(), | 1185 SimpleInstallFunction(prototype, factory->toString_string(), |
1186 Builtins::kFunctionPrototypeToString, 0, false); | 1186 Builtins::kFunctionPrototypeToString, 0, false); |
1187 | 1187 |
1188 // Install the @@hasInstance function. | 1188 // Install the @@hasInstance function. |
1189 Handle<JSFunction> has_instance = InstallFunction( | 1189 Handle<JSFunction> has_instance = InstallFunction( |
1190 prototype, factory->has_instance_symbol(), JS_OBJECT_TYPE, | 1190 prototype, factory->has_instance_symbol(), JS_OBJECT_TYPE, |
1191 JSObject::kHeaderSize, MaybeHandle<JSObject>(), | 1191 JSObject::kHeaderSize, MaybeHandle<JSObject>(), |
1192 Builtins::kFunctionHasInstance, | 1192 Builtins::kFunctionPrototypeHasInstance, |
1193 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); | 1193 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); |
1194 | 1194 |
1195 // Set the expected parameters for @@hasInstance to 1; required by builtin. | 1195 // Set the expected parameters for @@hasInstance to 1; required by builtin. |
1196 has_instance->shared()->set_internal_formal_parameter_count(1); | 1196 has_instance->shared()->set_internal_formal_parameter_count(1); |
1197 | 1197 |
1198 // Set the length for the function to satisfy ECMA-262. | 1198 // Set the length for the function to satisfy ECMA-262. |
1199 has_instance->shared()->set_length(1); | 1199 has_instance->shared()->set_length(1); |
1200 | 1200 |
1201 // Install in the native context | |
1202 native_context()->set_ordinary_has_instance(*has_instance); | |
1203 | |
1204 // Install the "constructor" property on the %FunctionPrototype%. | 1201 // Install the "constructor" property on the %FunctionPrototype%. |
1205 JSObject::AddProperty(prototype, factory->constructor_string(), | 1202 JSObject::AddProperty(prototype, factory->constructor_string(), |
1206 function_fun, DONT_ENUM); | 1203 function_fun, DONT_ENUM); |
1207 | 1204 |
1208 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); | 1205 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); |
1209 strict_function_map_writable_prototype_->SetConstructor(*function_fun); | 1206 strict_function_map_writable_prototype_->SetConstructor(*function_fun); |
1210 } | 1207 } |
1211 | 1208 |
1212 { // --- A r r a y --- | 1209 { // --- A r r a y --- |
1213 Handle<JSFunction> array_function = | 1210 Handle<JSFunction> array_function = |
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 } | 3764 } |
3768 | 3765 |
3769 | 3766 |
3770 // Called when the top-level V8 mutex is destroyed. | 3767 // Called when the top-level V8 mutex is destroyed. |
3771 void Bootstrapper::FreeThreadResources() { | 3768 void Bootstrapper::FreeThreadResources() { |
3772 DCHECK(!IsActive()); | 3769 DCHECK(!IsActive()); |
3773 } | 3770 } |
3774 | 3771 |
3775 } // namespace internal | 3772 } // namespace internal |
3776 } // namespace v8 | 3773 } // namespace v8 |
OLD | NEW |