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

Side by Side Diff: src/js/v8natives.js

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 | « src/bootstrapper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
11 11
12 var GlobalNumber = global.Number;
13 var GlobalObject = global.Object; 12 var GlobalObject = global.Object;
14 var iteratorSymbol = utils.ImportNow("iterator_symbol"); 13 var iteratorSymbol = utils.ImportNow("iterator_symbol");
15 var NaN = %GetRootNaN(); 14 var NaN = %GetRootNaN();
16 var ObjectToString = utils.ImportNow("object_to_string"); 15 var ObjectToString = utils.ImportNow("object_to_string");
17 16
18 // ---------------------------------------------------------------------------- 17 // ----------------------------------------------------------------------------
19 18
20 19
21 // Set up global object. 20 // Set up global object.
22 var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY; 21 var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY;
23 22
24 utils.InstallConstants(global, [
25 // ES6 18.1.1
26 "Infinity", INFINITY,
27 // ES6 18.1.2
28 "NaN", NaN,
29 // ES6 18.1.3
30 "undefined", UNDEFINED,
31 ]);
32
33 23
34 // ---------------------------------------------------------------------------- 24 // ----------------------------------------------------------------------------
35 // Object 25 // Object
36 26
37 // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]]) 27 // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]])
38 function ObjectToLocaleString() { 28 function ObjectToLocaleString() {
39 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString"); 29 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString");
40 return this.toString(); 30 return this.toString();
41 } 31 }
42 32
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 "isPrototypeOf", ObjectIsPrototypeOf, 80 "isPrototypeOf", ObjectIsPrototypeOf,
91 // propertyIsEnumerable is added in bootstrapper.cc. 81 // propertyIsEnumerable is added in bootstrapper.cc.
92 // __defineGetter__ is added in bootstrapper.cc. 82 // __defineGetter__ is added in bootstrapper.cc.
93 // __lookupGetter__ is added in bootstrapper.cc. 83 // __lookupGetter__ is added in bootstrapper.cc.
94 // __defineSetter__ is added in bootstrapper.cc. 84 // __defineSetter__ is added in bootstrapper.cc.
95 // __lookupSetter__ is added in bootstrapper.cc. 85 // __lookupSetter__ is added in bootstrapper.cc.
96 ]); 86 ]);
97 87
98 88
99 // ---------------------------------------------------------------------------- 89 // ----------------------------------------------------------------------------
100 // Number
101
102 utils.InstallConstants(GlobalNumber, [
103 // ECMA-262 section 15.7.3.1.
104 "MAX_VALUE", 1.7976931348623157e+308,
105 // ECMA-262 section 15.7.3.2.
106 "MIN_VALUE", 5e-324,
107 // ECMA-262 section 15.7.3.3.
108 "NaN", NaN,
109 // ECMA-262 section 15.7.3.4.
110 "NEGATIVE_INFINITY", -INFINITY,
111 // ECMA-262 section 15.7.3.5.
112 "POSITIVE_INFINITY", INFINITY,
113
114 // --- Harmony constants (no spec refs until settled.)
115
116 "MAX_SAFE_INTEGER", 9007199254740991,
117 "MIN_SAFE_INTEGER", -9007199254740991,
118 "EPSILON", 2.220446049250313e-16,
119 ]);
120
121
122 // ----------------------------------------------------------------------------
123 // Iterator related spec functions. 90 // Iterator related spec functions.
124 91
125 // ES6 7.4.1 GetIterator(obj, method) 92 // ES6 7.4.1 GetIterator(obj, method)
126 function GetIterator(obj, method) { 93 function GetIterator(obj, method) {
127 if (IS_UNDEFINED(method)) { 94 if (IS_UNDEFINED(method)) {
128 method = obj[iteratorSymbol]; 95 method = obj[iteratorSymbol];
129 } 96 }
130 if (!IS_CALLABLE(method)) { 97 if (!IS_CALLABLE(method)) {
131 throw %make_type_error(kNotIterable, obj); 98 throw %make_type_error(kNotIterable, obj);
132 } 99 }
(...skipping 11 matching lines...) Expand all
144 to.GetIterator = GetIterator; 111 to.GetIterator = GetIterator;
145 to.GetMethod = GetMethod; 112 to.GetMethod = GetMethod;
146 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; 113 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty;
147 }); 114 });
148 115
149 %InstallToContext([ 116 %InstallToContext([
150 "object_value_of", ObjectValueOf, 117 "object_value_of", ObjectValueOf,
151 ]); 118 ]);
152 119
153 }) 120 })
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698