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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 cgen_->allocator()->Use(reg()); | 65 cgen_->allocator()->Use(reg()); |
66 } else if (is_constant()) { | 66 } else if (is_constant()) { |
67 destination->data_.handle_ = data_.handle_; | 67 destination->data_.handle_ = data_.handle_; |
68 } else { | 68 } else { |
69 ASSERT(!is_valid()); | 69 ASSERT(!is_valid()); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 // ------------------------------------------------------------------------- | 74 // ------------------------------------------------------------------------- |
75 // RegisterFile implementation. | |
76 | |
77 void RegisterFile::CopyTo(RegisterFile* other) { | |
78 for (int i = 0; i < kNumRegisters; i++) { | |
79 other->ref_counts_[i] = ref_counts_[i]; | |
80 } | |
81 } | |
82 | |
83 | |
84 // ------------------------------------------------------------------------- | |
85 // RegisterAllocator implementation. | 75 // RegisterAllocator implementation. |
86 | 76 |
87 | 77 |
88 Result RegisterAllocator::AllocateWithoutSpilling() { | 78 Result RegisterAllocator::AllocateWithoutSpilling() { |
89 // Return the first free register, if any. | 79 // Return the first free register, if any. |
90 int free_reg = registers_.ScanForFreeRegister(); | 80 int free_reg = registers_.ScanForFreeRegister(); |
91 if (free_reg < kNumRegisters) { | 81 if (free_reg < kNumRegisters) { |
92 Register free_result = { free_reg }; | 82 Register free_result = { free_reg }; |
93 return Result(free_result, cgen_); | 83 return Result(free_result, cgen_); |
94 } | 84 } |
(...skipping 28 matching lines...) Expand all Loading... |
123 cgen_->frame()->Spill(target); | 113 cgen_->frame()->Spill(target); |
124 ASSERT(!is_used(target)); | 114 ASSERT(!is_used(target)); |
125 return Result(target, cgen_); | 115 return Result(target, cgen_); |
126 } | 116 } |
127 // Otherwise (if it's referenced outside the frame) we cannot allocate it. | 117 // Otherwise (if it's referenced outside the frame) we cannot allocate it. |
128 return Result(cgen_); | 118 return Result(cgen_); |
129 } | 119 } |
130 | 120 |
131 | 121 |
132 } } // namespace v8::internal | 122 } } // namespace v8::internal |
OLD | NEW |