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

Side by Side Diff: src/hydrogen.cc

Issue 163623002: Comparison in effect context lazy deopt fix. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « src/hydrogen.h ('k') | test/mjsunit/regress/comparison-in-effect-context-deopt.js » ('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 // 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 4357 matching lines...) Expand 10 before | Expand all | Expand 10 after
4368 4368
4369 // Generate a compare and branch. 4369 // Generate a compare and branch.
4370 CHECK_ALIVE(VisitForValue(clause->label())); 4370 CHECK_ALIVE(VisitForValue(clause->label()));
4371 HValue* label_value = Pop(); 4371 HValue* label_value = Pop();
4372 4372
4373 Type* label_type = clause->label()->bounds().lower; 4373 Type* label_type = clause->label()->bounds().lower;
4374 Type* combined_type = clause->compare_type(); 4374 Type* combined_type = clause->compare_type();
4375 HControlInstruction* compare = BuildCompareInstruction( 4375 HControlInstruction* compare = BuildCompareInstruction(
4376 Token::EQ_STRICT, tag_value, label_value, tag_type, label_type, 4376 Token::EQ_STRICT, tag_value, label_value, tag_type, label_type,
4377 combined_type, stmt->tag()->position(), clause->label()->position(), 4377 combined_type, stmt->tag()->position(), clause->label()->position(),
4378 clause->id()); 4378 PUSH_BEFORE_SIMULATE, clause->id());
4379 4379
4380 HBasicBlock* next_test_block = graph()->CreateBasicBlock(); 4380 HBasicBlock* next_test_block = graph()->CreateBasicBlock();
4381 HBasicBlock* body_block = graph()->CreateBasicBlock(); 4381 HBasicBlock* body_block = graph()->CreateBasicBlock();
4382 body_blocks.Add(body_block, zone()); 4382 body_blocks.Add(body_block, zone());
4383 compare->SetSuccessorAt(0, body_block); 4383 compare->SetSuccessorAt(0, body_block);
4384 compare->SetSuccessorAt(1, next_test_block); 4384 compare->SetSuccessorAt(1, next_test_block);
4385 FinishCurrentBlock(compare); 4385 FinishCurrentBlock(compare);
4386 4386
4387 set_current_block(body_block); 4387 set_current_block(body_block);
4388 Drop(1); // tag_value 4388 Drop(1); // tag_value
(...skipping 5131 matching lines...) Expand 10 before | Expand all | Expand 10 after
9520 } else if (op == Token::IN) { 9520 } else if (op == Token::IN) {
9521 HValue* function = AddLoadJSBuiltin(Builtins::IN); 9521 HValue* function = AddLoadJSBuiltin(Builtins::IN);
9522 Add<HPushArgument>(left); 9522 Add<HPushArgument>(left);
9523 Add<HPushArgument>(right); 9523 Add<HPushArgument>(right);
9524 // TODO(olivf) InvokeFunction produces a check for the parameter count, 9524 // TODO(olivf) InvokeFunction produces a check for the parameter count,
9525 // even though we are certain to pass the correct number of arguments here. 9525 // even though we are certain to pass the correct number of arguments here.
9526 HInstruction* result = New<HInvokeFunction>(function, 2); 9526 HInstruction* result = New<HInvokeFunction>(function, 2);
9527 return ast_context()->ReturnInstruction(result, expr->id()); 9527 return ast_context()->ReturnInstruction(result, expr->id());
9528 } 9528 }
9529 9529
9530 PushBeforeSimulateBehavior push_behavior =
9531 ast_context()->IsEffect() ? NO_PUSH_BEFORE_SIMULATE
9532 : PUSH_BEFORE_SIMULATE;
9530 HControlInstruction* compare = BuildCompareInstruction( 9533 HControlInstruction* compare = BuildCompareInstruction(
9531 op, left, right, left_type, right_type, combined_type, 9534 op, left, right, left_type, right_type, combined_type,
9532 expr->left()->position(), expr->right()->position(), expr->id()); 9535 expr->left()->position(), expr->right()->position(),
9536 push_behavior, expr->id());
9533 if (compare == NULL) return; // Bailed out. 9537 if (compare == NULL) return; // Bailed out.
9534 return ast_context()->ReturnControl(compare, expr->id()); 9538 return ast_context()->ReturnControl(compare, expr->id());
9535 } 9539 }
9536 9540
9537 9541
9538 HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction( 9542 HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
9539 Token::Value op, 9543 Token::Value op,
9540 HValue* left, 9544 HValue* left,
9541 HValue* right, 9545 HValue* right,
9542 Type* left_type, 9546 Type* left_type,
9543 Type* right_type, 9547 Type* right_type,
9544 Type* combined_type, 9548 Type* combined_type,
9545 int left_position, 9549 int left_position,
9546 int right_position, 9550 int right_position,
9551 PushBeforeSimulateBehavior push_sim_result,
9547 BailoutId bailout_id) { 9552 BailoutId bailout_id) {
9548 // Cases handled below depend on collected type feedback. They should 9553 // Cases handled below depend on collected type feedback. They should
9549 // soft deoptimize when there is no type feedback. 9554 // soft deoptimize when there is no type feedback.
9550 if (combined_type->Is(Type::None())) { 9555 if (combined_type->Is(Type::None())) {
9551 Add<HDeoptimize>("Insufficient type feedback for combined type " 9556 Add<HDeoptimize>("Insufficient type feedback for combined type "
9552 "of binary operation", 9557 "of binary operation",
9553 Deoptimizer::SOFT); 9558 Deoptimizer::SOFT);
9554 combined_type = left_type = right_type = Type::Any(zone()); 9559 combined_type = left_type = right_type = Type::Any(zone());
9555 } 9560 }
9556 9561
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
9601 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING); 9606 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING);
9602 HStringCompareAndBranch* result = 9607 HStringCompareAndBranch* result =
9603 New<HStringCompareAndBranch>(left, right, op); 9608 New<HStringCompareAndBranch>(left, right, op);
9604 return result; 9609 return result;
9605 } else { 9610 } else {
9606 if (combined_rep.IsTagged() || combined_rep.IsNone()) { 9611 if (combined_rep.IsTagged() || combined_rep.IsNone()) {
9607 HCompareGeneric* result = Add<HCompareGeneric>(left, right, op); 9612 HCompareGeneric* result = Add<HCompareGeneric>(left, right, op);
9608 result->set_observed_input_representation(1, left_rep); 9613 result->set_observed_input_representation(1, left_rep);
9609 result->set_observed_input_representation(2, right_rep); 9614 result->set_observed_input_representation(2, right_rep);
9610 if (result->HasObservableSideEffects()) { 9615 if (result->HasObservableSideEffects()) {
9611 Push(result); 9616 if (push_sim_result == NO_PUSH_BEFORE_SIMULATE) {
Jakob Kummerow 2014/02/13 15:55:32 nit: I'd find it slightly more readable to swap th
9612 AddSimulate(bailout_id, REMOVABLE_SIMULATE); 9617 AddSimulate(bailout_id, REMOVABLE_SIMULATE);
9613 Drop(1); 9618 } else {
9619 ASSERT(push_sim_result == PUSH_BEFORE_SIMULATE);
9620 Push(result);
9621 AddSimulate(bailout_id, REMOVABLE_SIMULATE);
9622 Drop(1);
9623 }
9614 } 9624 }
9615 // TODO(jkummerow): Can we make this more efficient? 9625 // TODO(jkummerow): Can we make this more efficient?
9616 HBranch* branch = New<HBranch>(result); 9626 HBranch* branch = New<HBranch>(result);
9617 return branch; 9627 return branch;
9618 } else { 9628 } else {
9619 HCompareNumericAndBranch* result = 9629 HCompareNumericAndBranch* result =
9620 New<HCompareNumericAndBranch>(left, right, op); 9630 New<HCompareNumericAndBranch>(left, right, op);
9621 result->set_observed_input_representation(left_rep, right_rep); 9631 result->set_observed_input_representation(left_rep, right_rep);
9622 if (FLAG_emit_opt_code_positions) { 9632 if (FLAG_emit_opt_code_positions) {
9623 result->SetOperandPositions(zone(), left_position, right_position); 9633 result->SetOperandPositions(zone(), left_position, right_position);
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
11187 if (ShouldProduceTraceOutput()) { 11197 if (ShouldProduceTraceOutput()) {
11188 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11198 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11189 } 11199 }
11190 11200
11191 #ifdef DEBUG 11201 #ifdef DEBUG
11192 graph_->Verify(false); // No full verify. 11202 graph_->Verify(false); // No full verify.
11193 #endif 11203 #endif
11194 } 11204 }
11195 11205
11196 } } // namespace v8::internal 11206 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | test/mjsunit/regress/comparison-in-effect-context-deopt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698