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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 Handle<JSFunction> boolean_fun = | 1237 Handle<JSFunction> boolean_fun = |
1238 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, | 1238 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, |
1239 isolate->initial_object_prototype(), | 1239 isolate->initial_object_prototype(), |
1240 Builtins::kBooleanConstructor); | 1240 Builtins::kBooleanConstructor); |
1241 boolean_fun->shared()->DontAdaptArguments(); | 1241 boolean_fun->shared()->DontAdaptArguments(); |
1242 boolean_fun->shared()->set_construct_stub( | 1242 boolean_fun->shared()->set_construct_stub( |
1243 *isolate->builtins()->BooleanConstructor_ConstructStub()); | 1243 *isolate->builtins()->BooleanConstructor_ConstructStub()); |
1244 boolean_fun->shared()->set_length(1); | 1244 boolean_fun->shared()->set_length(1); |
1245 InstallWithIntrinsicDefaultProto(isolate, boolean_fun, | 1245 InstallWithIntrinsicDefaultProto(isolate, boolean_fun, |
1246 Context::BOOLEAN_FUNCTION_INDEX); | 1246 Context::BOOLEAN_FUNCTION_INDEX); |
| 1247 |
| 1248 // Create the %BooleanPrototype% |
| 1249 Handle<JSValue> prototype = |
| 1250 Handle<JSValue>::cast(factory->NewJSObject(boolean_fun, TENURED)); |
| 1251 prototype->set_value(isolate->heap()->false_value()); |
| 1252 Accessors::FunctionSetPrototype(boolean_fun, prototype).Assert(); |
| 1253 |
| 1254 // Install the "constructor" property on the {prototype}. |
| 1255 JSObject::AddProperty(prototype, factory->constructor_string(), boolean_fun, |
| 1256 DONT_ENUM); |
| 1257 |
| 1258 // Install the Boolean.prototype methods. |
| 1259 SimpleInstallFunction(prototype, "toString", |
| 1260 Builtins::kBooleanPrototypeToString, 0, false); |
| 1261 SimpleInstallFunction(prototype, "valueOf", |
| 1262 Builtins::kBooleanPrototypeValueOf, 0, false); |
1247 } | 1263 } |
1248 | 1264 |
1249 { // --- S t r i n g --- | 1265 { // --- S t r i n g --- |
1250 Handle<JSFunction> string_fun = InstallFunction( | 1266 Handle<JSFunction> string_fun = InstallFunction( |
1251 global, "String", JS_VALUE_TYPE, JSValue::kSize, | 1267 global, "String", JS_VALUE_TYPE, JSValue::kSize, |
1252 isolate->initial_object_prototype(), Builtins::kStringConstructor); | 1268 isolate->initial_object_prototype(), Builtins::kStringConstructor); |
1253 string_fun->shared()->set_construct_stub( | 1269 string_fun->shared()->set_construct_stub( |
1254 *isolate->builtins()->StringConstructor_ConstructStub()); | 1270 *isolate->builtins()->StringConstructor_ConstructStub()); |
1255 string_fun->shared()->DontAdaptArguments(); | 1271 string_fun->shared()->DontAdaptArguments(); |
1256 string_fun->shared()->set_length(1); | 1272 string_fun->shared()->set_length(1); |
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3655 } | 3671 } |
3656 | 3672 |
3657 | 3673 |
3658 // Called when the top-level V8 mutex is destroyed. | 3674 // Called when the top-level V8 mutex is destroyed. |
3659 void Bootstrapper::FreeThreadResources() { | 3675 void Bootstrapper::FreeThreadResources() { |
3660 DCHECK(!IsActive()); | 3676 DCHECK(!IsActive()); |
3661 } | 3677 } |
3662 | 3678 |
3663 } // namespace internal | 3679 } // namespace internal |
3664 } // namespace v8 | 3680 } // namespace v8 |
OLD | NEW |