Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1248)

Side by Side Diff: src/bootstrapper.cc

Issue 2715793004: Migrate Number constants and undefined to C++ (Closed)
Patch Set: Reuse string Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | src/js/v8natives.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 JSObject::AddProperty(global_object, 1490 JSObject::AddProperty(global_object,
1491 factory->NewStringFromAsciiChecked("parseFloat"), 1491 factory->NewStringFromAsciiChecked("parseFloat"),
1492 parse_float_fun, DONT_ENUM); 1492 parse_float_fun, DONT_ENUM);
1493 1493
1494 // Install Number.parseInt and Global.parseInt. 1494 // Install Number.parseInt and Global.parseInt.
1495 Handle<JSFunction> parse_int_fun = SimpleInstallFunction( 1495 Handle<JSFunction> parse_int_fun = SimpleInstallFunction(
1496 number_fun, "parseInt", Builtins::kNumberParseInt, 2, true); 1496 number_fun, "parseInt", Builtins::kNumberParseInt, 2, true);
1497 JSObject::AddProperty(global_object, 1497 JSObject::AddProperty(global_object,
1498 factory->NewStringFromAsciiChecked("parseInt"), 1498 factory->NewStringFromAsciiChecked("parseInt"),
1499 parse_int_fun, DONT_ENUM); 1499 parse_int_fun, DONT_ENUM);
1500
1501 // Install Number constants
1502 double kMaxValue = 1.7976931348623157e+308;
1503 double kMinValue = 5e-324;
1504
1505 double kMaxSafeInt = 9007199254740991;
1506 double kMinSafeInt = -9007199254740991;
1507 double kEPS = 2.220446049250313e-16;
1508
1509 Handle<Object> infinity = factory->infinity_value();
1510 Handle<Object> nan = factory->nan_value();
1511 Handle<String> nan_name = factory->NewStringFromAsciiChecked("NaN");
1512
1513 JSObject::AddProperty(
1514 number_fun, factory->NewStringFromAsciiChecked("MAX_VALUE"),
1515 factory->NewNumber(kMaxValue),
1516 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1517 JSObject::AddProperty(
1518 number_fun, factory->NewStringFromAsciiChecked("MIN_VALUE"),
1519 factory->NewNumber(kMinValue),
1520 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1521 JSObject::AddProperty(
1522 number_fun, nan_name, nan,
1523 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1524 JSObject::AddProperty(
1525 number_fun, factory->NewStringFromAsciiChecked("NEGATIVE_INFINITY"),
1526 factory->NewNumber(-V8_INFINITY),
1527 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1528 JSObject::AddProperty(
1529 number_fun, factory->NewStringFromAsciiChecked("POSITIVE_INFINITY"),
1530 infinity,
1531 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1532 JSObject::AddProperty(
1533 number_fun, factory->NewStringFromAsciiChecked("MAX_SAFE_INTEGER"),
1534 factory->NewNumber(kMaxSafeInt),
1535 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1536 JSObject::AddProperty(
1537 number_fun, factory->NewStringFromAsciiChecked("MIN_SAFE_INTEGER"),
1538 factory->NewNumber(kMinSafeInt),
1539 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1540 JSObject::AddProperty(
1541 number_fun, factory->NewStringFromAsciiChecked("EPSILON"),
1542 factory->NewNumber(kEPS),
1543 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1544
1545 JSObject::AddProperty(
1546 global, factory->NewStringFromAsciiChecked("Infinity"), infinity,
1547 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1548 JSObject::AddProperty(
1549 global, nan_name, nan,
1550 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1551 JSObject::AddProperty(
1552 global, factory->NewStringFromAsciiChecked("undefined"),
1553 factory->undefined_value(),
1554 static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY));
1500 } 1555 }
1501 1556
1502 { // --- B o o l e a n --- 1557 { // --- B o o l e a n ---
1503 Handle<JSFunction> boolean_fun = 1558 Handle<JSFunction> boolean_fun =
1504 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize, 1559 InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize,
1505 isolate->initial_object_prototype(), 1560 isolate->initial_object_prototype(),
1506 Builtins::kBooleanConstructor); 1561 Builtins::kBooleanConstructor);
1507 boolean_fun->shared()->DontAdaptArguments(); 1562 boolean_fun->shared()->DontAdaptArguments();
1508 boolean_fun->shared()->SetConstructStub( 1563 boolean_fun->shared()->SetConstructStub(
1509 *isolate->builtins()->BooleanConstructor_ConstructStub()); 1564 *isolate->builtins()->BooleanConstructor_ConstructStub());
(...skipping 3494 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 } 5059 }
5005 5060
5006 5061
5007 // Called when the top-level V8 mutex is destroyed. 5062 // Called when the top-level V8 mutex is destroyed.
5008 void Bootstrapper::FreeThreadResources() { 5063 void Bootstrapper::FreeThreadResources() {
5009 DCHECK(!IsActive()); 5064 DCHECK(!IsActive());
5010 } 5065 }
5011 5066
5012 } // namespace internal 5067 } // namespace internal
5013 } // namespace v8 5068 } // namespace v8
OLDNEW
« no previous file with comments | « AUTHORS ('k') | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698