| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 BitVector* live_in_successor = live_at_block_start_[successor_id]; | 77 BitVector* live_in_successor = live_at_block_start_[successor_id]; |
| 78 if (live_in_successor->Equals(*live)) continue; | 78 if (live_in_successor->Equals(*live)) continue; |
| 79 for (int i = 0; i < live->length(); ++i) { | 79 for (int i = 0; i < live->length(); ++i) { |
| 80 if (!live->Contains(i)) continue; | 80 if (!live->Contains(i)) continue; |
| 81 if (live_in_successor->Contains(i)) continue; | 81 if (live_in_successor->Contains(i)) continue; |
| 82 if (first_simulate_invalid_for_index_.at(successor_id)->Contains(i)) { | 82 if (first_simulate_invalid_for_index_.at(successor_id)->Contains(i)) { |
| 83 continue; | 83 continue; |
| 84 } | 84 } |
| 85 HSimulate* simulate = first_simulate_.at(successor_id); | 85 HSimulate* simulate = first_simulate_.at(successor_id); |
| 86 if (simulate == NULL) continue; | 86 if (simulate == NULL) continue; |
| 87 ASSERT(simulate->closure().is_identical_to( | 87 ASSERT(VerifyClosures(simulate->closure(), |
| 88 block->last_environment()->closure())); | 88 block->last_environment()->closure())); |
| 89 ZapEnvironmentSlot(i, simulate); | 89 ZapEnvironmentSlot(i, simulate); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction( | 95 void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction( |
| 96 HEnvironmentMarker* marker) { | 96 HEnvironmentMarker* marker) { |
| 97 if (!marker->CheckFlag(HValue::kEndsLiveRange)) return; | 97 if (!marker->CheckFlag(HValue::kEndsLiveRange)) return; |
| 98 HSimulate* simulate = marker->next_simulate(); | 98 HSimulate* simulate = marker->next_simulate(); |
| 99 if (simulate != NULL) { | 99 if (simulate != NULL) { |
| 100 ASSERT(simulate->closure().is_identical_to(marker->closure())); | 100 ASSERT(VerifyClosures(simulate->closure(), marker->closure())); |
| 101 ZapEnvironmentSlot(marker->index(), simulate); | 101 ZapEnvironmentSlot(marker->index(), simulate); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 void HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtBlockEnd( | 106 void HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtBlockEnd( |
| 107 HBasicBlock* block, | 107 HBasicBlock* block, |
| 108 BitVector* live) { | 108 BitVector* live) { |
| 109 // Liveness at the end of each block: union of liveness in successors. | 109 // Liveness at the end of each block: union of liveness in successors. |
| 110 live->Clear(); | 110 live->Clear(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 UpdateLivenessAtBlockEnd(block, &live); | 234 UpdateLivenessAtBlockEnd(block, &live); |
| 235 ZapEnvironmentSlotsInSuccessors(block, &live); | 235 ZapEnvironmentSlotsInSuccessors(block, &live); |
| 236 } | 236 } |
| 237 | 237 |
| 238 // Finally, remove the HEnvironment{Bind,Lookup} markers. | 238 // Finally, remove the HEnvironment{Bind,Lookup} markers. |
| 239 for (int i = 0; i < markers_.length(); ++i) { | 239 for (int i = 0; i < markers_.length(); ++i) { |
| 240 markers_[i]->DeleteAndReplaceWith(NULL); | 240 markers_[i]->DeleteAndReplaceWith(NULL); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 |
| 245 #ifdef DEBUG |
| 246 bool HEnvironmentLivenessAnalysisPhase::VerifyClosures( |
| 247 Handle<JSFunction> a, Handle<JSFunction> b) { |
| 248 Heap::RelocationLock for_heap_access(isolate()->heap()); |
| 249 AllowHandleDereference for_verification; |
| 250 return a.is_identical_to(b); |
| 251 } |
| 252 #endif |
| 253 |
| 244 } } // namespace v8::internal | 254 } } // namespace v8::internal |
| OLD | NEW |