| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal); | 68 CodeGeneratorScope::Current()->unsafe_bailout_->Branch(equal); |
| 69 CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal); | 69 CodeGeneratorScope::Current()->unsafe_bailout_->Branch(not_equal); |
| 70 } | 70 } |
| 71 } else if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) { | 71 } else if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) { |
| 72 CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle()); | 72 CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle()); |
| 73 } else { | 73 } else { |
| 74 CodeGeneratorScope::Current()->masm()->Set(fresh.reg(), | 74 CodeGeneratorScope::Current()->masm()->Set(fresh.reg(), |
| 75 Immediate(handle())); | 75 Immediate(handle())); |
| 76 } | 76 } |
| 77 // This result becomes a copy of the fresh one. | 77 // This result becomes a copy of the fresh one. |
| 78 fresh.set_number_info(number_info()); | 78 fresh.set_type_info(type_info()); |
| 79 *this = fresh; | 79 *this = fresh; |
| 80 } | 80 } |
| 81 ASSERT(is_register()); | 81 ASSERT(is_register()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 void Result::ToRegister(Register target) { | 85 void Result::ToRegister(Register target) { |
| 86 ASSERT(is_valid()); | 86 ASSERT(is_valid()); |
| 87 if (!is_register() || !reg().is(target)) { | 87 if (!is_register() || !reg().is(target)) { |
| 88 Result fresh = CodeGeneratorScope::Current()->allocator()->Allocate(target); | 88 Result fresh = CodeGeneratorScope::Current()->allocator()->Allocate(target); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 115 } | 115 } |
| 116 } else { | 116 } else { |
| 117 if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) { | 117 if (CodeGeneratorScope::Current()->IsUnsafeSmi(handle())) { |
| 118 CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle()); | 118 CodeGeneratorScope::Current()->MoveUnsafeSmi(fresh.reg(), handle()); |
| 119 } else { | 119 } else { |
| 120 CodeGeneratorScope::Current()->masm()->Set(fresh.reg(), | 120 CodeGeneratorScope::Current()->masm()->Set(fresh.reg(), |
| 121 Immediate(handle())); | 121 Immediate(handle())); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 fresh.set_number_info(number_info()); | 125 fresh.set_type_info(type_info()); |
| 126 fresh.set_untagged_int32(is_untagged_int32()); | 126 fresh.set_untagged_int32(is_untagged_int32()); |
| 127 *this = fresh; | 127 *this = fresh; |
| 128 } else if (is_register() && reg().is(target)) { | 128 } else if (is_register() && reg().is(target)) { |
| 129 ASSERT(CodeGeneratorScope::Current()->has_valid_frame()); | 129 ASSERT(CodeGeneratorScope::Current()->has_valid_frame()); |
| 130 CodeGeneratorScope::Current()->frame()->Spill(target); | 130 CodeGeneratorScope::Current()->frame()->Spill(target); |
| 131 ASSERT(CodeGeneratorScope::Current()->allocator()->count(target) == 1); | 131 ASSERT(CodeGeneratorScope::Current()->allocator()->count(target) == 1); |
| 132 } | 132 } |
| 133 ASSERT(is_register()); | 133 ASSERT(is_register()); |
| 134 ASSERT(reg().is(target)); | 134 ASSERT(reg().is(target)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 | 137 |
| 138 // ------------------------------------------------------------------------- | 138 // ------------------------------------------------------------------------- |
| 139 // RegisterAllocator implementation. | 139 // RegisterAllocator implementation. |
| 140 | 140 |
| 141 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { | 141 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { |
| 142 Result result = AllocateWithoutSpilling(); | 142 Result result = AllocateWithoutSpilling(); |
| 143 // Check that the register is a byte register. If not, unuse the | 143 // Check that the register is a byte register. If not, unuse the |
| 144 // register if valid and return an invalid result. | 144 // register if valid and return an invalid result. |
| 145 if (result.is_valid() && !result.reg().is_byte_register()) { | 145 if (result.is_valid() && !result.reg().is_byte_register()) { |
| 146 result.Unuse(); | 146 result.Unuse(); |
| 147 return Result(); | 147 return Result(); |
| 148 } | 148 } |
| 149 return result; | 149 return result; |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 } } // namespace v8::internal | 153 } } // namespace v8::internal |
| OLD | NEW |