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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 number_fun->shared()->DontAdaptArguments(); | 1311 number_fun->shared()->DontAdaptArguments(); |
1312 number_fun->shared()->SetConstructStub( | 1312 number_fun->shared()->SetConstructStub( |
1313 *isolate->builtins()->NumberConstructor_ConstructStub()); | 1313 *isolate->builtins()->NumberConstructor_ConstructStub()); |
1314 number_fun->shared()->set_length(1); | 1314 number_fun->shared()->set_length(1); |
1315 InstallWithIntrinsicDefaultProto(isolate, number_fun, | 1315 InstallWithIntrinsicDefaultProto(isolate, number_fun, |
1316 Context::NUMBER_FUNCTION_INDEX); | 1316 Context::NUMBER_FUNCTION_INDEX); |
1317 | 1317 |
1318 // Create the %NumberPrototype% | 1318 // Create the %NumberPrototype% |
1319 Handle<JSValue> prototype = | 1319 Handle<JSValue> prototype = |
1320 Handle<JSValue>::cast(factory->NewJSObject(number_fun, TENURED)); | 1320 Handle<JSValue>::cast(factory->NewJSObject(number_fun, TENURED)); |
1321 prototype->set_value(Smi::kZero); | 1321 prototype->set_value(Smi::FromInt(0)); |
1322 Accessors::FunctionSetPrototype(number_fun, prototype).Assert(); | 1322 Accessors::FunctionSetPrototype(number_fun, prototype).Assert(); |
1323 | 1323 |
1324 // Install the "constructor" property on the {prototype}. | 1324 // Install the "constructor" property on the {prototype}. |
1325 JSObject::AddProperty(prototype, factory->constructor_string(), number_fun, | 1325 JSObject::AddProperty(prototype, factory->constructor_string(), number_fun, |
1326 DONT_ENUM); | 1326 DONT_ENUM); |
1327 | 1327 |
1328 // Install the Number.prototype methods. | 1328 // Install the Number.prototype methods. |
1329 SimpleInstallFunction(prototype, "toExponential", | 1329 SimpleInstallFunction(prototype, "toExponential", |
1330 Builtins::kNumberPrototypeToExponential, 1, false); | 1330 Builtins::kNumberPrototypeToExponential, 1, false); |
1331 SimpleInstallFunction(prototype, "toFixed", | 1331 SimpleInstallFunction(prototype, "toFixed", |
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4208 if (!InstallNatives(context_type)) return; | 4208 if (!InstallNatives(context_type)) return; |
4209 | 4209 |
4210 MakeFunctionInstancePrototypeWritable(); | 4210 MakeFunctionInstancePrototypeWritable(); |
4211 | 4211 |
4212 if (!InstallExtraNatives()) return; | 4212 if (!InstallExtraNatives()) return; |
4213 if (!ConfigureGlobalObjects(global_proxy_template)) return; | 4213 if (!ConfigureGlobalObjects(global_proxy_template)) return; |
4214 | 4214 |
4215 isolate->counters()->contexts_created_from_scratch()->Increment(); | 4215 isolate->counters()->contexts_created_from_scratch()->Increment(); |
4216 // Re-initialize the counter because it got incremented during snapshot | 4216 // Re-initialize the counter because it got incremented during snapshot |
4217 // creation. | 4217 // creation. |
4218 isolate->native_context()->set_errors_thrown(Smi::kZero); | 4218 isolate->native_context()->set_errors_thrown(Smi::FromInt(0)); |
4219 } | 4219 } |
4220 | 4220 |
4221 // Install experimental natives. Do not include them into the | 4221 // Install experimental natives. Do not include them into the |
4222 // snapshot as we should be able to turn them off at runtime. Re-installing | 4222 // snapshot as we should be able to turn them off at runtime. Re-installing |
4223 // them after they have already been deserialized would also fail. | 4223 // them after they have already been deserialized would also fail. |
4224 if (context_type == FULL_CONTEXT) { | 4224 if (context_type == FULL_CONTEXT) { |
4225 if (!isolate->serializer_enabled()) { | 4225 if (!isolate->serializer_enabled()) { |
4226 InitializeExperimentalGlobal(); | 4226 InitializeExperimentalGlobal(); |
4227 if (!InstallExperimentalNatives()) return; | 4227 if (!InstallExperimentalNatives()) return; |
4228 | 4228 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4332 } | 4332 } |
4333 | 4333 |
4334 | 4334 |
4335 // Called when the top-level V8 mutex is destroyed. | 4335 // Called when the top-level V8 mutex is destroyed. |
4336 void Bootstrapper::FreeThreadResources() { | 4336 void Bootstrapper::FreeThreadResources() { |
4337 DCHECK(!IsActive()); | 4337 DCHECK(!IsActive()); |
4338 } | 4338 } |
4339 | 4339 |
4340 } // namespace internal | 4340 } // namespace internal |
4341 } // namespace v8 | 4341 } // namespace v8 |
OLD | NEW |