Bug 1291212 - Ship the exponentiation operator. r=till
authorTom Schuster <evilpies@gmail.com>
Thu, 27 Oct 2016 16:31:16 +0200
changeset 319833 1b8a23c25b1f43d626c978d9e3eb2ca6e3dafb66
parent 319832 f2027674d0b299a4dba5d27911d22fdb333ab5f6
child 319834 56eec29053f22ce7f79f243fd5d4dfce831fe709
push id20748
push userphilringnalda@gmail.com
push dateFri, 28 Oct 2016 03:39:55 +0000
treeherderfx-team@715360440695 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1291212
milestone52.0a1
Bug 1291212 - Ship the exponentiation operator. r=till
js/src/frontend/TokenStream.cpp
js/src/jsversion.h
js/src/tests/ecma_7/Math/Pow.js
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -1473,21 +1473,19 @@ TokenStream::getTokenInternal(TokenKind*
             else
                 tp->type = matchChar('=') ? TOK_RSHASSIGN : TOK_RSH;
         } else {
             tp->type = matchChar('=') ? TOK_GE : TOK_GT;
         }
         goto out;
 
       case '*':
-#ifdef JS_HAS_EXPONENTIATION
         if (matchChar('*'))
             tp->type = matchChar('=') ? TOK_POWASSIGN : TOK_POW;
         else
-#endif
             tp->type = matchChar('=') ? TOK_MULASSIGN : TOK_MUL;
         goto out;
 
       case '/':
         // Look for a single-line comment.
         if (matchChar('/')) {
             c = peekChar();
             if (c == '@' || c == '#') {
--- a/js/src/jsversion.h
+++ b/js/src/jsversion.h
@@ -32,16 +32,9 @@
 #define JS_HAS_DESTRUCTURING_SHORTHAND  (JS_HAS_DESTRUCTURING == 2)
 
 /*
  * Feature for Object.prototype.__{define,lookup}{G,S}etter__ legacy support;
  * support likely to be made opt-in at some future time.
  */
 #define JS_OLD_GETTER_SETTER_METHODS    1
 
-#ifdef NIGHTLY_BUILD
-
-/* Support for ES7 Exponentiation proposal. */
-#define JS_HAS_EXPONENTIATION 1
-
-#endif // NIGHTLY_BUILD
-
 #endif /* jsversion_h */
--- a/js/src/tests/ecma_7/Math/Pow.js
+++ b/js/src/tests/ecma_7/Math/Pow.js
@@ -4,18 +4,16 @@
  * http://creativecommons.org/licenses/publicdomain/
  */
 
 var BUGNUMBER = 1135708;
 var summary = "Implement the exponentiation operator";
 
 print(BUGNUMBER + ": " + summary);
 
-var test = `
-
 // Constant folding
 assertEq(2 ** 2 ** 3, 256);
 assertEq(1 ** 1 ** 4, 1);
 
 // No folding
 var two = 2;
 var three = 3;
 var four = 4;
@@ -110,31 +108,10 @@ assertEq(parseTree.body[0].expression.ri
 // Reflect.parse generates a tree following the right-associativity rule
 var parseTree = Reflect.parse("a ** b ** c");
 assertEq(parseTree.body[0].type, "ExpressionStatement");
 assertEq(parseTree.body[0].expression.left.name, "a");
 assertEq(parseTree.body[0].expression.right.operator, "**");
 assertEq(parseTree.body[0].expression.right.left.name, "b");
 assertEq(parseTree.body[0].expression.right.right.name, "c");
 
-
-function assertTrue(v) {
-    assertEq(v, true);
-}
-
-function assertFalse(v) {
-    assertEq(v, false);
-}
-`;
-
-function exponentiationEnabled() {
-    try {
-        Function("1 ** 1");
-        return true;
-    } catch (e if e instanceof SyntaxError) { }
-    return false;
-}
-
-if (exponentiationEnabled())
-    eval(test);
-
 if (typeof reportCompare === "function")
     reportCompare(true, true);