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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2624903004: Version 5.7.433.1 (cherry-pick) (Closed)
Patch Set: Created 3 years, 11 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 | « include/v8-version.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 8348 matching lines...) Expand 10 before | Expand all | Expand 10 after
8359 case kMathLog: 8359 case kMathLog:
8360 case kMathClz32: 8360 case kMathClz32:
8361 if (expr->arguments()->length() == 1) { 8361 if (expr->arguments()->length() == 1) {
8362 HValue* argument = Pop(); 8362 HValue* argument = Pop();
8363 Drop(2); // Receiver and function. 8363 Drop(2); // Receiver and function.
8364 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); 8364 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id);
8365 ast_context()->ReturnInstruction(op, expr->id()); 8365 ast_context()->ReturnInstruction(op, expr->id());
8366 return true; 8366 return true;
8367 } 8367 }
8368 break; 8368 break;
8369 case kMathCeil:
8370 if (expr->arguments()->length() == 1) {
8371 // Math.ceil(x) = -Math.floor(-x)
8372 HValue* minus_zero = Add<HConstant>(-0.0);
8373 HValue* argument = Pop();
8374 Drop(2); // Receiver and function.
8375 argument = AddUncasted<HSub>(minus_zero, argument);
8376 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
8377 {
8378 NoObservableSideEffectsScope scope(this);
8379 argument = AddUncasted<HUnaryMathOperation>(argument, kMathFloor);
8380 argument = AddUncasted<HSub>(minus_zero, argument);
8381 }
8382 ast_context()->ReturnValue(argument);
8383 return true;
8384 }
8385 break;
8386 case kMathImul: 8369 case kMathImul:
8387 if (expr->arguments()->length() == 2) { 8370 if (expr->arguments()->length() == 2) {
8388 HValue* right = Pop(); 8371 HValue* right = Pop();
8389 HValue* left = Pop(); 8372 HValue* left = Pop();
8390 Drop(2); // Receiver and function. 8373 Drop(2); // Receiver and function.
8391 HInstruction* op = 8374 HInstruction* op =
8392 HMul::NewImul(isolate(), zone(), context(), left, right); 8375 HMul::NewImul(isolate(), zone(), context(), left, right);
8393 ast_context()->ReturnInstruction(op, expr->id()); 8376 ast_context()->ReturnInstruction(op, expr->id());
8394 return true; 8377 return true;
8395 } 8378 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
8576 case kMathLog: 8559 case kMathLog:
8577 case kMathClz32: 8560 case kMathClz32:
8578 if (argument_count == 2) { 8561 if (argument_count == 2) {
8579 HValue* argument = Pop(); 8562 HValue* argument = Pop();
8580 Drop(2); // Receiver and function. 8563 Drop(2); // Receiver and function.
8581 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); 8564 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id);
8582 ast_context()->ReturnInstruction(op, ast_id); 8565 ast_context()->ReturnInstruction(op, ast_id);
8583 return true; 8566 return true;
8584 } 8567 }
8585 break; 8568 break;
8586 case kMathCeil:
8587 if (argument_count == 2) {
8588 // Math.ceil(x) = -Math.floor(-x)
8589 HValue* minus_zero = Add<HConstant>(-0.0);
8590 HValue* argument = Pop();
8591 Drop(2); // Receiver and function.
8592 argument = AddUncasted<HSub>(minus_zero, argument);
8593 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
8594 {
8595 NoObservableSideEffectsScope scope(this);
8596 argument = AddUncasted<HUnaryMathOperation>(argument, kMathFloor);
8597 argument = AddUncasted<HSub>(minus_zero, argument);
8598 }
8599 ast_context()->ReturnValue(argument);
8600 return true;
8601 }
8602 break;
8603 case kMathPow: 8569 case kMathPow:
8604 if (argument_count == 3) { 8570 if (argument_count == 3) {
8605 HValue* right = Pop(); 8571 HValue* right = Pop();
8606 HValue* left = Pop(); 8572 HValue* left = Pop();
8607 Drop(2); // Receiver and function. 8573 Drop(2); // Receiver and function.
8608 HInstruction* result = NULL; 8574 HInstruction* result = NULL;
8609 // Use sqrt() if exponent is 0.5 or -0.5. 8575 // Use sqrt() if exponent is 0.5 or -0.5.
8610 if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) { 8576 if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) {
8611 double exponent = HConstant::cast(right)->DoubleValue(); 8577 double exponent = HConstant::cast(right)->DoubleValue();
8612 if (exponent == 0.5) { 8578 if (exponent == 0.5) {
(...skipping 4429 matching lines...) Expand 10 before | Expand all | Expand 10 after
13042 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13008 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13043 } 13009 }
13044 13010
13045 #ifdef DEBUG 13011 #ifdef DEBUG
13046 graph_->Verify(false); // No full verify. 13012 graph_->Verify(false); // No full verify.
13047 #endif 13013 #endif
13048 } 13014 }
13049 13015
13050 } // namespace internal 13016 } // namespace internal
13051 } // namespace v8 13017 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698