| 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 | 45 | 
| 46 Condition NegateCondition(Condition cc) { | 46 Condition NegateCondition(Condition cc) { | 
| 47   return static_cast<Condition>(cc ^ 1); | 47   return static_cast<Condition>(cc ^ 1); | 
| 48 } | 48 } | 
| 49 | 49 | 
| 50 | 50 | 
| 51 // The modes possibly affected by apply must be in kApplyMask. | 51 // The modes possibly affected by apply must be in kApplyMask. | 
| 52 void RelocInfo::apply(intptr_t delta) { | 52 void RelocInfo::apply(intptr_t delta) { | 
| 53   if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { | 53   if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { | 
| 54     int32_t* p = reinterpret_cast<int32_t*>(pc_); | 54     int32_t* p = reinterpret_cast<int32_t*>(pc_); | 
| 55     *p -= delta;  // relocate entry | 55     *p -= delta;  // Relocate entry. | 
| 56   } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) { | 56   } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) { | 
| 57     // Special handling of js_return when a break point is set (call | 57     // Special handling of js_return when a break point is set (call | 
| 58     // instruction has been inserted). | 58     // instruction has been inserted). | 
| 59     int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); | 59     int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); | 
| 60     *p -= delta;  // relocate entry | 60     *p -= delta;  // Relocate entry. | 
|  | 61   } else if (rmode_ == DEBUG_BREAK_SLOT && IsPatchedDebugBreakSlotSequence()) { | 
|  | 62     // Special handling of a debug break slot when a break point is set (call | 
|  | 63     // instruction has been inserted). | 
|  | 64     int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); | 
|  | 65     *p -= delta;  // Relocate entry. | 
| 61   } else if (IsInternalReference(rmode_)) { | 66   } else if (IsInternalReference(rmode_)) { | 
| 62     // absolute code pointer inside code object moves with the code object. | 67     // absolute code pointer inside code object moves with the code object. | 
| 63     int32_t* p = reinterpret_cast<int32_t*>(pc_); | 68     int32_t* p = reinterpret_cast<int32_t*>(pc_); | 
| 64     *p += delta;  // relocate entry | 69     *p += delta;  // Relocate entry. | 
| 65   } | 70   } | 
| 66 } | 71 } | 
| 67 | 72 | 
| 68 | 73 | 
| 69 Address RelocInfo::target_address() { | 74 Address RelocInfo::target_address() { | 
| 70   ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 75   ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 
| 71   return Assembler::target_address_at(pc_); | 76   return Assembler::target_address_at(pc_); | 
| 72 } | 77 } | 
| 73 | 78 | 
| 74 | 79 | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 147   ASSERT(IsPatchedReturnSequence()); | 152   ASSERT(IsPatchedReturnSequence()); | 
| 148   *call_object_address() = target; | 153   *call_object_address() = target; | 
| 149 } | 154 } | 
| 150 | 155 | 
| 151 | 156 | 
| 152 bool RelocInfo::IsPatchedReturnSequence() { | 157 bool RelocInfo::IsPatchedReturnSequence() { | 
| 153   return *pc_ == 0xE8; | 158   return *pc_ == 0xE8; | 
| 154 } | 159 } | 
| 155 | 160 | 
| 156 | 161 | 
|  | 162 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 
|  | 163   return !Assembler::IsNop(pc()); | 
|  | 164 } | 
|  | 165 | 
|  | 166 | 
| 157 void RelocInfo::Visit(ObjectVisitor* visitor) { | 167 void RelocInfo::Visit(ObjectVisitor* visitor) { | 
| 158   RelocInfo::Mode mode = rmode(); | 168   RelocInfo::Mode mode = rmode(); | 
| 159   if (mode == RelocInfo::EMBEDDED_OBJECT) { | 169   if (mode == RelocInfo::EMBEDDED_OBJECT) { | 
| 160     visitor->VisitPointer(target_object_address()); | 170     visitor->VisitPointer(target_object_address()); | 
| 161   } else if (RelocInfo::IsCodeTarget(mode)) { | 171   } else if (RelocInfo::IsCodeTarget(mode)) { | 
| 162     visitor->VisitCodeTarget(this); | 172     visitor->VisitCodeTarget(this); | 
| 163   } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 173   } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 
| 164     visitor->VisitExternalReference(target_reference_address()); | 174     visitor->VisitExternalReference(target_reference_address()); | 
| 165 #ifdef ENABLE_DEBUGGER_SUPPORT | 175 #ifdef ENABLE_DEBUGGER_SUPPORT | 
| 166   } else if (Debug::has_break_points() && | 176   } else if (Debug::has_break_points() && | 
| 167              RelocInfo::IsJSReturn(mode) && | 177              (RelocInfo::IsJSReturn(mode) && | 
| 168              IsPatchedReturnSequence()) { | 178               IsPatchedReturnSequence()) || | 
|  | 179              (RelocInfo::IsDebugBreakSlot(mode) && | 
|  | 180               IsPatchedDebugBreakSlotSequence())) { | 
| 169     visitor->VisitDebugTarget(this); | 181     visitor->VisitDebugTarget(this); | 
| 170 #endif | 182 #endif | 
| 171   } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 183   } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 
| 172     visitor->VisitRuntimeEntry(this); | 184     visitor->VisitRuntimeEntry(this); | 
| 173   } | 185   } | 
| 174 } | 186 } | 
| 175 | 187 | 
| 176 | 188 | 
| 177 Immediate::Immediate(int x)  { | 189 Immediate::Immediate(int x)  { | 
| 178   x_ = x; | 190   x_ = x; | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 343 | 355 | 
| 344 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 356 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 
| 345   // [disp/r] | 357   // [disp/r] | 
| 346   set_modrm(0, ebp); | 358   set_modrm(0, ebp); | 
| 347   set_dispr(disp, rmode); | 359   set_dispr(disp, rmode); | 
| 348 } | 360 } | 
| 349 | 361 | 
| 350 } }  // namespace v8::internal | 362 } }  // namespace v8::internal | 
| 351 | 363 | 
| 352 #endif  // V8_IA32_ASSEMBLER_IA32_INL_H_ | 364 #endif  // V8_IA32_ASSEMBLER_IA32_INL_H_ | 
| OLD | NEW | 
|---|