OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 ASSERT(!is_used(free_reg)); | 77 ASSERT(!is_used(free_reg)); |
78 return Result(free_reg); | 78 return Result(free_reg); |
79 } | 79 } |
80 } | 80 } |
81 return result; | 81 return result; |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 Result RegisterAllocator::Allocate(Register target) { | 85 Result RegisterAllocator::Allocate(Register target) { |
86 // If the target is not referenced, it can simply be allocated. | 86 // If the target is not referenced, it can simply be allocated. |
87 if (!is_used(target)) { | 87 if (!is_used(RegisterAllocator::ToNumber(target))) { |
88 return Result(target); | 88 return Result(target); |
89 } | 89 } |
90 // If the target is only referenced in the frame, it can be spilled and | 90 // If the target is only referenced in the frame, it can be spilled and |
91 // then allocated. | 91 // then allocated. |
92 ASSERT(cgen_->has_valid_frame()); | 92 ASSERT(cgen_->has_valid_frame()); |
93 if (cgen_->frame()->is_used(target) && count(target) == 1) { | 93 if (cgen_->frame()->is_used(RegisterAllocator::ToNumber(target)) && count(targ
et) == 1) { |
94 cgen_->frame()->Spill(target); | 94 cgen_->frame()->Spill(target); |
95 ASSERT(!is_used(target)); | 95 ASSERT(!is_used(RegisterAllocator::ToNumber(target))); |
96 return Result(target); | 96 return Result(target); |
97 } | 97 } |
98 // Otherwise (if it's referenced outside the frame) we cannot allocate it. | 98 // Otherwise (if it's referenced outside the frame) we cannot allocate it. |
99 return Result(); | 99 return Result(); |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 } } // namespace v8::internal | 103 } } // namespace v8::internal |
OLD | NEW |