| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 Memory::Object_at(pc_) = target; | 113 Memory::Object_at(pc_) = target; |
| 114 } | 114 } |
| 115 | 115 |
| 116 | 116 |
| 117 Address* RelocInfo::target_reference_address() { | 117 Address* RelocInfo::target_reference_address() { |
| 118 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 118 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
| 119 return reinterpret_cast<Address*>(pc_); | 119 return reinterpret_cast<Address*>(pc_); |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
| 124 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 125 Address address = Memory::Address_at(pc_); |
| 126 return Handle<JSGlobalPropertyCell>( |
| 127 reinterpret_cast<JSGlobalPropertyCell**>(address)); |
| 128 } |
| 129 |
| 130 |
| 131 JSGlobalPropertyCell* RelocInfo::target_cell() { |
| 132 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 133 Address address = Memory::Address_at(pc_); |
| 134 Object* object = HeapObject::FromAddress( |
| 135 address - JSGlobalPropertyCell::kValueOffset); |
| 136 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 137 } |
| 138 |
| 139 |
| 140 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { |
| 141 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 142 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 143 Memory::Address_at(pc_) = address; |
| 144 } |
| 145 |
| 146 |
| 123 Address RelocInfo::call_address() { | 147 Address RelocInfo::call_address() { |
| 124 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 148 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 125 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 149 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 126 return Assembler::target_address_at(pc_ + 1); | 150 return Assembler::target_address_at(pc_ + 1); |
| 127 } | 151 } |
| 128 | 152 |
| 129 | 153 |
| 130 void RelocInfo::set_call_address(Address target) { | 154 void RelocInfo::set_call_address(Address target) { |
| 131 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 155 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 132 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 156 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 160 return !Assembler::IsNop(pc()); | 184 return !Assembler::IsNop(pc()); |
| 161 } | 185 } |
| 162 | 186 |
| 163 | 187 |
| 164 void RelocInfo::Visit(ObjectVisitor* visitor) { | 188 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 165 RelocInfo::Mode mode = rmode(); | 189 RelocInfo::Mode mode = rmode(); |
| 166 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 190 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 167 visitor->VisitPointer(target_object_address()); | 191 visitor->VisitPointer(target_object_address()); |
| 168 } else if (RelocInfo::IsCodeTarget(mode)) { | 192 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 169 visitor->VisitCodeTarget(this); | 193 visitor->VisitCodeTarget(this); |
| 194 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 195 visitor->VisitGlobalPropertyCell(this); |
| 170 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 196 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 171 visitor->VisitExternalReference(target_reference_address()); | 197 visitor->VisitExternalReference(target_reference_address()); |
| 172 #ifdef ENABLE_DEBUGGER_SUPPORT | 198 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 173 // TODO(isolates): Get a cached isolate below. | 199 // TODO(isolates): Get a cached isolate below. |
| 174 } else if (((RelocInfo::IsJSReturn(mode) && | 200 } else if (((RelocInfo::IsJSReturn(mode) && |
| 175 IsPatchedReturnSequence()) || | 201 IsPatchedReturnSequence()) || |
| 176 (RelocInfo::IsDebugBreakSlot(mode) && | 202 (RelocInfo::IsDebugBreakSlot(mode) && |
| 177 IsPatchedDebugBreakSlotSequence())) && | 203 IsPatchedDebugBreakSlotSequence())) && |
| 178 Isolate::Current()->debug()->has_break_points()) { | 204 Isolate::Current()->debug()->has_break_points()) { |
| 179 visitor->VisitDebugTarget(this); | 205 visitor->VisitDebugTarget(this); |
| 180 #endif | 206 #endif |
| 181 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 207 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 182 visitor->VisitRuntimeEntry(this); | 208 visitor->VisitRuntimeEntry(this); |
| 183 } | 209 } |
| 184 } | 210 } |
| 185 | 211 |
| 186 | 212 |
| 187 template<typename StaticVisitor> | 213 template<typename StaticVisitor> |
| 188 void RelocInfo::Visit(Heap* heap) { | 214 void RelocInfo::Visit(Heap* heap) { |
| 189 RelocInfo::Mode mode = rmode(); | 215 RelocInfo::Mode mode = rmode(); |
| 190 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 216 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 191 StaticVisitor::VisitPointer(heap, target_object_address()); | 217 StaticVisitor::VisitPointer(heap, target_object_address()); |
| 192 } else if (RelocInfo::IsCodeTarget(mode)) { | 218 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 193 StaticVisitor::VisitCodeTarget(this); | 219 StaticVisitor::VisitCodeTarget(this); |
| 220 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 221 StaticVisitor::VisitGlobalPropertyCell(this); |
| 194 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 222 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 195 StaticVisitor::VisitExternalReference(target_reference_address()); | 223 StaticVisitor::VisitExternalReference(target_reference_address()); |
| 196 #ifdef ENABLE_DEBUGGER_SUPPORT | 224 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 197 } else if (heap->isolate()->debug()->has_break_points() && | 225 } else if (heap->isolate()->debug()->has_break_points() && |
| 198 ((RelocInfo::IsJSReturn(mode) && | 226 ((RelocInfo::IsJSReturn(mode) && |
| 199 IsPatchedReturnSequence()) || | 227 IsPatchedReturnSequence()) || |
| 200 (RelocInfo::IsDebugBreakSlot(mode) && | 228 (RelocInfo::IsDebugBreakSlot(mode) && |
| 201 IsPatchedDebugBreakSlotSequence()))) { | 229 IsPatchedDebugBreakSlotSequence()))) { |
| 202 StaticVisitor::VisitDebugTarget(this); | 230 StaticVisitor::VisitDebugTarget(this); |
| 203 #endif | 231 #endif |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 268 } |
| 241 } | 269 } |
| 242 | 270 |
| 243 | 271 |
| 244 Immediate::Immediate(Smi* value) { | 272 Immediate::Immediate(Smi* value) { |
| 245 x_ = reinterpret_cast<intptr_t>(value); | 273 x_ = reinterpret_cast<intptr_t>(value); |
| 246 rmode_ = RelocInfo::NONE; | 274 rmode_ = RelocInfo::NONE; |
| 247 } | 275 } |
| 248 | 276 |
| 249 | 277 |
| 278 Immediate::Immediate(Address addr) { |
| 279 x_ = reinterpret_cast<int32_t>(addr); |
| 280 rmode_ = RelocInfo::NONE; |
| 281 } |
| 282 |
| 283 |
| 250 void Assembler::emit(uint32_t x) { | 284 void Assembler::emit(uint32_t x) { |
| 251 *reinterpret_cast<uint32_t*>(pc_) = x; | 285 *reinterpret_cast<uint32_t*>(pc_) = x; |
| 252 pc_ += sizeof(uint32_t); | 286 pc_ += sizeof(uint32_t); |
| 253 } | 287 } |
| 254 | 288 |
| 255 | 289 |
| 256 void Assembler::emit(Handle<Object> handle) { | 290 void Assembler::emit(Handle<Object> handle) { |
| 257 // Verify all Objects referred by code are NOT in new space. | 291 // Verify all Objects referred by code are NOT in new space. |
| 258 Object* obj = *handle; | 292 Object* obj = *handle; |
| 259 ASSERT(!HEAP->InNewSpace(obj)); | 293 ASSERT(!HEAP->InNewSpace(obj)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 411 |
| 378 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 412 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
| 379 // [disp/r] | 413 // [disp/r] |
| 380 set_modrm(0, ebp); | 414 set_modrm(0, ebp); |
| 381 set_dispr(disp, rmode); | 415 set_dispr(disp, rmode); |
| 382 } | 416 } |
| 383 | 417 |
| 384 } } // namespace v8::internal | 418 } } // namespace v8::internal |
| 385 | 419 |
| 386 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 420 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
| OLD | NEW |