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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 SimpleInstallFunction(prototype, "toPrecision", | 1296 SimpleInstallFunction(prototype, "toPrecision", |
1297 Builtins::kNumberPrototypeToPrecision, 1, false); | 1297 Builtins::kNumberPrototypeToPrecision, 1, false); |
1298 SimpleInstallFunction(prototype, "toString", | 1298 SimpleInstallFunction(prototype, "toString", |
1299 Builtins::kNumberPrototypeToString, 1, false); | 1299 Builtins::kNumberPrototypeToString, 1, false); |
1300 SimpleInstallFunction(prototype, "valueOf", | 1300 SimpleInstallFunction(prototype, "valueOf", |
1301 Builtins::kNumberPrototypeValueOf, 0, true); | 1301 Builtins::kNumberPrototypeValueOf, 0, true); |
1302 | 1302 |
1303 // Install i18n fallback functions. | 1303 // Install i18n fallback functions. |
1304 SimpleInstallFunction(prototype, "toLocaleString", | 1304 SimpleInstallFunction(prototype, "toLocaleString", |
1305 Builtins::kNumberPrototypeToLocaleString, 0, false); | 1305 Builtins::kNumberPrototypeToLocaleString, 0, false); |
| 1306 |
| 1307 // Install the Number functions. |
| 1308 SimpleInstallFunction(number_fun, "isFinite", Builtins::kNumberIsFinite, 1, |
| 1309 true); |
| 1310 SimpleInstallFunction(number_fun, "isInteger", Builtins::kNumberIsInteger, |
| 1311 1, true); |
| 1312 SimpleInstallFunction(number_fun, "isNaN", Builtins::kNumberIsNaN, 1, true); |
| 1313 SimpleInstallFunction(number_fun, "isSafeInteger", |
| 1314 Builtins::kNumberIsSafeInteger, 1, true); |
1306 } | 1315 } |
1307 | 1316 |
1308 { // --- B o o l e a n --- | 1317 { // --- B o o l e a n --- |
1309 Handle<JSFunction> boolean_fun = | 1318 Handle<JSFunction> boolean_fun = |
1310 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, | 1319 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, |
1311 isolate->initial_object_prototype(), | 1320 isolate->initial_object_prototype(), |
1312 Builtins::kBooleanConstructor); | 1321 Builtins::kBooleanConstructor); |
1313 boolean_fun->shared()->DontAdaptArguments(); | 1322 boolean_fun->shared()->DontAdaptArguments(); |
1314 boolean_fun->shared()->SetConstructStub( | 1323 boolean_fun->shared()->SetConstructStub( |
1315 *isolate->builtins()->BooleanConstructor_ConstructStub()); | 1324 *isolate->builtins()->BooleanConstructor_ConstructStub()); |
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 false, kGlobalUnescape); | 3140 false, kGlobalUnescape); |
3132 | 3141 |
3133 // Install Global.eval. | 3142 // Install Global.eval. |
3134 { | 3143 { |
3135 Handle<JSFunction> eval = | 3144 Handle<JSFunction> eval = |
3136 SimpleInstallFunction(global_object, factory()->eval_string(), | 3145 SimpleInstallFunction(global_object, factory()->eval_string(), |
3137 Builtins::kGlobalEval, 1, false); | 3146 Builtins::kGlobalEval, 1, false); |
3138 native_context()->set_global_eval_fun(*eval); | 3147 native_context()->set_global_eval_fun(*eval); |
3139 } | 3148 } |
3140 | 3149 |
| 3150 // Install Global.isFinite |
| 3151 SimpleInstallFunction(global_object, "isFinite", Builtins::kGlobalIsFinite, 1, |
| 3152 true, kGlobalIsFinite); |
| 3153 |
| 3154 // Install Global.isNaN |
| 3155 SimpleInstallFunction(global_object, "isNaN", Builtins::kGlobalIsNaN, 1, true, |
| 3156 kGlobalIsNaN); |
| 3157 |
3141 // Install Array.prototype.concat | 3158 // Install Array.prototype.concat |
3142 { | 3159 { |
3143 Handle<JSFunction> array_constructor(native_context()->array_function()); | 3160 Handle<JSFunction> array_constructor(native_context()->array_function()); |
3144 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); | 3161 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); |
3145 Handle<JSFunction> concat = | 3162 Handle<JSFunction> concat = |
3146 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 3163 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
3147 MaybeHandle<JSObject>(), Builtins::kArrayConcat); | 3164 MaybeHandle<JSObject>(), Builtins::kArrayConcat); |
3148 | 3165 |
3149 // Make sure that Array.prototype.concat appears to be compiled. | 3166 // Make sure that Array.prototype.concat appears to be compiled. |
3150 // The code will never be called, but inline caching for call will | 3167 // The code will never be called, but inline caching for call will |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4125 } | 4142 } |
4126 | 4143 |
4127 | 4144 |
4128 // Called when the top-level V8 mutex is destroyed. | 4145 // Called when the top-level V8 mutex is destroyed. |
4129 void Bootstrapper::FreeThreadResources() { | 4146 void Bootstrapper::FreeThreadResources() { |
4130 DCHECK(!IsActive()); | 4147 DCHECK(!IsActive()); |
4131 } | 4148 } |
4132 | 4149 |
4133 } // namespace internal | 4150 } // namespace internal |
4134 } // namespace v8 | 4151 } // namespace v8 |
OLD | NEW |