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

Side by Side Diff: test/cctest/compiler/test-run-jsops.cc

Issue 953563002: Implement experimental exponentiation operator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use Number() instead of OrderedNumber() to include NaN Created 5 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/typing.cc ('k') | test/mjsunit/harmony/exponentiation.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 T.CheckCall(3, 8, 5); 74 T.CheckCall(3, 8, 5);
75 T.CheckCall(T.Val(3), T.Val("8"), T.Val(5)); 75 T.CheckCall(T.Val(3), T.Val("8"), T.Val(5));
76 T.CheckCall(T.Val(3), T.Val(8), T.Val("5")); 76 T.CheckCall(T.Val(3), T.Val(8), T.Val("5"));
77 T.CheckCall(T.Val(1), T.Val("3"), T.Val("2")); 77 T.CheckCall(T.Val(1), T.Val("3"), T.Val("2"));
78 T.CheckCall(T.nan(), T.Val("3"), T.Val("B")); 78 T.CheckCall(T.nan(), T.Val("3"), T.Val("B"));
79 T.CheckCall(T.Val(1), T.Val("3"), T.NewObject("([2])")); 79 T.CheckCall(T.Val(1), T.Val("3"), T.NewObject("([2])"));
80 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})")); 80 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})"));
81 } 81 }
82 82
83 83
84 TEST(BinopExponentiate) {
85 FLAG_harmony_exponentiation = true;
86 FunctionTester T("(function(a,b) { return a ** b; })");
87
88 T.CheckCall(256, 2, 8);
89 T.CheckCall(T.Val(256), T.Val("2"), T.Val(8));
90 T.CheckCall(T.Val(256), T.Val(2), T.Val("8"));
91 T.CheckCall(T.Val(1), T.Val("256"), T.Val("0"));
92 T.CheckCall(T.nan(), T.Val("3"), T.Val("B"));
93 T.CheckCall(T.Val(0.25), T.Val("2"), T.NewObject("([-2])"));
94 T.CheckCall(T.nan(), T.Val("3"), T.NewObject("({})"));
95 }
96
97
84 TEST(BinopShiftLeft) { 98 TEST(BinopShiftLeft) {
85 FunctionTester T("(function(a,b) { return a << b; })"); 99 FunctionTester T("(function(a,b) { return a << b; })");
86 100
87 T.CheckCall(4, 2, 1); 101 T.CheckCall(4, 2, 1);
88 T.CheckCall(T.Val(4), T.Val("2"), T.Val(1)); 102 T.CheckCall(T.Val(4), T.Val("2"), T.Val(1));
89 T.CheckCall(T.Val(4), T.Val(2), T.Val("1")); 103 T.CheckCall(T.Val(4), T.Val(2), T.Val("1"));
90 } 104 }
91 105
92 106
93 TEST(BinopShiftRight) { 107 TEST(BinopShiftRight) {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 " get z() { return 0; }" 550 " get z() { return 0; }"
537 " constructor() {}" 551 " constructor() {}"
538 " }" 552 " }"
539 " return new C().x() + C.y();" 553 " return new C().x() + C.y();"
540 "})"; 554 "})";
541 FunctionTester T(src); 555 FunctionTester T(src);
542 556
543 T.CheckCall(T.Val(65), T.Val(23), T.Val(42)); 557 T.CheckCall(T.Val(65), T.Val(23), T.Val(42));
544 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); 558 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b"));
545 } 559 }
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | test/mjsunit/harmony/exponentiation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698