OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 Condition NegateCondition(Condition cc) { | 44 Condition NegateCondition(Condition cc) { |
45 return static_cast<Condition>(cc ^ 1); | 45 return static_cast<Condition>(cc ^ 1); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 // The modes possibly affected by apply must be in kApplyMask. | 49 // The modes possibly affected by apply must be in kApplyMask. |
50 void RelocInfo::apply(int delta) { | 50 void RelocInfo::apply(int delta) { |
51 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { | 51 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { |
52 int32_t* p = reinterpret_cast<int32_t*>(pc_); | 52 int32_t* p = reinterpret_cast<int32_t*>(pc_); |
53 *p -= delta; // relocate entry | 53 *p -= delta; // relocate entry |
54 } else if (rmode_ == JS_RETURN && is_call_instruction()) { | 54 } else if (rmode_ == JS_RETURN && IsCallInstruction()) { |
55 // Special handling of js_return when a break point is set (call | 55 // Special handling of js_return when a break point is set (call |
56 // instruction has been inserted). | 56 // instruction has been inserted). |
57 int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); | 57 int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); |
58 *p -= delta; // relocate entry | 58 *p -= delta; // relocate entry |
59 } else if (IsInternalReference(rmode_)) { | 59 } else if (IsInternalReference(rmode_)) { |
60 // absolute code pointer inside code object moves with the code object. | 60 // absolute code pointer inside code object moves with the code object. |
61 int32_t* p = reinterpret_cast<int32_t*>(pc_); | 61 int32_t* p = reinterpret_cast<int32_t*>(pc_); |
62 *p += delta; // relocate entry | 62 *p += delta; // relocate entry |
63 } | 63 } |
64 } | 64 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 Address* RelocInfo::target_reference_address() { | 103 Address* RelocInfo::target_reference_address() { |
104 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 104 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
105 return reinterpret_cast<Address*>(pc_); | 105 return reinterpret_cast<Address*>(pc_); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 Address RelocInfo::call_address() { | 109 Address RelocInfo::call_address() { |
110 ASSERT(is_call_instruction()); | 110 ASSERT(IsCallInstruction()); |
111 return Assembler::target_address_at(pc_ + 1); | 111 return Assembler::target_address_at(pc_ + 1); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 void RelocInfo::set_call_address(Address target) { | 115 void RelocInfo::set_call_address(Address target) { |
116 ASSERT(is_call_instruction()); | 116 ASSERT(IsCallInstruction()); |
117 Assembler::set_target_address_at(pc_ + 1, target); | 117 Assembler::set_target_address_at(pc_ + 1, target); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 Object* RelocInfo::call_object() { | 121 Object* RelocInfo::call_object() { |
122 ASSERT(is_call_instruction()); | 122 ASSERT(IsCallInstruction()); |
123 return *call_object_address(); | 123 return *call_object_address(); |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 Object** RelocInfo::call_object_address() { | 127 Object** RelocInfo::call_object_address() { |
128 ASSERT(is_call_instruction()); | 128 ASSERT(IsCallInstruction()); |
129 return reinterpret_cast<Object**>(pc_ + 1); | 129 return reinterpret_cast<Object**>(pc_ + 1); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 void RelocInfo::set_call_object(Object* target) { | 133 void RelocInfo::set_call_object(Object* target) { |
134 ASSERT(is_call_instruction()); | 134 ASSERT(IsCallInstruction()); |
135 *call_object_address() = target; | 135 *call_object_address() = target; |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 bool RelocInfo::is_call_instruction() { | 139 bool RelocInfo::IsCallInstruction() { |
140 return *pc_ == 0xE8; | 140 return *pc_ == 0xE8; |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 Immediate::Immediate(int x) { | 144 Immediate::Immediate(int x) { |
145 x_ = x; | 145 x_ = x; |
146 rmode_ = RelocInfo::NONE; | 146 rmode_ = RelocInfo::NONE; |
147 } | 147 } |
148 | 148 |
149 | 149 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 293 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
294 // [disp/r] | 294 // [disp/r] |
295 set_modrm(0, ebp); | 295 set_modrm(0, ebp); |
296 set_dispr(disp, rmode); | 296 set_dispr(disp, rmode); |
297 } | 297 } |
298 | 298 |
299 } } // namespace v8::internal | 299 } } // namespace v8::internal |
300 | 300 |
301 #endif // V8_ASSEMBLER_IA32_INL_H_ | 301 #endif // V8_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |