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

Side by Side Diff: src/hydrogen.cc

Issue 1115973005: Revert of Collect type feedback on result of Math.[round|ceil|floor] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/hydrogen.h ('k') | src/ia32/code-stubs-ia32.cc » ('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 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 8312 matching lines...) Expand 10 before | Expand all | Expand 10 after
8323 8323
8324 8324
8325 bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) { 8325 bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) {
8326 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; 8326 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false;
8327 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); 8327 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id();
8328 switch (id) { 8328 switch (id) {
8329 case kMathExp: 8329 case kMathExp:
8330 if (!FLAG_fast_math) break; 8330 if (!FLAG_fast_math) break;
8331 // Fall through if FLAG_fast_math. 8331 // Fall through if FLAG_fast_math.
8332 case kMathRound: 8332 case kMathRound:
8333 case kMathFround:
8333 case kMathFloor: 8334 case kMathFloor:
8334 // If round has seen minus zero, don't inline, since that assumes
8335 // returned value is an integer, which -0 definitely is not.
8336 if (expr->ShouldHandleMinusZeroResult()) {
8337 break;
8338 }
8339 case kMathFround:
8340 case kMathAbs: 8335 case kMathAbs:
8341 case kMathSqrt: 8336 case kMathSqrt:
8342 case kMathLog: 8337 case kMathLog:
8343 case kMathClz32: 8338 case kMathClz32:
8344 if (expr->arguments()->length() == 1) { 8339 if (expr->arguments()->length() == 1) {
8345 HValue* argument = Pop(); 8340 HValue* argument = Pop();
8346 Drop(2); // Receiver and function. 8341 Drop(2); // Receiver and function.
8347 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); 8342 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id);
8348 ast_context()->ReturnInstruction(op, expr->id()); 8343 ast_context()->ReturnInstruction(op, expr->id());
8349 return true; 8344 return true;
8350 } 8345 }
8351 break; 8346 break;
8352 case kMathCeil:
8353 // If round/floor has seen minus zero, don't inline, since that assumes
8354 // returned value is an integer, which -0 definitely is not.
8355 if (expr->ShouldHandleMinusZeroResult()) {
8356 break;
8357 }
8358 if (expr->arguments()->length() == 1) {
8359 HValue* argument = Pop();
8360 Drop(2); // Receiver and function.
8361 HValue* op = NULL;
8362 {
8363 NoObservableSideEffectsScope s(this);
8364 HValue* neg_arg =
8365 AddUncasted<HMul>(graph()->GetConstantMinus1(), argument);
8366 op = AddUncasted<HUnaryMathOperation>(neg_arg, kMathFloor);
8367 }
8368 HInstruction* neg_op =
8369 NewUncasted<HMul>(graph()->GetConstantMinus1(), op);
8370 ast_context()->ReturnInstruction(neg_op, expr->id());
8371 return true;
8372 }
8373 break;
8374 case kMathImul: 8347 case kMathImul:
8375 if (expr->arguments()->length() == 2) { 8348 if (expr->arguments()->length() == 2) {
8376 HValue* right = Pop(); 8349 HValue* right = Pop();
8377 HValue* left = Pop(); 8350 HValue* left = Pop();
8378 Drop(2); // Receiver and function. 8351 Drop(2); // Receiver and function.
8379 HInstruction* op = 8352 HInstruction* op =
8380 HMul::NewImul(isolate(), zone(), context(), left, right); 8353 HMul::NewImul(isolate(), zone(), context(), left, right);
8381 ast_context()->ReturnInstruction(op, expr->id()); 8354 ast_context()->ReturnInstruction(op, expr->id());
8382 return true; 8355 return true;
8383 } 8356 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
8457 Drop(2); // Receiver and function. 8430 Drop(2); // Receiver and function.
8458 HInstruction* result = NewUncasted<HStringCharFromCode>(argument); 8431 HInstruction* result = NewUncasted<HStringCharFromCode>(argument);
8459 ast_context()->ReturnInstruction(result, expr->id()); 8432 ast_context()->ReturnInstruction(result, expr->id());
8460 return true; 8433 return true;
8461 } 8434 }
8462 break; 8435 break;
8463 case kMathExp: 8436 case kMathExp:
8464 if (!FLAG_fast_math) break; 8437 if (!FLAG_fast_math) break;
8465 // Fall through if FLAG_fast_math. 8438 // Fall through if FLAG_fast_math.
8466 case kMathRound: 8439 case kMathRound:
8440 case kMathFround:
8467 case kMathFloor: 8441 case kMathFloor:
8468 // If round/floor has seen minus zero, don't inline, since that assumes
8469 // returned value is an integer, which -0 definitely is not.
8470 if (expr->ShouldHandleMinusZeroResult()) {
8471 break;
8472 }
8473 case kMathFround:
8474 case kMathAbs: 8442 case kMathAbs:
8475 case kMathSqrt: 8443 case kMathSqrt:
8476 case kMathLog: 8444 case kMathLog:
8477 case kMathClz32: 8445 case kMathClz32:
8478 if (argument_count == 2) { 8446 if (argument_count == 2) {
8479 HValue* argument = Pop(); 8447 HValue* argument = Pop();
8480 Drop(2); // Receiver and function. 8448 Drop(2); // Receiver and function.
8481 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); 8449 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id);
8482 ast_context()->ReturnInstruction(op, expr->id()); 8450 ast_context()->ReturnInstruction(op, expr->id());
8483 return true; 8451 return true;
8484 } 8452 }
8485 break; 8453 break;
8486 case kMathCeil:
8487 // If round/floor has seen minus zero, don't inline, since that assumes
8488 // returned value is an integer, which -0 definitely is not.
8489 if (expr->ShouldHandleMinusZeroResult()) {
8490 break;
8491 }
8492 if (argument_count == 2) {
8493 HValue* argument = Pop();
8494 Drop(2); // Receiver and function.
8495 HValue* op = NULL;
8496 {
8497 NoObservableSideEffectsScope s(this);
8498 HValue* neg_arg =
8499 AddUncasted<HMul>(graph()->GetConstantMinus1(), argument);
8500 op = AddUncasted<HUnaryMathOperation>(neg_arg, kMathFloor);
8501 }
8502 HInstruction* neg_op =
8503 NewUncasted<HMul>(graph()->GetConstantMinus1(), op);
8504 ast_context()->ReturnInstruction(neg_op, expr->id());
8505 return true;
8506 }
8507 break;
8508 case kMathPow: 8454 case kMathPow:
8509 if (argument_count == 3) { 8455 if (argument_count == 3) {
8510 HValue* right = Pop(); 8456 HValue* right = Pop();
8511 HValue* left = Pop(); 8457 HValue* left = Pop();
8512 Drop(2); // Receiver and function. 8458 Drop(2); // Receiver and function.
8513 HInstruction* result = NULL; 8459 HInstruction* result = NULL;
8514 // Use sqrt() if exponent is 0.5 or -0.5. 8460 // Use sqrt() if exponent is 0.5 or -0.5.
8515 if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) { 8461 if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) {
8516 double exponent = HConstant::cast(right)->DoubleValue(); 8462 double exponent = HConstant::cast(right)->DoubleValue();
8517 if (exponent == 0.5) { 8463 if (exponent == 0.5) {
(...skipping 3715 matching lines...) Expand 10 before | Expand all | Expand 10 after
12233 12179
12234 void HOptimizedGraphBuilder::GenerateMathClz32(CallRuntime* call) { 12180 void HOptimizedGraphBuilder::GenerateMathClz32(CallRuntime* call) {
12235 DCHECK(call->arguments()->length() == 1); 12181 DCHECK(call->arguments()->length() == 1);
12236 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12182 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12237 HValue* value = Pop(); 12183 HValue* value = Pop();
12238 HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathClz32); 12184 HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathClz32);
12239 return ast_context()->ReturnInstruction(result, call->id()); 12185 return ast_context()->ReturnInstruction(result, call->id());
12240 } 12186 }
12241 12187
12242 12188
12189 void HOptimizedGraphBuilder::GenerateMathFloor(CallRuntime* call) {
12190 DCHECK(call->arguments()->length() == 1);
12191 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12192 HValue* value = Pop();
12193 HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathFloor);
12194 return ast_context()->ReturnInstruction(result, call->id());
12195 }
12196
12197
12243 void HOptimizedGraphBuilder::GenerateMathLogRT(CallRuntime* call) { 12198 void HOptimizedGraphBuilder::GenerateMathLogRT(CallRuntime* call) {
12244 DCHECK(call->arguments()->length() == 1); 12199 DCHECK(call->arguments()->length() == 1);
12245 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12200 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12246 HValue* value = Pop(); 12201 HValue* value = Pop();
12247 HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathLog); 12202 HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathLog);
12248 return ast_context()->ReturnInstruction(result, call->id()); 12203 return ast_context()->ReturnInstruction(result, call->id());
12249 } 12204 }
12250 12205
12251 12206
12252 void HOptimizedGraphBuilder::GenerateMathSqrt(CallRuntime* call) { 12207 void HOptimizedGraphBuilder::GenerateMathSqrt(CallRuntime* call) {
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
13151 if (ShouldProduceTraceOutput()) { 13106 if (ShouldProduceTraceOutput()) {
13152 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13107 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13153 } 13108 }
13154 13109
13155 #ifdef DEBUG 13110 #ifdef DEBUG
13156 graph_->Verify(false); // No full verify. 13111 graph_->Verify(false); // No full verify.
13157 #endif 13112 #endif
13158 } 13113 }
13159 13114
13160 } } // namespace v8::internal 13115 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698