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 5421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5432 // Transitively mark all inputs of live instructions live. | 5432 // Transitively mark all inputs of live instructions live. |
5433 while (!worklist.is_empty()) { | 5433 while (!worklist.is_empty()) { |
5434 HValue* instr = worklist.RemoveLast(); | 5434 HValue* instr = worklist.RemoveLast(); |
5435 for (int i = 0; i < instr->OperandCount(); ++i) { | 5435 for (int i = 0; i < instr->OperandCount(); ++i) { |
5436 MarkLive(instr, instr->OperandAt(i), &worklist); | 5436 MarkLive(instr, instr->OperandAt(i), &worklist); |
5437 } | 5437 } |
5438 } | 5438 } |
5439 } | 5439 } |
5440 | 5440 |
5441 | 5441 |
5442 void HGraph::MarkLive(HValue *ref, HValue* instr, | 5442 void HGraph::MarkLive(HValue* ref, HValue* instr, ZoneList<HValue*>* worklist) { |
5443 ZoneList<HValue*>* worklist) { | |
5444 if (!instr->CheckFlag(HValue::kIsLive)) { | 5443 if (!instr->CheckFlag(HValue::kIsLive)) { |
5445 instr->SetFlag(HValue::kIsLive); | 5444 instr->SetFlag(HValue::kIsLive); |
5446 worklist->Add(instr, zone()); | 5445 worklist->Add(instr, zone()); |
5447 | 5446 |
5448 if (FLAG_trace_dead_code_elimination) { | 5447 if (FLAG_trace_dead_code_elimination) { |
5449 HeapStringAllocator allocator; | 5448 HeapStringAllocator allocator; |
5450 StringStream stream(&allocator); | 5449 StringStream stream(&allocator); |
| 5450 ALLOW_HANDLE_DEREF(isolate(), "debug mode printing"); |
5451 if (ref != NULL) { | 5451 if (ref != NULL) { |
5452 ref->PrintTo(&stream); | 5452 ref->PrintTo(&stream); |
5453 } else { | 5453 } else { |
5454 stream.Add("root "); | 5454 stream.Add("root "); |
5455 } | 5455 } |
5456 stream.Add(" -> "); | 5456 stream.Add(" -> "); |
5457 instr->PrintTo(&stream); | 5457 instr->PrintTo(&stream); |
5458 PrintF("[MarkLive %s]\n", *stream.ToCString()); | 5458 PrintF("[MarkLive %s]\n", *stream.ToCString()); |
5459 } | 5459 } |
5460 } | 5460 } |
(...skipping 4861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10322 if (!ShiftAmountsAllowReplaceByRotate(shl->right(), shr->right()) && | 10322 if (!ShiftAmountsAllowReplaceByRotate(shl->right(), shr->right()) && |
10323 !ShiftAmountsAllowReplaceByRotate(shr->right(), shl->right())) { | 10323 !ShiftAmountsAllowReplaceByRotate(shr->right(), shl->right())) { |
10324 return false; | 10324 return false; |
10325 } | 10325 } |
10326 *operand= shr->left(); | 10326 *operand= shr->left(); |
10327 *shift_amount = shr->right(); | 10327 *shift_amount = shr->right(); |
10328 return true; | 10328 return true; |
10329 } | 10329 } |
10330 | 10330 |
10331 | 10331 |
10332 bool CanBeZero(HValue *right) { | 10332 bool CanBeZero(HValue* right) { |
10333 if (right->IsConstant()) { | 10333 if (right->IsConstant()) { |
10334 HConstant* right_const = HConstant::cast(right); | 10334 HConstant* right_const = HConstant::cast(right); |
10335 if (right_const->HasInteger32Value() && | 10335 if (right_const->HasInteger32Value() && |
10336 (right_const->Integer32Value() & 0x1f) != 0) { | 10336 (right_const->Integer32Value() & 0x1f) != 0) { |
10337 return false; | 10337 return false; |
10338 } | 10338 } |
10339 } | 10339 } |
10340 return true; | 10340 return true; |
10341 } | 10341 } |
10342 | 10342 |
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12457 } | 12457 } |
12458 } | 12458 } |
12459 | 12459 |
12460 #ifdef DEBUG | 12460 #ifdef DEBUG |
12461 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12461 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
12462 if (allocator_ != NULL) allocator_->Verify(); | 12462 if (allocator_ != NULL) allocator_->Verify(); |
12463 #endif | 12463 #endif |
12464 } | 12464 } |
12465 | 12465 |
12466 } } // namespace v8::internal | 12466 } } // namespace v8::internal |
OLD | NEW |