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

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2077533002: [builtins] Introduce proper Float64Exp operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Import tests from Raymond. Created 4 years, 6 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
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/compiler/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/simplified-operator.h" 9 #include "src/compiler/simplified-operator.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 JSCallReduction r(node); 135 JSCallReduction r(node);
136 if (r.InputsMatchOne(Type::PlainPrimitive())) { 136 if (r.InputsMatchOne(Type::PlainPrimitive())) {
137 // Math.clz32(a:plain-primitive) -> NumberClz32(ToUint32(a)) 137 // Math.clz32(a:plain-primitive) -> NumberClz32(ToUint32(a))
138 Node* input = ToUint32(r.GetJSCallInput(0)); 138 Node* input = ToUint32(r.GetJSCallInput(0));
139 Node* value = graph()->NewNode(simplified()->NumberClz32(), input); 139 Node* value = graph()->NewNode(simplified()->NumberClz32(), input);
140 return Replace(value); 140 return Replace(value);
141 } 141 }
142 return NoChange(); 142 return NoChange();
143 } 143 }
144 144
145 // ES6 section 20.2.2.14 Math.exp ( x )
146 Reduction JSBuiltinReducer::ReduceMathExp(Node* node) {
147 JSCallReduction r(node);
148 if (r.InputsMatchOne(Type::PlainPrimitive())) {
149 // Math.exp(a:plain-primitive) -> NumberExp(ToNumber(a))
150 Node* input = ToNumber(r.GetJSCallInput(0));
151 Node* value = graph()->NewNode(simplified()->NumberExp(), input);
152 return Replace(value);
153 }
154 return NoChange();
155 }
156
145 // ES6 section 20.2.2.16 Math.floor ( x ) 157 // ES6 section 20.2.2.16 Math.floor ( x )
146 Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) { 158 Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
147 JSCallReduction r(node); 159 JSCallReduction r(node);
148 if (r.InputsMatchOne(Type::PlainPrimitive())) { 160 if (r.InputsMatchOne(Type::PlainPrimitive())) {
149 // Math.floor(a:plain-primitive) -> NumberFloor(ToNumber(a)) 161 // Math.floor(a:plain-primitive) -> NumberFloor(ToNumber(a))
150 Node* input = ToNumber(r.GetJSCallInput(0)); 162 Node* input = ToNumber(r.GetJSCallInput(0));
151 Node* value = graph()->NewNode(simplified()->NumberFloor(), input); 163 Node* value = graph()->NewNode(simplified()->NumberFloor(), input);
152 return Replace(value); 164 return Replace(value);
153 } 165 }
154 return NoChange(); 166 return NoChange();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 break; 353 break;
342 case kMathAtan2: 354 case kMathAtan2:
343 reduction = ReduceMathAtan2(node); 355 reduction = ReduceMathAtan2(node);
344 break; 356 break;
345 case kMathClz32: 357 case kMathClz32:
346 reduction = ReduceMathClz32(node); 358 reduction = ReduceMathClz32(node);
347 break; 359 break;
348 case kMathCeil: 360 case kMathCeil:
349 reduction = ReduceMathCeil(node); 361 reduction = ReduceMathCeil(node);
350 break; 362 break;
363 case kMathExp:
364 reduction = ReduceMathExp(node);
365 break;
351 case kMathFloor: 366 case kMathFloor:
352 reduction = ReduceMathFloor(node); 367 reduction = ReduceMathFloor(node);
353 break; 368 break;
354 case kMathFround: 369 case kMathFround:
355 reduction = ReduceMathFround(node); 370 reduction = ReduceMathFround(node);
356 break; 371 break;
357 case kMathImul: 372 case kMathImul:
358 reduction = ReduceMathImul(node); 373 reduction = ReduceMathImul(node);
359 break; 374 break;
360 case kMathLog: 375 case kMathLog:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 437 }
423 438
424 439
425 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { 440 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const {
426 return jsgraph()->simplified(); 441 return jsgraph()->simplified();
427 } 442 }
428 443
429 } // namespace compiler 444 } // namespace compiler
430 } // namespace internal 445 } // namespace internal
431 } // namespace v8 446 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698