| 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 20 matching lines...) Expand all Loading... |
| 31 // The original source code covered by the above license above has been | 31 // The original source code covered by the above license above has been |
| 32 // modified significantly by Google Inc. | 32 // modified significantly by Google Inc. |
| 33 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 33 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 34 | 34 |
| 35 // A light-weight IA32 Assembler. | 35 // A light-weight IA32 Assembler. |
| 36 | 36 |
| 37 #ifndef V8_IA32_ASSEMBLER_IA32_INL_H_ | 37 #ifndef V8_IA32_ASSEMBLER_IA32_INL_H_ |
| 38 #define V8_IA32_ASSEMBLER_IA32_INL_H_ | 38 #define V8_IA32_ASSEMBLER_IA32_INL_H_ |
| 39 | 39 |
| 40 #include "cpu.h" | 40 #include "cpu.h" |
| 41 #include "debug.h" |
| 41 | 42 |
| 42 namespace v8 { | 43 namespace v8 { |
| 43 namespace internal { | 44 namespace internal { |
| 44 | 45 |
| 45 Condition NegateCondition(Condition cc) { | 46 Condition NegateCondition(Condition cc) { |
| 46 return static_cast<Condition>(cc ^ 1); | 47 return static_cast<Condition>(cc ^ 1); |
| 47 } | 48 } |
| 48 | 49 |
| 49 | 50 |
| 50 // The modes possibly affected by apply must be in kApplyMask. | 51 // The modes possibly affected by apply must be in kApplyMask. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 return Assembler::target_address_at(pc_); | 71 return Assembler::target_address_at(pc_); |
| 71 } | 72 } |
| 72 | 73 |
| 73 | 74 |
| 74 Address RelocInfo::target_address_address() { | 75 Address RelocInfo::target_address_address() { |
| 75 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 76 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 76 return reinterpret_cast<Address>(pc_); | 77 return reinterpret_cast<Address>(pc_); |
| 77 } | 78 } |
| 78 | 79 |
| 79 | 80 |
| 81 int RelocInfo::target_address_size() { |
| 82 return Assembler::kExternalTargetSize; |
| 83 } |
| 84 |
| 85 |
| 80 void RelocInfo::set_target_address(Address target) { | 86 void RelocInfo::set_target_address(Address target) { |
| 81 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 87 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 82 Assembler::set_target_address_at(pc_, target); | 88 Assembler::set_target_address_at(pc_, target); |
| 83 } | 89 } |
| 84 | 90 |
| 85 | 91 |
| 86 Object* RelocInfo::target_object() { | 92 Object* RelocInfo::target_object() { |
| 87 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 93 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 88 return Memory::Object_at(pc_); | 94 return Memory::Object_at(pc_); |
| 89 } | 95 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 ASSERT(IsPatchedReturnSequence()); | 147 ASSERT(IsPatchedReturnSequence()); |
| 142 *call_object_address() = target; | 148 *call_object_address() = target; |
| 143 } | 149 } |
| 144 | 150 |
| 145 | 151 |
| 146 bool RelocInfo::IsPatchedReturnSequence() { | 152 bool RelocInfo::IsPatchedReturnSequence() { |
| 147 return *pc_ == 0xE8; | 153 return *pc_ == 0xE8; |
| 148 } | 154 } |
| 149 | 155 |
| 150 | 156 |
| 157 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 158 RelocInfo::Mode mode = rmode(); |
| 159 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 160 visitor->VisitPointer(target_object_address()); |
| 161 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 162 visitor->VisitCodeTarget(this); |
| 163 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 164 visitor->VisitExternalReference(target_reference_address()); |
| 165 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 166 } else if (Debug::has_break_points() && |
| 167 RelocInfo::IsJSReturn(mode) && |
| 168 IsPatchedReturnSequence()) { |
| 169 visitor->VisitDebugTarget(this); |
| 170 #endif |
| 171 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 172 visitor->VisitRuntimeEntry(this); |
| 173 } |
| 174 } |
| 175 |
| 176 |
| 151 Immediate::Immediate(int x) { | 177 Immediate::Immediate(int x) { |
| 152 x_ = x; | 178 x_ = x; |
| 153 rmode_ = RelocInfo::NONE; | 179 rmode_ = RelocInfo::NONE; |
| 154 } | 180 } |
| 155 | 181 |
| 156 | 182 |
| 157 Immediate::Immediate(const ExternalReference& ext) { | 183 Immediate::Immediate(const ExternalReference& ext) { |
| 158 x_ = reinterpret_cast<int32_t>(ext.address()); | 184 x_ = reinterpret_cast<int32_t>(ext.address()); |
| 159 rmode_ = RelocInfo::EXTERNAL_REFERENCE; | 185 rmode_ = RelocInfo::EXTERNAL_REFERENCE; |
| 160 } | 186 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 343 |
| 318 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 344 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
| 319 // [disp/r] | 345 // [disp/r] |
| 320 set_modrm(0, ebp); | 346 set_modrm(0, ebp); |
| 321 set_dispr(disp, rmode); | 347 set_dispr(disp, rmode); |
| 322 } | 348 } |
| 323 | 349 |
| 324 } } // namespace v8::internal | 350 } } // namespace v8::internal |
| 325 | 351 |
| 326 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 352 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
| OLD | NEW |