OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4989 CHECK_ALIVE(VisitForValue(clause->label())); | 4989 CHECK_ALIVE(VisitForValue(clause->label())); |
4990 HValue* label_value = Pop(); | 4990 HValue* label_value = Pop(); |
4991 | 4991 |
4992 HBasicBlock* next_test_block = graph()->CreateBasicBlock(); | 4992 HBasicBlock* next_test_block = graph()->CreateBasicBlock(); |
4993 HBasicBlock* body_block = graph()->CreateBasicBlock(); | 4993 HBasicBlock* body_block = graph()->CreateBasicBlock(); |
4994 | 4994 |
4995 HControlInstruction* compare; | 4995 HControlInstruction* compare; |
4996 | 4996 |
4997 if (stmt->switch_type() == SwitchStatement::SMI_SWITCH) { | 4997 if (stmt->switch_type() == SwitchStatement::SMI_SWITCH) { |
4998 if (!clause->IsSmiCompare()) { | 4998 if (!clause->IsSmiCompare()) { |
4999 // Finish with deoptimize and add uses of enviroment values to | 4999 AddSoftDeoptimize(); |
5000 // account for invisible uses. | |
5001 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | |
5002 set_current_block(NULL); | |
5003 break; | |
5004 } | 5000 } |
5005 | 5001 |
5006 HCompareIDAndBranch* compare_ = | 5002 HCompareIDAndBranch* compare_ = |
5007 new(zone()) HCompareIDAndBranch(tag_value, | 5003 new(zone()) HCompareIDAndBranch(tag_value, |
5008 label_value, | 5004 label_value, |
5009 Token::EQ_STRICT); | 5005 Token::EQ_STRICT); |
5010 compare_->set_observed_input_representation( | 5006 compare_->set_observed_input_representation( |
5011 Representation::Integer32(), Representation::Integer32()); | 5007 Representation::Integer32(), Representation::Integer32()); |
5012 compare = compare_; | 5008 compare = compare_; |
5013 } else { | 5009 } else { |
5014 compare = new(zone()) HStringCompareAndBranch(context, tag_value, | 5010 compare = new(zone()) HStringCompareAndBranch(context, tag_value, |
5015 label_value, | 5011 label_value, |
5016 Token::EQ_STRICT); | 5012 Token::EQ_STRICT); |
5017 } | 5013 } |
5018 | 5014 |
5019 compare->SetSuccessorAt(0, body_block); | 5015 compare->SetSuccessorAt(0, body_block); |
5020 compare->SetSuccessorAt(1, next_test_block); | 5016 compare->SetSuccessorAt(1, next_test_block); |
5021 current_block()->Finish(compare); | 5017 current_block()->Finish(compare); |
5022 | 5018 |
5023 set_current_block(next_test_block); | 5019 set_current_block(next_test_block); |
5024 } | 5020 } |
5025 | 5021 |
5026 // Save the current block to use for the default or to join with the | 5022 // Save the current block to use for the default or to join with the |
5027 // exit. This block is NULL if we deoptimized. | 5023 // exit. |
5028 HBasicBlock* last_block = current_block(); | 5024 HBasicBlock* last_block = current_block(); |
5029 | 5025 |
5030 if (not_string_block != NULL) { | 5026 if (not_string_block != NULL) { |
5031 BailoutId join_id = !default_id.IsNone() ? default_id : stmt->ExitId(); | 5027 BailoutId join_id = !default_id.IsNone() ? default_id : stmt->ExitId(); |
5032 last_block = CreateJoin(last_block, not_string_block, join_id); | 5028 last_block = CreateJoin(last_block, not_string_block, join_id); |
5033 } | 5029 } |
5034 | 5030 |
5035 // 2. Loop over the clauses and the linked list of tests in lockstep, | 5031 // 2. Loop over the clauses and the linked list of tests in lockstep, |
5036 // translating the clause bodies. | 5032 // translating the clause bodies. |
5037 HBasicBlock* curr_test_block = first_test_block; | 5033 HBasicBlock* curr_test_block = first_test_block; |
(...skipping 6545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11583 } | 11579 } |
11584 } | 11580 } |
11585 | 11581 |
11586 #ifdef DEBUG | 11582 #ifdef DEBUG |
11587 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11583 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11588 if (allocator_ != NULL) allocator_->Verify(); | 11584 if (allocator_ != NULL) allocator_->Verify(); |
11589 #endif | 11585 #endif |
11590 } | 11586 } |
11591 | 11587 |
11592 } } // namespace v8::internal | 11588 } } // namespace v8::internal |
OLD | NEW |