OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 | 1375 |
1376 | 1376 |
1377 void HGlobalValueNumberer::ComputeBlockSideEffects() { | 1377 void HGlobalValueNumberer::ComputeBlockSideEffects() { |
1378 for (int i = graph_->blocks()->length() - 1; i >= 0; --i) { | 1378 for (int i = graph_->blocks()->length() - 1; i >= 0; --i) { |
1379 // Compute side effects for the block. | 1379 // Compute side effects for the block. |
1380 HBasicBlock* block = graph_->blocks()->at(i); | 1380 HBasicBlock* block = graph_->blocks()->at(i); |
1381 HInstruction* instr = block->first(); | 1381 HInstruction* instr = block->first(); |
1382 int id = block->block_id(); | 1382 int id = block->block_id(); |
1383 int side_effects = 0; | 1383 int side_effects = 0; |
1384 while (instr != NULL) { | 1384 while (instr != NULL) { |
1385 side_effects |= (instr->flags() & HValue::ChangesFlagsMask()); | 1385 side_effects |= instr->ChangesFlags(); |
1386 instr = instr->next(); | 1386 instr = instr->next(); |
1387 } | 1387 } |
1388 block_side_effects_[id] |= side_effects; | 1388 block_side_effects_[id] |= side_effects; |
1389 | 1389 |
1390 // Loop headers are part of their loop. | 1390 // Loop headers are part of their loop. |
1391 if (block->IsLoopHeader()) { | 1391 if (block->IsLoopHeader()) { |
1392 loop_side_effects_[id] |= side_effects; | 1392 loop_side_effects_[id] |= side_effects; |
1393 } | 1393 } |
1394 | 1394 |
1395 // Propagate loop side effects upwards. | 1395 // Propagate loop side effects upwards. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 | 1492 |
1493 // If this is a loop header kill everything killed by the loop. | 1493 // If this is a loop header kill everything killed by the loop. |
1494 if (block->IsLoopHeader()) { | 1494 if (block->IsLoopHeader()) { |
1495 map->Kill(loop_side_effects_[block->block_id()]); | 1495 map->Kill(loop_side_effects_[block->block_id()]); |
1496 } | 1496 } |
1497 | 1497 |
1498 // Go through all instructions of the current block. | 1498 // Go through all instructions of the current block. |
1499 HInstruction* instr = block->first(); | 1499 HInstruction* instr = block->first(); |
1500 while (instr != NULL) { | 1500 while (instr != NULL) { |
1501 HInstruction* next = instr->next(); | 1501 HInstruction* next = instr->next(); |
1502 int flags = (instr->flags() & HValue::ChangesFlagsMask()); | 1502 int flags = instr->ChangesFlags(); |
1503 if (flags != 0) { | 1503 if (flags != 0) { |
1504 ASSERT(!instr->CheckFlag(HValue::kUseGVN)); | 1504 ASSERT(!instr->CheckFlag(HValue::kUseGVN)); |
1505 // Clear all instructions in the map that are affected by side effects. | 1505 // Clear all instructions in the map that are affected by side effects. |
1506 map->Kill(flags); | 1506 map->Kill(flags); |
1507 TraceGVN("Instruction %d kills\n", instr->id()); | 1507 TraceGVN("Instruction %d kills\n", instr->id()); |
1508 } else if (instr->CheckFlag(HValue::kUseGVN)) { | 1508 } else if (instr->CheckFlag(HValue::kUseGVN)) { |
1509 HValue* other = map->Lookup(instr); | 1509 HValue* other = map->Lookup(instr); |
1510 if (other != NULL) { | 1510 if (other != NULL) { |
1511 ASSERT(instr->Equals(other) && other->Equals(instr)); | 1511 ASSERT(instr->Equals(other) && other->Equals(instr)); |
1512 TraceGVN("Replacing value %d (%s) with value %d (%s)\n", | 1512 TraceGVN("Replacing value %d (%s) with value %d (%s)\n", |
(...skipping 5250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6763 } | 6763 } |
6764 } | 6764 } |
6765 | 6765 |
6766 #ifdef DEBUG | 6766 #ifdef DEBUG |
6767 if (graph_ != NULL) graph_->Verify(); | 6767 if (graph_ != NULL) graph_->Verify(); |
6768 if (allocator_ != NULL) allocator_->Verify(); | 6768 if (allocator_ != NULL) allocator_->Verify(); |
6769 #endif | 6769 #endif |
6770 } | 6770 } |
6771 | 6771 |
6772 } } // namespace v8::internal | 6772 } } // namespace v8::internal |
OLD | NEW |