Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 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 2010 the V8 project authors. All rights reserved. | 33 // Copyright 2011 the V8 project authors. All rights reserved. |
| 34 | 34 |
| 35 | 35 |
| 36 #ifndef V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 36 #ifndef V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| 37 #define V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 37 #define V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| 38 | 38 |
| 39 #include "mips/assembler-mips.h" | 39 #include "mips/assembler-mips.h" |
| 40 #include "cpu.h" | 40 #include "cpu.h" |
| 41 #include "debug.h" | 41 #include "debug.h" |
| 42 | 42 |
| 43 | 43 |
| 44 namespace v8 { | 44 namespace v8 { |
| 45 namespace internal { | 45 namespace internal { |
| 46 | 46 |
| 47 // ----------------------------------------------------------------------------- | 47 // ----------------------------------------------------------------------------- |
| 48 // Operand and MemOperand | 48 // Operand and MemOperand. |
| 49 | 49 |
| 50 Operand::Operand(int32_t immediate, RelocInfo::Mode rmode) { | 50 Operand::Operand(int32_t immediate, RelocInfo::Mode rmode) { |
| 51 rm_ = no_reg; | 51 rm_ = no_reg; |
| 52 imm32_ = immediate; | 52 imm32_ = immediate; |
| 53 rmode_ = rmode; | 53 rmode_ = rmode; |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 Operand::Operand(const ExternalReference& f) { | 57 Operand::Operand(const ExternalReference& f) { |
| 58 rm_ = no_reg; | 58 rm_ = no_reg; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 73 } | 73 } |
| 74 | 74 |
| 75 | 75 |
| 76 bool Operand::is_reg() const { | 76 bool Operand::is_reg() const { |
| 77 return rm_.is_valid(); | 77 return rm_.is_valid(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 | 81 |
| 82 // ----------------------------------------------------------------------------- | 82 // ----------------------------------------------------------------------------- |
| 83 // RelocInfo | 83 // RelocInfo. |
| 84 | 84 |
| 85 void RelocInfo::apply(intptr_t delta) { | 85 void RelocInfo::apply(intptr_t delta) { |
| 86 // On MIPS we do not use pc relative addressing, so we don't need to patch the | 86 // On MIPS we do not use pc relative addressing, so we don't need to patch the |
| 87 // code here. | 87 // code here. |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 Address RelocInfo::target_address() { | 91 Address RelocInfo::target_address() { |
| 92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 93 return Assembler::target_address_at(pc_); | 93 return Assembler::target_address_at(pc_); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); | 247 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); |
| 248 } | 248 } |
| 249 | 249 |
| 250 | 250 |
| 251 void RelocInfo::Visit(ObjectVisitor* visitor) { | 251 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 252 RelocInfo::Mode mode = rmode(); | 252 RelocInfo::Mode mode = rmode(); |
| 253 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 253 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 254 // RelocInfo is needed when pointer must be updated/serialized, such as | 254 // RelocInfo is needed when pointer must be updated/serialized, such as |
| 255 // UpdatingVisitor in mark-compact.cc or Serializer in serialize.cc. | 255 // UpdatingVisitor in mark-compact.cc or Serializer in serialize.cc. |
| 256 // It is ignored by visitors that do not need it. | 256 // It is ignored by visitors that do not need it. |
| 257 // Commenting out, to simplify arch-independednt changes. | 257 // TODO(mips): Commenting out, to simplify arch-independent changes. |
| 258 // GC won't work like this, but this commit is for asm/disasm/sim. | 258 // GC won't work like this, but this commit is for asm/disasm/sim. |
| 259 // visitor->VisitPointer(target_object_address(), this); | 259 // visitor->VisitPointer(target_object_address(), this); |
| 260 } else if (RelocInfo::IsCodeTarget(mode)) { | 260 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 261 visitor->VisitCodeTarget(this); | 261 visitor->VisitCodeTarget(this); |
| 262 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | |
| 263 visitor->VisitGlobalPropertyCell(this); | |
| 262 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 264 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 263 // RelocInfo is needed when external-references must be serialized by | 265 // RelocInfo is needed when external-references must be serialized by |
| 264 // Serializer Visitor in serialize.cc. It is ignored by visitors that | 266 // Serializer Visitor in serialize.cc. It is ignored by visitors that |
| 265 // do not need it. | 267 // do not need it. |
| 266 // Commenting out, to simplify arch-independednt changes. | 268 // TODO(mips): Commenting out, to simplify arch-independent changes. |
| 267 // Serializer won't work like this, but this commit is for asm/disasm/sim. | 269 // Serializer won't work like this, but this commit is for asm/disasm/sim. |
| 268 // visitor->VisitExternalReference(target_reference_address(), this); | 270 // visitor->VisitExternalReference(target_reference_address(), this); |
| 269 #ifdef ENABLE_DEBUGGER_SUPPORT | 271 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 270 // TODO(isolates): Get a cached isolate below. | 272 // TODO(isolates): Get a cached isolate below. |
| 271 } else if (((RelocInfo::IsJSReturn(mode) && | 273 } else if (((RelocInfo::IsJSReturn(mode) && |
|
Søren Thygesen Gjesse
2011/05/09 14:28:49
One more space indent of IsPatchedReturnSequence()
| |
| 272 IsPatchedReturnSequence()) || | 274 IsPatchedReturnSequence()) || |
| 273 (RelocInfo::IsDebugBreakSlot(mode) && | 275 (RelocInfo::IsDebugBreakSlot(mode) && |
|
Søren Thygesen Gjesse
2011/05/09 14:28:49
And here.
| |
| 274 IsPatchedDebugBreakSlotSequence())) && | 276 IsPatchedDebugBreakSlotSequence())) && |
| 275 Isolate::Current()->debug()->has_break_points()) { | 277 Isolate::Current()->debug()->has_break_points()) { |
| 276 visitor->VisitDebugTarget(this); | 278 visitor->VisitDebugTarget(this); |
| 277 #endif | 279 #endif |
| 278 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 280 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 279 visitor->VisitRuntimeEntry(this); | 281 visitor->VisitRuntimeEntry(this); |
| 280 } | 282 } |
| 281 } | 283 } |
| 282 | 284 |
| 283 | 285 |
| 284 template<typename StaticVisitor> | 286 template<typename StaticVisitor> |
| 285 void RelocInfo::Visit(Heap* heap) { | 287 void RelocInfo::Visit(Heap* heap) { |
| 286 RelocInfo::Mode mode = rmode(); | 288 RelocInfo::Mode mode = rmode(); |
| 287 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 289 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 288 StaticVisitor::VisitPointer(heap, target_object_address()); | 290 StaticVisitor::VisitPointer(heap, target_object_address()); |
| 289 } else if (RelocInfo::IsCodeTarget(mode)) { | 291 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 290 StaticVisitor::VisitCodeTarget(this); | 292 StaticVisitor::VisitCodeTarget(heap, this); |
| 293 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | |
| 294 StaticVisitor::VisitGlobalPropertyCell(heap, this); | |
| 291 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 295 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 292 StaticVisitor::VisitExternalReference(target_reference_address()); | 296 StaticVisitor::VisitExternalReference(target_reference_address()); |
| 293 #ifdef ENABLE_DEBUGGER_SUPPORT | 297 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 294 } else if (heap->isolate()->debug()->has_break_points() && | 298 } else if (heap->isolate()->debug()->has_break_points() && |
| 295 ((RelocInfo::IsJSReturn(mode) && | 299 ((RelocInfo::IsJSReturn(mode) && |
| 296 IsPatchedReturnSequence()) || | 300 IsPatchedReturnSequence()) || |
| 297 (RelocInfo::IsDebugBreakSlot(mode) && | 301 (RelocInfo::IsDebugBreakSlot(mode) && |
| 298 IsPatchedDebugBreakSlotSequence()))) { | 302 IsPatchedDebugBreakSlotSequence()))) { |
| 299 StaticVisitor::VisitDebugTarget(this); | 303 StaticVisitor::VisitDebugTarget(heap, this); |
| 300 #endif | 304 #endif |
| 301 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 305 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 302 StaticVisitor::VisitRuntimeEntry(this); | 306 StaticVisitor::VisitRuntimeEntry(this); |
| 303 } | 307 } |
| 304 } | 308 } |
| 305 | 309 |
| 306 | 310 |
| 307 // ----------------------------------------------------------------------------- | 311 // ----------------------------------------------------------------------------- |
| 308 // Assembler | 312 // Assembler. |
| 309 | 313 |
| 310 | 314 |
| 311 void Assembler::CheckBuffer() { | 315 void Assembler::CheckBuffer() { |
| 312 if (buffer_space() <= kGap) { | 316 if (buffer_space() <= kGap) { |
| 313 GrowBuffer(); | 317 GrowBuffer(); |
| 314 } | 318 } |
| 315 } | 319 } |
| 316 | 320 |
| 317 | 321 |
| 318 void Assembler::CheckTrampolinePoolQuick() { | 322 void Assembler::CheckTrampolinePoolQuick() { |
| 319 if (pc_offset() >= next_buffer_check_) { | 323 if (pc_offset() >= next_buffer_check_) { |
| 320 CheckTrampolinePool(); | 324 CheckTrampolinePool(); |
| 321 } | 325 } |
| 322 } | 326 } |
| 323 | 327 |
| 324 | 328 |
| 325 void Assembler::emit(Instr x) { | 329 void Assembler::emit(Instr x) { |
| 326 CheckBuffer(); | 330 CheckBuffer(); |
| 327 *reinterpret_cast<Instr*>(pc_) = x; | 331 *reinterpret_cast<Instr*>(pc_) = x; |
| 328 pc_ += kInstrSize; | 332 pc_ += kInstrSize; |
| 329 CheckTrampolinePoolQuick(); | 333 CheckTrampolinePoolQuick(); |
| 330 } | 334 } |
| 331 | 335 |
| 332 | 336 |
| 333 } } // namespace v8::internal | 337 } } // namespace v8::internal |
| 334 | 338 |
| 335 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 339 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |