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

Unified Diff: src/hydrogen.cc

Issue 14081008: Type feedback for Unary Plus (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 127d7a9aa1ed13943d558e7096ec35ca15ae3818..894a1cc26cd3f5c1021affd8e32ea12c659a423c 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -9222,12 +9222,18 @@ void HOptimizedGraphBuilder::VisitAdd(UnaryOperation* expr) {
CHECK_ALIVE(VisitForValue(expr->expression()));
HValue* value = Pop();
HValue* context = environment()->LookupContext();
+ TypeInfo left_info, right_info, result_info;
+ oracle()->BinaryType(
+ expr->UnaryOperationFeedbackId(), &left_info, &right_info, &result_info);
+ // Left is constant 1.
+ ASSERT(left_info.IsSmi());
+ Representation left_rep = ToRepresentation(left_info);
+ Representation right_rep = ToRepresentation(right_info);
HInstruction* instr =
- HMul::New(zone(), context, value, graph()->GetConstant1());
+ HMul::New(zone(), context, graph()->GetConstant1(), value);
if (instr->IsBinaryOperation()) {
- // Since we don't have type feedback, we must be cautious/pessimistic.
HBinaryOperation::cast(instr)->set_observed_input_representation(
- Representation::Tagged(), Representation::Tagged());
+ left_rep, right_rep);
}
return ast_context()->ReturnInstruction(instr, expr->id());
}
@@ -9618,8 +9624,9 @@ HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
HValue* left,
HValue* right) {
HValue* context = environment()->LookupContext();
- TypeInfo left_info, right_info, result_info, combined_info;
- oracle()->BinaryType(expr, &left_info, &right_info, &result_info);
+ TypeInfo left_info, right_info, result_info;
+ oracle()->BinaryType(
+ expr->BinaryOperationFeedbackId(), &left_info, &right_info, &result_info);
Representation left_rep = ToRepresentation(left_info);
Representation right_rep = ToRepresentation(right_info);
Representation result_rep = ToRepresentation(result_info);
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698