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

Side by Side Diff: src/v8natives.js

Issue 1051373002: ES6: Number and Boolean prototype should be ordinary objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add mozilla.status exceptions Created 5 years, 8 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 | « no previous file | test/mjsunit/es6/prototype-ordinary-objects.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 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 // This file relies on the fact that the following declarations have been made 5 // This file relies on the fact that the following declarations have been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $Object = global.Object; 7 // var $Object = global.Object;
8 // var $Boolean = global.Boolean; 8 // var $Boolean = global.Boolean;
9 // var $Number = global.Number; 9 // var $Number = global.Number;
10 // var $Function = global.Function; 10 // var $Function = global.Function;
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 return %_ValueOf(this); 1485 return %_ValueOf(this);
1486 } 1486 }
1487 1487
1488 1488
1489 // ---------------------------------------------------------------------------- 1489 // ----------------------------------------------------------------------------
1490 1490
1491 function SetUpBoolean () { 1491 function SetUpBoolean () {
1492 %CheckIsBootstrapping(); 1492 %CheckIsBootstrapping();
1493 1493
1494 %SetCode($Boolean, BooleanConstructor); 1494 %SetCode($Boolean, BooleanConstructor);
1495 %FunctionSetPrototype($Boolean, new $Boolean(false)); 1495 %FunctionSetPrototype($Boolean, new $Object());
1496 %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); 1496 %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
1497 1497
1498 InstallFunctions($Boolean.prototype, DONT_ENUM, $Array( 1498 InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
1499 "toString", BooleanToString, 1499 "toString", BooleanToString,
1500 "valueOf", BooleanValueOf 1500 "valueOf", BooleanValueOf
1501 )); 1501 ));
1502 } 1502 }
1503 1503
1504 SetUpBoolean(); 1504 SetUpBoolean();
1505 1505
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 return false; 1664 return false;
1665 } 1665 }
1666 1666
1667 1667
1668 // ---------------------------------------------------------------------------- 1668 // ----------------------------------------------------------------------------
1669 1669
1670 function SetUpNumber() { 1670 function SetUpNumber() {
1671 %CheckIsBootstrapping(); 1671 %CheckIsBootstrapping();
1672 1672
1673 %SetCode($Number, NumberConstructor); 1673 %SetCode($Number, NumberConstructor);
1674 %FunctionSetPrototype($Number, new $Number(0)); 1674 %FunctionSetPrototype($Number, new $Object());
1675 1675
1676 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); 1676 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
1677 // Set up the constructor property on the Number prototype object. 1677 // Set up the constructor property on the Number prototype object.
1678 %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM); 1678 %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
1679 1679
1680 InstallConstants($Number, $Array( 1680 InstallConstants($Number, $Array(
1681 // ECMA-262 section 15.7.3.1. 1681 // ECMA-262 section 15.7.3.1.
1682 "MAX_VALUE", 1.7976931348623157e+308, 1682 "MAX_VALUE", 1.7976931348623157e+308,
1683 // ECMA-262 section 15.7.3.2. 1683 // ECMA-262 section 15.7.3.2.
1684 "MIN_VALUE", 5e-324, 1684 "MIN_VALUE", 5e-324,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 } 1893 }
1894 if (!IS_SPEC_FUNCTION(method)) { 1894 if (!IS_SPEC_FUNCTION(method)) {
1895 throw MakeTypeError('not_iterable', [obj]); 1895 throw MakeTypeError('not_iterable', [obj]);
1896 } 1896 }
1897 var iterator = %_CallFunction(obj, method); 1897 var iterator = %_CallFunction(obj, method);
1898 if (!IS_SPEC_OBJECT(iterator)) { 1898 if (!IS_SPEC_OBJECT(iterator)) {
1899 throw MakeTypeError('not_an_iterator', [iterator]); 1899 throw MakeTypeError('not_an_iterator', [iterator]);
1900 } 1900 }
1901 return iterator; 1901 return iterator;
1902 } 1902 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/prototype-ordinary-objects.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698