ES6: Number and Boolean prototype should be ordinary objects
authorarv <arv@chromium.org>
Wed, 8 Apr 2015 21:18:31 +0000 (14:18 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 8 Apr 2015 21:18:40 +0000 (21:18 +0000)
BUG=v8:4001
LOG=N
R=adamk@chromium.org, rossberg@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1051373002

Cr-Commit-Position: refs/heads/master@{#27680}

src/v8natives.js
test/mjsunit/es6/prototype-ordinary-objects.js [new file with mode: 0644]
test/mozilla/mozilla.status
test/test262-es6/test262-es6.status
test/test262/test262.status

index df6305e74de1ef9f930f5c32f65a899dfbdb2baa..56e8c2d69d035f49da62b2b2b7d25e7355a60979 100644 (file)
@@ -1492,7 +1492,7 @@ function SetUpBoolean () {
   %CheckIsBootstrapping();
 
   %SetCode($Boolean, BooleanConstructor);
-  %FunctionSetPrototype($Boolean, new $Boolean(false));
+  %FunctionSetPrototype($Boolean, new $Object());
   %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
 
   InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
@@ -1671,7 +1671,7 @@ function SetUpNumber() {
   %CheckIsBootstrapping();
 
   %SetCode($Number, NumberConstructor);
-  %FunctionSetPrototype($Number, new $Number(0));
+  %FunctionSetPrototype($Number, new $Object());
 
   %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
   // Set up the constructor property on the Number prototype object.
diff --git a/test/mjsunit/es6/prototype-ordinary-objects.js b/test/mjsunit/es6/prototype-ordinary-objects.js
new file mode 100644 (file)
index 0000000..6704288
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+var funcs = [
+
+  // https://code.google.com/p/v8/issues/detail?id=4002
+  // Error,
+  // EvalError,
+  // RangeError,
+  // ReferenceError,
+  // SyntaxError,
+  // TypeError,
+  // URIError,
+
+  // https://code.google.com/p/v8/issues/detail?id=4003
+  // RegExp,
+
+  // https://code.google.com/p/v8/issues/detail?id=4004
+  // Date,
+
+  // https://code.google.com/p/v8/issues/detail?id=4006
+  // String,
+
+  ArrayBuffer,
+  Boolean,
+  DataView,
+  Float32Array,
+  Float64Array,
+  Int16Array,
+  Int32Array,
+  Int8Array,
+  Map,
+  Number,
+  Object,
+  Promise,
+  // Proxy,
+  Set,
+  Symbol,
+  Uint16Array,
+  Uint32Array,
+  Uint8Array,
+  Uint8ClampedArray,
+  WeakMap,
+  WeakSet,
+];
+
+for (var fun of funcs) {
+  var p = fun.prototype;
+  assertEquals('[object Object]', Object.prototype.toString.call(p));
+}
+
+
+// These still have special prototypes for legacy reason.
+var funcs = [
+  Array,
+  Function,
+];
+
+for (var fun of funcs) {
+  var p = fun.prototype;
+  assertEquals('[object ' + fun.name + ']', Object.prototype.toString.call(p));
+}
index 109efb78e2b38564e3d314dd1989ea3d06bf6db2..13ac127915918c63d923d4a5e03d6877e0a06918 100644 (file)
   'ecma/String/15.5.4.8-1': [FAIL],
   'ecma/String/15.5.4.9-1': [FAIL],
 
+  # Boolean.prototype and Number.prototype are ordinary objects in ES6
+  'ecma/Boolean/15.6.3.1': [FAIL],
+  'ecma/Boolean/15.6.4': [FAIL],
+  'ecma/Boolean/15.6.4-1': [FAIL],
+  'ecma/Number/15.7.4-1': [FAIL],
+  'ecma/Number/15.7.4.2-1': [FAIL],
+  'ecma/Number/15.7.4.3-1': [FAIL],
+  'ecma/extensions/15.7.4': [FAIL],
+  'ecma_2/FunctionObjects/call-1': [FAIL],
 
   ##################### SKIPPED TESTS #####################
 
index 61827ca2d29bb98f8569419ccb36c77ad6d270d5..75d4cbf0b4ec61a7774944b9c89737992570272e 100644 (file)
   'language/computed-property-names/to-name-side-effects/class': [FAIL],
   'language/computed-property-names/to-name-side-effects/numbers-class': [FAIL],
 
-  # Number.prototype is a plain object in ES6
-  'built-ins/Number/15.7.4-1': [FAIL],
-  'built-ins/Number/prototype/S15.7.3.1_A2_T1': [FAIL],
-  'built-ins/Number/prototype/S15.7.3.1_A2_T2': [FAIL],
-  'built-ins/Number/prototype/S15.7.3.1_A3': [FAIL],
-  'built-ins/Number/prototype/S15.7.4_A1': [FAIL],
-  'built-ins/Number/prototype/toFixed/S15.7.4.5_A1.1_T01': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A1_T01': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A1_T02': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A1_T03': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T01': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T02': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T03': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T04': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T05': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T06': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T07': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T08': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T09': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T10': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T11': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T12': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T13': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T14': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T15': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T16': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T17': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T18': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T19': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T20': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T21': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T22': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T23': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T24': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T25': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T26': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T27': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T28': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T29': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T30': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T31': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T32': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T33': [FAIL],
-  'built-ins/Number/prototype/toString/S15.7.4.2_A2_T34': [FAIL],
-  'built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T01': [FAIL],
-  'built-ins/Number/prototype/valueOf/S15.7.4.4_A1_T02': [FAIL],
-
   ######################## OBSOLETED BY ES6 ###########################
 
   # ES6 allows duplicate properties
   'built-ins/Array/prototype/splice/S15.4.4.12_A3_T1': [FAIL],
   'built-ins/Array/prototype/splice/S15.4.4.12_A3_T3': [FAIL],
   'built-ins/Array/prototype/unshift/S15.4.4.13_A3_T2': [FAIL],
-  'built-ins/Boolean/prototype/S15.6.3.1_A1': [FAIL],
-  'built-ins/Boolean/prototype/S15.6.4_A1': [FAIL],
-  'built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T1': [FAIL],
-  'built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2': [FAIL],
-  'built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T1': [FAIL],
-  'built-ins/Boolean/prototype/valueOf/S15.6.4.3_A1_T2': [FAIL],
   'built-ins/Date/15.9.1.15-1': [FAIL],
   'built-ins/Date/prototype/setFullYear/15.9.5.40_1': [FAIL],
   'built-ins/Error/prototype/S15.11.4_A2': [FAIL],
index ed308d57551cc91edb8023dfbedd5bf60d83e3f0..4f03e2be9995f3c95ff423a0a6846c6e10bcac30 100644 (file)
   '15.2.3.3-1-3': [FAIL],
   '15.2.3.3-1-4': [FAIL],
 
+  # Boolean.prototype is a plain object in ES6.
+  'S15.6.3.1_A1': [FAIL],
+  'S15.6.4.2_A1_T1': [FAIL],
+  'S15.6.4.2_A1_T2': [FAIL],
+  'S15.6.4.3_A1_T1': [FAIL],
+  'S15.6.4.3_A1_T2': [FAIL],
+  'S15.6.4_A1': [FAIL],
+
+  # Number.prototype is a plain object in ES6.
+  '15.7.4-1': [FAIL],
+  'S15.7.3.1_A2_T1': [FAIL],
+  'S15.7.3.1_A2_T2': [FAIL],
+  'S15.7.3.1_A3': [FAIL],
+  'S15.7.4.2_A1_T01': [FAIL],
+  'S15.7.4.2_A1_T02': [FAIL],
+  'S15.7.4.2_A1_T03': [FAIL],
+  'S15.7.4.2_A2_T01': [FAIL],
+  'S15.7.4.2_A2_T02': [FAIL],
+  'S15.7.4.2_A2_T03': [FAIL],
+  'S15.7.4.2_A2_T04': [FAIL],
+  'S15.7.4.2_A2_T05': [FAIL],
+  'S15.7.4.2_A2_T06': [FAIL],
+  'S15.7.4.2_A2_T07': [FAIL],
+  'S15.7.4.2_A2_T08': [FAIL],
+  'S15.7.4.2_A2_T09': [FAIL],
+  'S15.7.4.2_A2_T10': [FAIL],
+  'S15.7.4.2_A2_T11': [FAIL],
+  'S15.7.4.2_A2_T12': [FAIL],
+  'S15.7.4.2_A2_T13': [FAIL],
+  'S15.7.4.2_A2_T14': [FAIL],
+  'S15.7.4.2_A2_T15': [FAIL],
+  'S15.7.4.2_A2_T16': [FAIL],
+  'S15.7.4.2_A2_T17': [FAIL],
+  'S15.7.4.2_A2_T18': [FAIL],
+  'S15.7.4.2_A2_T19': [FAIL],
+  'S15.7.4.2_A2_T20': [FAIL],
+  'S15.7.4.2_A2_T21': [FAIL],
+  'S15.7.4.2_A2_T22': [FAIL],
+  'S15.7.4.2_A2_T23': [FAIL],
+  'S15.7.4.2_A2_T24': [FAIL],
+  'S15.7.4.2_A2_T25': [FAIL],
+  'S15.7.4.2_A2_T26': [FAIL],
+  'S15.7.4.2_A2_T27': [FAIL],
+  'S15.7.4.2_A2_T28': [FAIL],
+  'S15.7.4.2_A2_T29': [FAIL],
+  'S15.7.4.2_A2_T30': [FAIL],
+  'S15.7.4.2_A2_T31': [FAIL],
+  'S15.7.4.2_A2_T32': [FAIL],
+  'S15.7.4.2_A2_T33': [FAIL],
+  'S15.7.4.2_A2_T34': [FAIL],
+  'S15.7.4.4_A1_T01': [FAIL],
+  'S15.7.4.4_A1_T02': [FAIL],
+  'S15.7.4.5_A1.1_T01': [FAIL],
+  'S15.7.4_A1': [FAIL],
+
   ######################## NEEDS INVESTIGATION ###########################
 
   # These test failures are specific to the intl402 suite and need investigation