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

Side by Side Diff: src/hydrogen.cc

Issue 24255015: Revert "Allow control intructions to have side effects." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('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 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 ASSERT(!instr->IsControlInstruction()); 2648 ASSERT(!instr->IsControlInstruction());
2649 owner()->AddInstruction(instr); 2649 owner()->AddInstruction(instr);
2650 if (instr->HasObservableSideEffects()) { 2650 if (instr->HasObservableSideEffects()) {
2651 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 2651 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
2652 } 2652 }
2653 } 2653 }
2654 2654
2655 2655
2656 void EffectContext::ReturnControl(HControlInstruction* instr, 2656 void EffectContext::ReturnControl(HControlInstruction* instr,
2657 BailoutId ast_id) { 2657 BailoutId ast_id) {
2658 ASSERT(!instr->HasObservableSideEffects());
2658 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock(); 2659 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock();
2659 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock(); 2660 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock();
2660 instr->SetSuccessorAt(0, empty_true); 2661 instr->SetSuccessorAt(0, empty_true);
2661 instr->SetSuccessorAt(1, empty_false); 2662 instr->SetSuccessorAt(1, empty_false);
2662 owner()->current_block()->Finish(instr); 2663 owner()->current_block()->Finish(instr);
2663 HBasicBlock* join = owner()->CreateJoin(empty_true, empty_false, ast_id); 2664 HBasicBlock* join = owner()->CreateJoin(empty_true, empty_false, ast_id);
2664 owner()->set_current_block(join); 2665 owner()->set_current_block(join);
2665 } 2666 }
2666 2667
2667 2668
(...skipping 20 matching lines...) Expand all
2688 } 2689 }
2689 owner()->AddInstruction(instr); 2690 owner()->AddInstruction(instr);
2690 owner()->Push(instr); 2691 owner()->Push(instr);
2691 if (instr->HasObservableSideEffects()) { 2692 if (instr->HasObservableSideEffects()) {
2692 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 2693 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
2693 } 2694 }
2694 } 2695 }
2695 2696
2696 2697
2697 void ValueContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) { 2698 void ValueContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) {
2699 ASSERT(!instr->HasObservableSideEffects());
2698 if (!arguments_allowed() && instr->CheckFlag(HValue::kIsArguments)) { 2700 if (!arguments_allowed() && instr->CheckFlag(HValue::kIsArguments)) {
2699 return owner()->Bailout(kBadValueContextForArgumentsObjectValue); 2701 return owner()->Bailout(kBadValueContextForArgumentsObjectValue);
2700 } 2702 }
2701 HBasicBlock* materialize_false = owner()->graph()->CreateBasicBlock(); 2703 HBasicBlock* materialize_false = owner()->graph()->CreateBasicBlock();
2702 HBasicBlock* materialize_true = owner()->graph()->CreateBasicBlock(); 2704 HBasicBlock* materialize_true = owner()->graph()->CreateBasicBlock();
2703 instr->SetSuccessorAt(0, materialize_true); 2705 instr->SetSuccessorAt(0, materialize_true);
2704 instr->SetSuccessorAt(1, materialize_false); 2706 instr->SetSuccessorAt(1, materialize_false);
2705 owner()->current_block()->Finish(instr); 2707 owner()->current_block()->Finish(instr);
2706 owner()->set_current_block(materialize_true); 2708 owner()->set_current_block(materialize_true);
2707 owner()->Push(owner()->graph()->GetConstantTrue()); 2709 owner()->Push(owner()->graph()->GetConstantTrue());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2745 if (instr->HasObservableSideEffects()) { 2747 if (instr->HasObservableSideEffects()) {
2746 builder->Push(instr); 2748 builder->Push(instr);
2747 builder->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 2749 builder->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
2748 builder->Pop(); 2750 builder->Pop();
2749 } 2751 }
2750 BuildBranch(instr); 2752 BuildBranch(instr);
2751 } 2753 }
2752 2754
2753 2755
2754 void TestContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) { 2756 void TestContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) {
2755 // We can ignore ObservableSideEffects here since both HGoto instructions 2757 ASSERT(!instr->HasObservableSideEffects());
2756 // insert a different Simulate, thus we will directly deoptimize into the
2757 // correct branch.
2758 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock(); 2758 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock();
2759 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock(); 2759 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock();
2760 instr->SetSuccessorAt(0, empty_true); 2760 instr->SetSuccessorAt(0, empty_true);
2761 instr->SetSuccessorAt(1, empty_false); 2761 instr->SetSuccessorAt(1, empty_false);
2762 owner()->current_block()->Finish(instr); 2762 owner()->current_block()->Finish(instr);
2763 empty_true->Goto(if_true(), owner()->function_state()); 2763 empty_true->Goto(if_true(), owner()->function_state());
2764 empty_false->Goto(if_false(), owner()->function_state()); 2764 empty_false->Goto(if_false(), owner()->function_state());
2765 owner()->set_current_block(NULL); 2765 owner()->set_current_block(NULL);
2766 } 2766 }
2767 2767
(...skipping 5426 matching lines...) Expand 10 before | Expand all | Expand 10 after
8194 BuildCheckHeapObject(left); 8194 BuildCheckHeapObject(left);
8195 AddInstruction(HCheckInstanceType::NewIsInternalizedString(left, zone())); 8195 AddInstruction(HCheckInstanceType::NewIsInternalizedString(left, zone()));
8196 BuildCheckHeapObject(right); 8196 BuildCheckHeapObject(right);
8197 AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone())); 8197 AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone()));
8198 HCompareObjectEqAndBranch* result = 8198 HCompareObjectEqAndBranch* result =
8199 New<HCompareObjectEqAndBranch>(left, right); 8199 New<HCompareObjectEqAndBranch>(left, right);
8200 result->set_position(expr->position()); 8200 result->set_position(expr->position());
8201 return ast_context()->ReturnControl(result, expr->id()); 8201 return ast_context()->ReturnControl(result, expr->id());
8202 } else { 8202 } else {
8203 if (combined_rep.IsTagged() || combined_rep.IsNone()) { 8203 if (combined_rep.IsTagged() || combined_rep.IsNone()) {
8204 HCompareGenericAndBranch* result = 8204 HCompareGeneric* result =
8205 New<HCompareGenericAndBranch>(left, right, op); 8205 new(zone()) HCompareGeneric(context, left, right, op);
8206 result->set_observed_input_representation(left_rep, right_rep); 8206 result->set_observed_input_representation(1, left_rep);
8207 result->set_observed_input_representation(2, right_rep);
8207 result->set_position(expr->position()); 8208 result->set_position(expr->position());
8208 return ast_context()->ReturnControl(result, expr->id()); 8209 return ast_context()->ReturnInstruction(result, expr->id());
8209 } else { 8210 } else {
8210 HCompareNumericAndBranch* result = 8211 HCompareNumericAndBranch* result =
8211 New<HCompareNumericAndBranch>(left, right, op); 8212 New<HCompareNumericAndBranch>(left, right, op);
8212 result->set_observed_input_representation(left_rep, right_rep); 8213 result->set_observed_input_representation(left_rep, right_rep);
8213 result->set_position(expr->position()); 8214 result->set_position(expr->position());
8214 return ast_context()->ReturnControl(result, expr->id()); 8215 return ast_context()->ReturnControl(result, expr->id());
8215 } 8216 }
8216 } 8217 }
8217 } 8218 }
8218 8219
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
9773 if (ShouldProduceTraceOutput()) { 9774 if (ShouldProduceTraceOutput()) {
9774 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9775 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9775 } 9776 }
9776 9777
9777 #ifdef DEBUG 9778 #ifdef DEBUG
9778 graph_->Verify(false); // No full verify. 9779 graph_->Verify(false); // No full verify.
9779 #endif 9780 #endif
9780 } 9781 }
9781 9782
9782 } } // namespace v8::internal 9783 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698