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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #if defined(V8_TARGET_ARCH_X64) | 30 #if defined(V8_TARGET_ARCH_X64) |
31 | 31 |
32 #include "x64/lithium-gap-resolver-x64.h" | 32 #include "x64/lithium-gap-resolver-x64.h" |
33 #include "x64/lithium-codegen-x64.h" | 33 #include "x64/lithium-codegen-x64.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 LGapResolver::LGapResolver(LCodeGen* owner) | 38 LGapResolver::LGapResolver(LCodeGen* owner) |
39 : cgen_(owner), moves_(32) {} | 39 : cgen_(owner), moves_(32, owner->zone()) {} |
40 | 40 |
41 | 41 |
42 void LGapResolver::Resolve(LParallelMove* parallel_move) { | 42 void LGapResolver::Resolve(LParallelMove* parallel_move) { |
43 ASSERT(moves_.is_empty()); | 43 ASSERT(moves_.is_empty()); |
44 // Build up a worklist of moves. | 44 // Build up a worklist of moves. |
45 BuildInitialMoveList(parallel_move); | 45 BuildInitialMoveList(parallel_move); |
46 | 46 |
47 for (int i = 0; i < moves_.length(); ++i) { | 47 for (int i = 0; i < moves_.length(); ++i) { |
48 LMoveOperands move = moves_[i]; | 48 LMoveOperands move = moves_[i]; |
49 // Skip constants to perform them last. They don't block other moves | 49 // Skip constants to perform them last. They don't block other moves |
(...skipping 17 matching lines...) Expand all Loading... |
67 | 67 |
68 | 68 |
69 void LGapResolver::BuildInitialMoveList(LParallelMove* parallel_move) { | 69 void LGapResolver::BuildInitialMoveList(LParallelMove* parallel_move) { |
70 // Perform a linear sweep of the moves to add them to the initial list of | 70 // Perform a linear sweep of the moves to add them to the initial list of |
71 // moves to perform, ignoring any move that is redundant (the source is | 71 // moves to perform, ignoring any move that is redundant (the source is |
72 // the same as the destination, the destination is ignored and | 72 // the same as the destination, the destination is ignored and |
73 // unallocated, or the move was already eliminated). | 73 // unallocated, or the move was already eliminated). |
74 const ZoneList<LMoveOperands>* moves = parallel_move->move_operands(); | 74 const ZoneList<LMoveOperands>* moves = parallel_move->move_operands(); |
75 for (int i = 0; i < moves->length(); ++i) { | 75 for (int i = 0; i < moves->length(); ++i) { |
76 LMoveOperands move = moves->at(i); | 76 LMoveOperands move = moves->at(i); |
77 if (!move.IsRedundant()) moves_.Add(move); | 77 if (!move.IsRedundant()) moves_.Add(move, cgen_->zone()); |
78 } | 78 } |
79 Verify(); | 79 Verify(); |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 void LGapResolver::PerformMove(int index) { | 83 void LGapResolver::PerformMove(int index) { |
84 // Each call to this function performs a move and deletes it from the move | 84 // Each call to this function performs a move and deletes it from the move |
85 // graph. We first recursively perform any move blocking this one. We | 85 // graph. We first recursively perform any move blocking this one. We |
86 // mark a move as "pending" on entry to PerformMove in order to detect | 86 // mark a move as "pending" on entry to PerformMove in order to detect |
87 // cycles in the move graph. We use operand swaps to resolve cycles, | 87 // cycles in the move graph. We use operand swaps to resolve cycles, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 moves_[i].set_source(source); | 313 moves_[i].set_source(source); |
314 } | 314 } |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 #undef __ | 318 #undef __ |
319 | 319 |
320 } } // namespace v8::internal | 320 } } // namespace v8::internal |
321 | 321 |
322 #endif // V8_TARGET_ARCH_X64 | 322 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |