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

Side by Side Diff: src/v8natives.js

Issue 1086673002: Revert "ES6: Number and Boolean prototype should be ordinary objects" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 return %_ValueOf(this); 1506 return %_ValueOf(this);
1507 } 1507 }
1508 1508
1509 1509
1510 // ---------------------------------------------------------------------------- 1510 // ----------------------------------------------------------------------------
1511 1511
1512 function SetUpBoolean () { 1512 function SetUpBoolean () {
1513 %CheckIsBootstrapping(); 1513 %CheckIsBootstrapping();
1514 1514
1515 %SetCode($Boolean, BooleanConstructor); 1515 %SetCode($Boolean, BooleanConstructor);
1516 %FunctionSetPrototype($Boolean, new $Object()); 1516 %FunctionSetPrototype($Boolean, new $Boolean(false));
1517 %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); 1517 %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
1518 1518
1519 InstallFunctions($Boolean.prototype, DONT_ENUM, [ 1519 InstallFunctions($Boolean.prototype, DONT_ENUM, [
1520 "toString", BooleanToString, 1520 "toString", BooleanToString,
1521 "valueOf", BooleanValueOf 1521 "valueOf", BooleanValueOf
1522 ]); 1522 ]);
1523 } 1523 }
1524 1524
1525 SetUpBoolean(); 1525 SetUpBoolean();
1526 1526
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 return false; 1685 return false;
1686 } 1686 }
1687 1687
1688 1688
1689 // ---------------------------------------------------------------------------- 1689 // ----------------------------------------------------------------------------
1690 1690
1691 function SetUpNumber() { 1691 function SetUpNumber() {
1692 %CheckIsBootstrapping(); 1692 %CheckIsBootstrapping();
1693 1693
1694 %SetCode($Number, NumberConstructor); 1694 %SetCode($Number, NumberConstructor);
1695 %FunctionSetPrototype($Number, new $Object()); 1695 %FunctionSetPrototype($Number, new $Number(0));
1696 1696
1697 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); 1697 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
1698 // Set up the constructor property on the Number prototype object. 1698 // Set up the constructor property on the Number prototype object.
1699 %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM); 1699 %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
1700 1700
1701 InstallConstants($Number, [ 1701 InstallConstants($Number, [
1702 // ECMA-262 section 15.7.3.1. 1702 // ECMA-262 section 15.7.3.1.
1703 "MAX_VALUE", 1.7976931348623157e+308, 1703 "MAX_VALUE", 1.7976931348623157e+308,
1704 // ECMA-262 section 15.7.3.2. 1704 // ECMA-262 section 15.7.3.2.
1705 "MIN_VALUE", 5e-324, 1705 "MIN_VALUE", 5e-324,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 } 1914 }
1915 if (!IS_SPEC_FUNCTION(method)) { 1915 if (!IS_SPEC_FUNCTION(method)) {
1916 throw MakeTypeError('not_iterable', [obj]); 1916 throw MakeTypeError('not_iterable', [obj]);
1917 } 1917 }
1918 var iterator = %_CallFunction(obj, method); 1918 var iterator = %_CallFunction(obj, method);
1919 if (!IS_SPEC_OBJECT(iterator)) { 1919 if (!IS_SPEC_OBJECT(iterator)) {
1920 throw MakeTypeError('not_an_iterator', [iterator]); 1920 throw MakeTypeError('not_an_iterator', [iterator]);
1921 } 1921 }
1922 return iterator; 1922 return iterator;
1923 } 1923 }
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