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

Side by Side Diff: src/hydrogen.cc

Issue 132453009: Binary operation deoptimization fix. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor tweaks + added test Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6048 matching lines...) Expand 10 before | Expand all | Expand 10 after
6059 CHECK_ALIVE(VisitForValue(prop->key())); 6059 CHECK_ALIVE(VisitForValue(prop->key()));
6060 key = Top(); 6060 key = Top();
6061 } 6061 }
6062 6062
6063 CHECK_ALIVE(PushLoad(prop, object, key)); 6063 CHECK_ALIVE(PushLoad(prop, object, key));
6064 6064
6065 CHECK_ALIVE(VisitForValue(expr->value())); 6065 CHECK_ALIVE(VisitForValue(expr->value()));
6066 HValue* right = Pop(); 6066 HValue* right = Pop();
6067 HValue* left = Pop(); 6067 HValue* left = Pop();
6068 6068
6069 Push(BuildBinaryOperation(operation, left, right)); 6069 Push(BuildBinaryOperation(operation, left, right, PUSH_BEFORE_SIMULATE));
6070
6070 BuildStore(expr, prop, expr->id(), 6071 BuildStore(expr, prop, expr->id(),
6071 expr->AssignmentId(), expr->IsUninitialized()); 6072 expr->AssignmentId(), expr->IsUninitialized());
6072 } else { 6073 } else {
6073 return Bailout(kInvalidLhsInCompoundAssignment); 6074 return Bailout(kInvalidLhsInCompoundAssignment);
6074 } 6075 }
6075 } 6076 }
6076 6077
6077 6078
6078 void HOptimizedGraphBuilder::VisitAssignment(Assignment* expr) { 6079 void HOptimizedGraphBuilder::VisitAssignment(Assignment* expr) {
6079 ASSERT(!HasStackOverflow()); 6080 ASSERT(!HasStackOverflow());
(...skipping 2958 matching lines...) Expand 10 before | Expand all | Expand 10 after
9038 return value; 9039 return value;
9039 } 9040 }
9040 9041
9041 return value; 9042 return value;
9042 } 9043 }
9043 9044
9044 9045
9045 HValue* HOptimizedGraphBuilder::BuildBinaryOperation( 9046 HValue* HOptimizedGraphBuilder::BuildBinaryOperation(
9046 BinaryOperation* expr, 9047 BinaryOperation* expr,
9047 HValue* left, 9048 HValue* left,
9048 HValue* right) { 9049 HValue* right,
9050 PushBeforeSimulateBehavior pushSimResult) {
9049 Type* left_type = expr->left()->bounds().lower; 9051 Type* left_type = expr->left()->bounds().lower;
9050 Type* right_type = expr->right()->bounds().lower; 9052 Type* right_type = expr->right()->bounds().lower;
9051 Type* result_type = expr->bounds().lower; 9053 Type* result_type = expr->bounds().lower;
9052 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); 9054 Maybe<int> fixed_right_arg = expr->fixed_right_arg();
9053 Handle<AllocationSite> allocation_site = expr->allocation_site(); 9055 Handle<AllocationSite> allocation_site = expr->allocation_site();
9054 9056
9055 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? 9057 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ?
9056 isolate()->heap()->GetPretenureMode() : NOT_TENURED; 9058 isolate()->heap()->GetPretenureMode() : NOT_TENURED;
9057 9059
9058 HAllocationMode allocation_mode = 9060 HAllocationMode allocation_mode =
9059 FLAG_allocation_site_pretenuring 9061 FLAG_allocation_site_pretenuring
9060 ? (allocation_site.is_null() 9062 ? (allocation_site.is_null()
9061 ? HAllocationMode(NOT_TENURED) 9063 ? HAllocationMode(NOT_TENURED)
9062 : HAllocationMode(allocation_site)) 9064 : HAllocationMode(allocation_site))
9063 : HAllocationMode(pretenure_flag); 9065 : HAllocationMode(pretenure_flag);
9064 9066
9065 HValue* result = HGraphBuilder::BuildBinaryOperation( 9067 HValue* result = HGraphBuilder::BuildBinaryOperation(
9066 expr->op(), left, right, left_type, right_type, result_type, 9068 expr->op(), left, right, left_type, right_type, result_type,
9067 fixed_right_arg, allocation_mode); 9069 fixed_right_arg, allocation_mode);
9068 // Add a simulate after instructions with observable side effects, and 9070 // Add a simulate after instructions with observable side effects, and
9069 // after phis, which are the result of BuildBinaryOperation when we 9071 // after phis, which are the result of BuildBinaryOperation when we
9070 // inlined some complex subgraph. 9072 // inlined some complex subgraph.
9071 if (result->HasObservableSideEffects() || result->IsPhi()) { 9073 if (result->HasObservableSideEffects() || result->IsPhi()) {
9072 Push(result); 9074 if (pushSimResult == NO_PUSH_BEFORE_SIMULATE) {
9073 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); 9075 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
9074 Drop(1); 9076 } else {
9077 ASSERT(pushSimResult == PUSH_BEFORE_SIMULATE);
9078 Push(result);
9079 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
9080 Drop(1);
9081 }
9075 } 9082 }
9076 return result; 9083 return result;
9077 } 9084 }
9078 9085
9079 9086
9080 HValue* HGraphBuilder::BuildBinaryOperation( 9087 HValue* HGraphBuilder::BuildBinaryOperation(
9081 Token::Value op, 9088 Token::Value op,
9082 HValue* left, 9089 HValue* left,
9083 HValue* right, 9090 HValue* right,
9084 Type* left_type, 9091 Type* left_type,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
9444 } 9451 }
9445 } 9452 }
9446 9453
9447 9454
9448 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { 9455 void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) {
9449 CHECK_ALIVE(VisitForValue(expr->left())); 9456 CHECK_ALIVE(VisitForValue(expr->left()));
9450 CHECK_ALIVE(VisitForValue(expr->right())); 9457 CHECK_ALIVE(VisitForValue(expr->right()));
9451 SetSourcePosition(expr->position()); 9458 SetSourcePosition(expr->position());
9452 HValue* right = Pop(); 9459 HValue* right = Pop();
9453 HValue* left = Pop(); 9460 HValue* left = Pop();
9454 HValue* result = BuildBinaryOperation(expr, left, right); 9461 HValue* result =
9462 BuildBinaryOperation(expr, left, right,
9463 ast_context()->IsEffect()
Jakob Kummerow 2014/02/06 08:33:41 nit: preferred formatting: ast_context(
9464 ? NO_PUSH_BEFORE_SIMULATE
9465 : PUSH_BEFORE_SIMULATE);
9455 if (FLAG_emit_opt_code_positions && result->IsBinaryOperation()) { 9466 if (FLAG_emit_opt_code_positions && result->IsBinaryOperation()) {
9456 HBinaryOperation::cast(result)->SetOperandPositions( 9467 HBinaryOperation::cast(result)->SetOperandPositions(
9457 zone(), expr->left()->position(), expr->right()->position()); 9468 zone(), expr->left()->position(), expr->right()->position());
9458 } 9469 }
9459 return ast_context()->ReturnValue(result); 9470 return ast_context()->ReturnValue(result);
9460 } 9471 }
9461 9472
9462 9473
9463 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, 9474 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
9464 Expression* sub_expr, 9475 Expression* sub_expr,
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
11222 if (ShouldProduceTraceOutput()) { 11233 if (ShouldProduceTraceOutput()) {
11223 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11234 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11224 } 11235 }
11225 11236
11226 #ifdef DEBUG 11237 #ifdef DEBUG
11227 graph_->Verify(false); // No full verify. 11238 graph_->Verify(false); // No full verify.
11228 #endif 11239 #endif
11229 } 11240 }
11230 11241
11231 } } // namespace v8::internal 11242 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698