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 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 { AllowHandleDereference locked; |
| 88 block->last_environment()->closure())); | 88 ASSERT(simulate->closure().is_identical_to( |
| 89 block->last_environment()->closure())); | |
| 90 } | |
| 89 ZapEnvironmentSlot(i, simulate); | 91 ZapEnvironmentSlot(i, simulate); |
| 90 } | 92 } |
| 91 } | 93 } |
| 92 } | 94 } |
| 93 | 95 |
| 94 | 96 |
| 95 void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction( | 97 void HEnvironmentLivenessAnalysisPhase::ZapEnvironmentSlotsForInstruction( |
| 96 HEnvironmentMarker* marker) { | 98 HEnvironmentMarker* marker) { |
| 97 if (!marker->CheckFlag(HValue::kEndsLiveRange)) return; | 99 if (!marker->CheckFlag(HValue::kEndsLiveRange)) return; |
| 98 HSimulate* simulate = marker->next_simulate(); | 100 HSimulate* simulate = marker->next_simulate(); |
| 99 if (simulate != NULL) { | 101 if (simulate != NULL) { |
| 100 ASSERT(simulate->closure().is_identical_to(marker->closure())); | 102 { AllowHandleDereference locked; |
| 103 ASSERT(simulate->closure().is_identical_to(marker->closure())); | |
| 104 } | |
| 101 ZapEnvironmentSlot(marker->index(), simulate); | 105 ZapEnvironmentSlot(marker->index(), simulate); |
| 102 } | 106 } |
| 103 } | 107 } |
| 104 | 108 |
| 105 | 109 |
| 106 void HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtBlockEnd( | 110 void HEnvironmentLivenessAnalysisPhase::UpdateLivenessAtBlockEnd( |
| 107 HBasicBlock* block, | 111 HBasicBlock* block, |
| 108 BitVector* live) { | 112 BitVector* live) { |
| 109 // Liveness at the end of each block: union of liveness in successors. | 113 // Liveness at the end of each block: union of liveness in successors. |
| 110 live->Clear(); | 114 live->Clear(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 worklist.Add(block->inlined_entry_block()->block_id()); | 224 worklist.Add(block->inlined_entry_block()->block_id()); |
| 221 } | 225 } |
| 222 } | 226 } |
| 223 } | 227 } |
| 224 // Only collect bind/lookup instructions during the first pass. | 228 // Only collect bind/lookup instructions during the first pass. |
| 225 collect_markers_ = false; | 229 collect_markers_ = false; |
| 226 } | 230 } |
| 227 | 231 |
| 228 // Analysis finished. Zap dead environment slots. | 232 // Analysis finished. Zap dead environment slots. |
| 229 for (int i = 0; i < markers_.length(); ++i) { | 233 for (int i = 0; i < markers_.length(); ++i) { |
| 234 // Acquire relocation lock to dereference for assertion. | |
| 235 #ifdef DEBUG | |
| 236 Heap::RelocationLock for_heap_access(isolate()->heap()); | |
|
Hannes Payer (out of office)
2014/03/27 17:16:20
what about moving that locking code to where it is
Yang
2014/03/28 08:27:40
I refactored the handle comparison.
| |
| 237 #endif | |
| 230 ZapEnvironmentSlotsForInstruction(markers_[i]); | 238 ZapEnvironmentSlotsForInstruction(markers_[i]); |
| 231 } | 239 } |
| 232 for (int block_id = block_count_ - 1; block_id >= 0; --block_id) { | 240 for (int block_id = block_count_ - 1; block_id >= 0; --block_id) { |
| 233 HBasicBlock* block = graph()->blocks()->at(block_id); | 241 HBasicBlock* block = graph()->blocks()->at(block_id); |
| 234 UpdateLivenessAtBlockEnd(block, &live); | 242 UpdateLivenessAtBlockEnd(block, &live); |
| 243 #ifdef DEBUG | |
| 244 Heap::RelocationLock for_heap_access(isolate()->heap()); | |
|
Hannes Payer (out of office)
2014/03/27 17:16:20
what about moving that locking code to where it is
| |
| 245 #endif | |
| 235 ZapEnvironmentSlotsInSuccessors(block, &live); | 246 ZapEnvironmentSlotsInSuccessors(block, &live); |
| 236 } | 247 } |
| 237 | 248 |
| 238 // Finally, remove the HEnvironment{Bind,Lookup} markers. | 249 // Finally, remove the HEnvironment{Bind,Lookup} markers. |
| 239 for (int i = 0; i < markers_.length(); ++i) { | 250 for (int i = 0; i < markers_.length(); ++i) { |
| 240 markers_[i]->DeleteAndReplaceWith(NULL); | 251 markers_[i]->DeleteAndReplaceWith(NULL); |
| 241 } | 252 } |
| 242 } | 253 } |
| 243 | 254 |
| 244 } } // namespace v8::internal | 255 } } // namespace v8::internal |
| OLD | NEW |