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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1757013002: [crankshaft] Fix invalid ToNumber optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | test/mjsunit/regress/regress-crbug-590989-1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 0fa8daa6419335a7410bac8ba59641bc4fbcd573..a238c127a6848abb5f52258a40cd4443a0bc5078 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -2050,9 +2050,8 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) {
return Pop();
}
-
-HValue* HGraphBuilder::BuildToNumber(HValue* input, Type* input_type) {
- if (input->type().IsTaggedNumber() || input_type->Is(Type::Number())) {
+HValue* HGraphBuilder::BuildToNumber(HValue* input) {
+ if (input->type().IsTaggedNumber()) {
return input;
}
Callable callable = CodeFactory::ToNumber(isolate());
@@ -11081,10 +11080,10 @@ HValue* HGraphBuilder::BuildBinaryOperation(Token::Value op, HValue* left,
// Special case for +x here.
if (op == Token::MUL) {
if (left->EqualsInteger32Constant(1)) {
- return BuildToNumber(right, right_type);
+ return BuildToNumber(right);
}
if (right->EqualsInteger32Constant(1)) {
- return BuildToNumber(left, left_type);
+ return BuildToNumber(left);
}
}
@@ -12307,8 +12306,7 @@ void HOptimizedGraphBuilder::GenerateToNumber(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
Callable callable = CodeFactory::ToNumber(isolate());
HValue* input = Pop();
- Type* input_type = Type::Any();
- HValue* result = BuildToNumber(input, input_type);
+ HValue* result = BuildToNumber(input);
if (result->HasObservableSideEffects()) {
if (!ast_context()->IsEffect()) Push(result);
Add<HSimulate>(call->id(), REMOVABLE_SIMULATE);
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | test/mjsunit/regress/regress-crbug-590989-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698