| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 // ------------------------------------------------------------------------- | 39 // ------------------------------------------------------------------------- |
| 40 // Result implementation. | 40 // Result implementation. |
| 41 | 41 |
| 42 void Result::ToRegister() { | 42 void Result::ToRegister() { |
| 43 ASSERT(is_valid()); | 43 ASSERT(is_valid()); |
| 44 if (is_constant()) { | 44 if (is_constant()) { |
| 45 Result fresh = CodeGeneratorScope::Current()->allocator()->Allocate(); | 45 CodeGenerator* code_generator = |
| 46 CodeGeneratorScope::Current(Isolate::Current()); |
| 47 Result fresh = code_generator->allocator()->Allocate(); |
| 46 ASSERT(fresh.is_valid()); | 48 ASSERT(fresh.is_valid()); |
| 47 CodeGeneratorScope::Current()->masm()->Move(fresh.reg(), handle()); | 49 code_generator->masm()->Move(fresh.reg(), handle()); |
| 48 // This result becomes a copy of the fresh one. | 50 // This result becomes a copy of the fresh one. |
| 49 fresh.set_type_info(type_info()); | 51 fresh.set_type_info(type_info()); |
| 50 *this = fresh; | 52 *this = fresh; |
| 51 } | 53 } |
| 52 ASSERT(is_register()); | 54 ASSERT(is_register()); |
| 53 } | 55 } |
| 54 | 56 |
| 55 | 57 |
| 56 void Result::ToRegister(Register target) { | 58 void Result::ToRegister(Register target) { |
| 57 ASSERT(is_valid()); | 59 ASSERT(is_valid()); |
| 60 CodeGenerator* code_generator = |
| 61 CodeGeneratorScope::Current(Isolate::Current()); |
| 58 if (!is_register() || !reg().is(target)) { | 62 if (!is_register() || !reg().is(target)) { |
| 59 Result fresh = CodeGeneratorScope::Current()->allocator()->Allocate(target); | 63 Result fresh = code_generator->allocator()->Allocate(target); |
| 60 ASSERT(fresh.is_valid()); | 64 ASSERT(fresh.is_valid()); |
| 61 if (is_register()) { | 65 if (is_register()) { |
| 62 CodeGeneratorScope::Current()->masm()->movq(fresh.reg(), reg()); | 66 code_generator->masm()->movq(fresh.reg(), reg()); |
| 63 } else { | 67 } else { |
| 64 ASSERT(is_constant()); | 68 ASSERT(is_constant()); |
| 65 CodeGeneratorScope::Current()->masm()->Move(fresh.reg(), handle()); | 69 code_generator->masm()->Move(fresh.reg(), handle()); |
| 66 } | 70 } |
| 67 fresh.set_type_info(type_info()); | 71 fresh.set_type_info(type_info()); |
| 68 *this = fresh; | 72 *this = fresh; |
| 69 } else if (is_register() && reg().is(target)) { | 73 } else if (is_register() && reg().is(target)) { |
| 70 ASSERT(CodeGeneratorScope::Current()->has_valid_frame()); | 74 ASSERT(code_generator->has_valid_frame()); |
| 71 CodeGeneratorScope::Current()->frame()->Spill(target); | 75 code_generator->frame()->Spill(target); |
| 72 ASSERT(CodeGeneratorScope::Current()->allocator()->count(target) == 1); | 76 ASSERT(code_generator->allocator()->count(target) == 1); |
| 73 } | 77 } |
| 74 ASSERT(is_register()); | 78 ASSERT(is_register()); |
| 75 ASSERT(reg().is(target)); | 79 ASSERT(reg().is(target)); |
| 76 } | 80 } |
| 77 | 81 |
| 78 | 82 |
| 79 // ------------------------------------------------------------------------- | 83 // ------------------------------------------------------------------------- |
| 80 // RegisterAllocator implementation. | 84 // RegisterAllocator implementation. |
| 81 | 85 |
| 82 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { | 86 Result RegisterAllocator::AllocateByteRegisterWithoutSpilling() { |
| 83 // This function is not used in 64-bit code. | 87 // This function is not used in 64-bit code. |
| 84 UNREACHABLE(); | 88 UNREACHABLE(); |
| 85 return Result(); | 89 return Result(); |
| 86 } | 90 } |
| 87 | 91 |
| 88 | 92 |
| 89 } } // namespace v8::internal | 93 } } // namespace v8::internal |
| 90 | 94 |
| 91 #endif // V8_TARGET_ARCH_X64 | 95 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |