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