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 4693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4704 ++count; | 4704 ++count; |
4705 HBasicBlock* if_true = graph()->CreateBasicBlock(); | 4705 HBasicBlock* if_true = graph()->CreateBasicBlock(); |
4706 HBasicBlock* if_false = graph()->CreateBasicBlock(); | 4706 HBasicBlock* if_false = graph()->CreateBasicBlock(); |
4707 HCompareMap* compare = New<HCompareMap>( | 4707 HCompareMap* compare = New<HCompareMap>( |
4708 object, info.map(), if_true, if_false); | 4708 object, info.map(), if_true, if_false); |
4709 current_block()->Finish(compare); | 4709 current_block()->Finish(compare); |
4710 | 4710 |
4711 set_current_block(if_true); | 4711 set_current_block(if_true); |
4712 | 4712 |
4713 HInstruction* load = BuildLoadMonomorphic( | 4713 HInstruction* load = BuildLoadMonomorphic( |
4714 &info, object, compare, ast_id, return_id, false); | 4714 &info, object, compare, ast_id, return_id, FLAG_polymorphic_inlining); |
4715 if (load == NULL) { | 4715 if (load == NULL) { |
4716 if (HasStackOverflow()) return; | 4716 if (HasStackOverflow()) return; |
4717 } else { | 4717 } else { |
4718 if (!load->IsLinked()) { | 4718 if (!load->IsLinked()) { |
4719 load->set_position(position); | 4719 load->set_position(position); |
4720 AddInstruction(load); | 4720 AddInstruction(load); |
4721 } | 4721 } |
4722 if (!ast_context()->IsEffect()) Push(load); | 4722 if (!ast_context()->IsEffect()) Push(load); |
4723 } | 4723 } |
4724 | 4724 |
4725 if (current_block() != NULL) current_block()->Goto(join); | 4725 if (current_block() != NULL) current_block()->Goto(join); |
4726 set_current_block(if_false); | 4726 set_current_block(if_false); |
4727 } | 4727 } |
4728 } | 4728 } |
4729 | 4729 |
4730 // Finish up. Unconditionally deoptimize if we've handled all the maps we | 4730 // Finish up. Unconditionally deoptimize if we've handled all the maps we |
4731 // know about and do not want to handle ones we've never seen. Otherwise | 4731 // know about and do not want to handle ones we've never seen. Otherwise |
4732 // use a generic IC. | 4732 // use a generic IC. |
4733 if (count == types->length() && FLAG_deoptimize_uncommon_cases) { | 4733 if (count == types->length() && FLAG_deoptimize_uncommon_cases) { |
| 4734 // Because the deopt may be the only path in the polymorphic load, make sure |
| 4735 // that the environment stack matches the depth on deopt that it otherwise |
| 4736 // would have had after a successful load. |
| 4737 if (!ast_context()->IsEffect()) Push(graph()->GetConstant0()); |
4734 FinishExitWithHardDeoptimization("Unknown map in polymorphic load", join); | 4738 FinishExitWithHardDeoptimization("Unknown map in polymorphic load", join); |
4735 } else { | 4739 } else { |
4736 HValue* context = environment()->context(); | 4740 HValue* context = environment()->context(); |
4737 HInstruction* load = new(zone()) HLoadNamedGeneric(context, object, name); | 4741 HInstruction* load = new(zone()) HLoadNamedGeneric(context, object, name); |
4738 load->set_position(position); | 4742 load->set_position(position); |
4739 AddInstruction(load); | 4743 AddInstruction(load); |
4740 if (!ast_context()->IsEffect()) Push(load); | 4744 if (!ast_context()->IsEffect()) Push(load); |
4741 | 4745 |
4742 if (join != NULL) { | 4746 if (join != NULL) { |
4743 current_block()->Goto(join); | 4747 current_block()->Goto(join); |
(...skipping 4872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9616 if (ShouldProduceTraceOutput()) { | 9620 if (ShouldProduceTraceOutput()) { |
9617 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9621 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9618 } | 9622 } |
9619 | 9623 |
9620 #ifdef DEBUG | 9624 #ifdef DEBUG |
9621 graph_->Verify(false); // No full verify. | 9625 graph_->Verify(false); // No full verify. |
9622 #endif | 9626 #endif |
9623 } | 9627 } |
9624 | 9628 |
9625 } } // namespace v8::internal | 9629 } } // namespace v8::internal |
OLD | NEW |