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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 Condition NegateCondition(Condition cc) { | 45 Condition NegateCondition(Condition cc) { |
46 return static_cast<Condition>(cc ^ 1); | 46 return static_cast<Condition>(cc ^ 1); |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 // The modes possibly affected by apply must be in kApplyMask. | 50 // The modes possibly affected by apply must be in kApplyMask. |
51 void RelocInfo::apply(intptr_t delta) { | 51 void RelocInfo::apply(intptr_t delta) { |
52 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { | 52 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { |
53 int32_t* p = reinterpret_cast<int32_t*>(pc_); | 53 int32_t* p = reinterpret_cast<int32_t*>(pc_); |
54 *p -= delta; // relocate entry | 54 *p -= delta; // relocate entry |
55 } else if (rmode_ == JS_RETURN && IsCallInstruction()) { | 55 } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) { |
56 // Special handling of js_return when a break point is set (call | 56 // Special handling of js_return when a break point is set (call |
57 // instruction has been inserted). | 57 // instruction has been inserted). |
58 int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); | 58 int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); |
59 *p -= delta; // relocate entry | 59 *p -= delta; // relocate entry |
60 } else if (IsInternalReference(rmode_)) { | 60 } else if (IsInternalReference(rmode_)) { |
61 // absolute code pointer inside code object moves with the code object. | 61 // absolute code pointer inside code object moves with the code object. |
62 int32_t* p = reinterpret_cast<int32_t*>(pc_); | 62 int32_t* p = reinterpret_cast<int32_t*>(pc_); |
63 *p += delta; // relocate entry | 63 *p += delta; // relocate entry |
64 } | 64 } |
65 } | 65 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 Address* RelocInfo::target_reference_address() { | 110 Address* RelocInfo::target_reference_address() { |
111 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 111 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
112 return reinterpret_cast<Address*>(pc_); | 112 return reinterpret_cast<Address*>(pc_); |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 Address RelocInfo::call_address() { | 116 Address RelocInfo::call_address() { |
117 ASSERT(IsCallInstruction()); | 117 ASSERT(IsPatchedReturnSequence()); |
118 return Assembler::target_address_at(pc_ + 1); | 118 return Assembler::target_address_at(pc_ + 1); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 void RelocInfo::set_call_address(Address target) { | 122 void RelocInfo::set_call_address(Address target) { |
123 ASSERT(IsCallInstruction()); | 123 ASSERT(IsPatchedReturnSequence()); |
124 Assembler::set_target_address_at(pc_ + 1, target); | 124 Assembler::set_target_address_at(pc_ + 1, target); |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 Object* RelocInfo::call_object() { | 128 Object* RelocInfo::call_object() { |
129 ASSERT(IsCallInstruction()); | 129 ASSERT(IsPatchedReturnSequence()); |
130 return *call_object_address(); | 130 return *call_object_address(); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 Object** RelocInfo::call_object_address() { | 134 Object** RelocInfo::call_object_address() { |
135 ASSERT(IsCallInstruction()); | 135 ASSERT(IsPatchedReturnSequence()); |
136 return reinterpret_cast<Object**>(pc_ + 1); | 136 return reinterpret_cast<Object**>(pc_ + 1); |
137 } | 137 } |
138 | 138 |
139 | 139 |
140 void RelocInfo::set_call_object(Object* target) { | 140 void RelocInfo::set_call_object(Object* target) { |
141 ASSERT(IsCallInstruction()); | 141 ASSERT(IsPatchedReturnSequence()); |
142 *call_object_address() = target; | 142 *call_object_address() = target; |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 bool RelocInfo::IsCallInstruction() { | 146 bool RelocInfo::IsPatchedReturnSequence() { |
147 return *pc_ == 0xE8; | 147 return *pc_ == 0xE8; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 Immediate::Immediate(int x) { | 151 Immediate::Immediate(int x) { |
152 x_ = x; | 152 x_ = x; |
153 rmode_ = RelocInfo::NONE; | 153 rmode_ = RelocInfo::NONE; |
154 } | 154 } |
155 | 155 |
156 | 156 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 317 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
318 // [disp/r] | 318 // [disp/r] |
319 set_modrm(0, ebp); | 319 set_modrm(0, ebp); |
320 set_dispr(disp, rmode); | 320 set_dispr(disp, rmode); |
321 } | 321 } |
322 | 322 |
323 } } // namespace v8::internal | 323 } } // namespace v8::internal |
324 | 324 |
325 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 325 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |