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