Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2623 ASSERT(!instr->IsControlInstruction()); | 2623 ASSERT(!instr->IsControlInstruction()); |
| 2624 owner()->AddInstruction(instr); | 2624 owner()->AddInstruction(instr); |
| 2625 if (instr->HasObservableSideEffects()) { | 2625 if (instr->HasObservableSideEffects()) { |
| 2626 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 2626 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 2627 } | 2627 } |
| 2628 } | 2628 } |
| 2629 | 2629 |
| 2630 | 2630 |
| 2631 void EffectContext::ReturnControl(HControlInstruction* instr, | 2631 void EffectContext::ReturnControl(HControlInstruction* instr, |
| 2632 BailoutId ast_id) { | 2632 BailoutId ast_id) { |
| 2633 ASSERT(!instr->HasObservableSideEffects()); | 2633 // We can ignore ObservableSideEffects here since CreateJoin will add |
|
titzer
2013/09/19 16:24:27
I find this comment confusing and would rather jus
oliv
2013/09/19 16:38:00
Done.
| |
| 2634 // Simulates anyway. | |
| 2634 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock(); | 2635 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock(); |
| 2635 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock(); | 2636 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock(); |
| 2636 instr->SetSuccessorAt(0, empty_true); | 2637 instr->SetSuccessorAt(0, empty_true); |
| 2637 instr->SetSuccessorAt(1, empty_false); | 2638 instr->SetSuccessorAt(1, empty_false); |
| 2638 owner()->current_block()->Finish(instr); | 2639 owner()->current_block()->Finish(instr); |
| 2639 HBasicBlock* join = owner()->CreateJoin(empty_true, empty_false, ast_id); | 2640 HBasicBlock* join = owner()->CreateJoin(empty_true, empty_false, ast_id); |
| 2640 owner()->set_current_block(join); | 2641 owner()->set_current_block(join); |
| 2641 } | 2642 } |
| 2642 | 2643 |
| 2643 | 2644 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2664 } | 2665 } |
| 2665 owner()->AddInstruction(instr); | 2666 owner()->AddInstruction(instr); |
| 2666 owner()->Push(instr); | 2667 owner()->Push(instr); |
| 2667 if (instr->HasObservableSideEffects()) { | 2668 if (instr->HasObservableSideEffects()) { |
| 2668 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 2669 owner()->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 2669 } | 2670 } |
| 2670 } | 2671 } |
| 2671 | 2672 |
| 2672 | 2673 |
| 2673 void ValueContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) { | 2674 void ValueContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) { |
| 2674 ASSERT(!instr->HasObservableSideEffects()); | 2675 // We can ignore ObservableSideEffects here since CreateJoin will add |
| 2676 // Simulates anyway. | |
| 2675 if (!arguments_allowed() && instr->CheckFlag(HValue::kIsArguments)) { | 2677 if (!arguments_allowed() && instr->CheckFlag(HValue::kIsArguments)) { |
| 2676 return owner()->Bailout(kBadValueContextForArgumentsObjectValue); | 2678 return owner()->Bailout(kBadValueContextForArgumentsObjectValue); |
| 2677 } | 2679 } |
| 2678 HBasicBlock* materialize_false = owner()->graph()->CreateBasicBlock(); | 2680 HBasicBlock* materialize_false = owner()->graph()->CreateBasicBlock(); |
| 2679 HBasicBlock* materialize_true = owner()->graph()->CreateBasicBlock(); | 2681 HBasicBlock* materialize_true = owner()->graph()->CreateBasicBlock(); |
| 2680 instr->SetSuccessorAt(0, materialize_true); | 2682 instr->SetSuccessorAt(0, materialize_true); |
| 2681 instr->SetSuccessorAt(1, materialize_false); | 2683 instr->SetSuccessorAt(1, materialize_false); |
| 2682 owner()->current_block()->Finish(instr); | 2684 owner()->current_block()->Finish(instr); |
| 2683 owner()->set_current_block(materialize_true); | 2685 owner()->set_current_block(materialize_true); |
| 2684 owner()->Push(owner()->graph()->GetConstantTrue()); | 2686 owner()->Push(owner()->graph()->GetConstantTrue()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2722 if (instr->HasObservableSideEffects()) { | 2724 if (instr->HasObservableSideEffects()) { |
| 2723 builder->Push(instr); | 2725 builder->Push(instr); |
| 2724 builder->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 2726 builder->Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 2725 builder->Pop(); | 2727 builder->Pop(); |
| 2726 } | 2728 } |
| 2727 BuildBranch(instr); | 2729 BuildBranch(instr); |
| 2728 } | 2730 } |
| 2729 | 2731 |
| 2730 | 2732 |
| 2731 void TestContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) { | 2733 void TestContext::ReturnControl(HControlInstruction* instr, BailoutId ast_id) { |
| 2732 ASSERT(!instr->HasObservableSideEffects()); | 2734 // We can ignore ObservableSideEffects here since both HGoto instructions |
| 2735 // insert a different Simulate, thus we will directly deoptimize into the | |
| 2736 // correct branch. | |
| 2733 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock(); | 2737 HBasicBlock* empty_true = owner()->graph()->CreateBasicBlock(); |
| 2734 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock(); | 2738 HBasicBlock* empty_false = owner()->graph()->CreateBasicBlock(); |
| 2735 instr->SetSuccessorAt(0, empty_true); | 2739 instr->SetSuccessorAt(0, empty_true); |
| 2736 instr->SetSuccessorAt(1, empty_false); | 2740 instr->SetSuccessorAt(1, empty_false); |
| 2737 owner()->current_block()->Finish(instr); | 2741 owner()->current_block()->Finish(instr); |
| 2738 empty_true->Goto(if_true(), owner()->function_state()); | 2742 empty_true->Goto(if_true(), owner()->function_state()); |
| 2739 empty_false->Goto(if_false(), owner()->function_state()); | 2743 empty_false->Goto(if_false(), owner()->function_state()); |
| 2740 owner()->set_current_block(NULL); | 2744 owner()->set_current_block(NULL); |
| 2741 } | 2745 } |
| 2742 | 2746 |
| (...skipping 5294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8037 BuildCheckHeapObject(left); | 8041 BuildCheckHeapObject(left); |
| 8038 AddInstruction(HCheckInstanceType::NewIsInternalizedString(left, zone())); | 8042 AddInstruction(HCheckInstanceType::NewIsInternalizedString(left, zone())); |
| 8039 BuildCheckHeapObject(right); | 8043 BuildCheckHeapObject(right); |
| 8040 AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone())); | 8044 AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone())); |
| 8041 HCompareObjectEqAndBranch* result = | 8045 HCompareObjectEqAndBranch* result = |
| 8042 New<HCompareObjectEqAndBranch>(left, right); | 8046 New<HCompareObjectEqAndBranch>(left, right); |
| 8043 result->set_position(expr->position()); | 8047 result->set_position(expr->position()); |
| 8044 return ast_context()->ReturnControl(result, expr->id()); | 8048 return ast_context()->ReturnControl(result, expr->id()); |
| 8045 } else { | 8049 } else { |
| 8046 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 8050 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
| 8047 HCompareGeneric* result = | 8051 HCompareGenericAndBranch* result = |
| 8048 new(zone()) HCompareGeneric(context, left, right, op); | 8052 New<HCompareGenericAndBranch>(left, right, op); |
| 8049 result->set_observed_input_representation(1, left_rep); | 8053 result->set_observed_input_representation(left_rep, right_rep); |
| 8050 result->set_observed_input_representation(2, right_rep); | |
| 8051 result->set_position(expr->position()); | 8054 result->set_position(expr->position()); |
| 8052 return ast_context()->ReturnInstruction(result, expr->id()); | 8055 return ast_context()->ReturnControl(result, expr->id()); |
| 8053 } else { | 8056 } else { |
| 8054 HCompareNumericAndBranch* result = | 8057 HCompareNumericAndBranch* result = |
| 8055 New<HCompareNumericAndBranch>(left, right, op); | 8058 New<HCompareNumericAndBranch>(left, right, op); |
| 8056 result->set_observed_input_representation(left_rep, right_rep); | 8059 result->set_observed_input_representation(left_rep, right_rep); |
| 8057 result->set_position(expr->position()); | 8060 result->set_position(expr->position()); |
| 8058 return ast_context()->ReturnControl(result, expr->id()); | 8061 return ast_context()->ReturnControl(result, expr->id()); |
| 8059 } | 8062 } |
| 8060 } | 8063 } |
| 8061 } | 8064 } |
| 8062 | 8065 |
| (...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9616 if (ShouldProduceTraceOutput()) { | 9619 if (ShouldProduceTraceOutput()) { |
| 9617 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9620 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9618 } | 9621 } |
| 9619 | 9622 |
| 9620 #ifdef DEBUG | 9623 #ifdef DEBUG |
| 9621 graph_->Verify(false); // No full verify. | 9624 graph_->Verify(false); // No full verify. |
| 9622 #endif | 9625 #endif |
| 9623 } | 9626 } |
| 9624 | 9627 |
| 9625 } } // namespace v8::internal | 9628 } } // namespace v8::internal |
| OLD | NEW |