| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 #if V8_TARGET_ARCH_ARM64 | 269 #if V8_TARGET_ARCH_ARM64 |
| 270 // On ARM64, the Assembler keeps track of pointers to Labels to resolve | 270 // On ARM64, the Assembler keeps track of pointers to Labels to resolve |
| 271 // branches to distant targets. Copying labels would confuse the Assembler. | 271 // branches to distant targets. Copying labels would confuse the Assembler. |
| 272 DISALLOW_COPY_AND_ASSIGN(Label); // NOLINT | 272 DISALLOW_COPY_AND_ASSIGN(Label); // NOLINT |
| 273 #endif | 273 #endif |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 | 276 |
| 277 enum SaveFPRegsMode { kDontSaveFPRegs, kSaveFPRegs }; | 277 enum SaveFPRegsMode { kDontSaveFPRegs, kSaveFPRegs }; |
| 278 | 278 |
| 279 // Specifies whether to perform icache flush operations on RelocInfo updates. |
| 280 // If FLUSH_ICACHE_IF_NEEDED, the icache will always be flushed if an |
| 281 // instruction was modified. If SKIP_ICACHE_FLUSH the flush will always be |
| 282 // skipped (only use this if you will flush the icache manually before it is |
| 283 // executed). |
| 284 enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH }; |
| 279 | 285 |
| 280 // ----------------------------------------------------------------------------- | 286 // ----------------------------------------------------------------------------- |
| 281 // Relocation information | 287 // Relocation information |
| 282 | 288 |
| 283 | 289 |
| 284 // Relocation information consists of the address (pc) of the datum | 290 // Relocation information consists of the address (pc) of the datum |
| 285 // to which the relocation information applies, the relocation mode | 291 // to which the relocation information applies, the relocation mode |
| 286 // (rmode), and an optional data field. The relocation mode may be | 292 // (rmode), and an optional data field. The relocation mode may be |
| 287 // "descriptive" and not indicate a need for relocation, but simply | 293 // "descriptive" and not indicate a need for relocation, but simply |
| 288 // describe a property of the datum. Such rmodes are useful for GC | 294 // describe a property of the datum. Such rmodes are useful for GC |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 LAST_REAL_RELOC_MODE = VENEER_POOL, | 359 LAST_REAL_RELOC_MODE = VENEER_POOL, |
| 354 FIRST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, | 360 FIRST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, |
| 355 LAST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, | 361 LAST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, |
| 356 LAST_CODE_ENUM = DEBUG_BREAK, | 362 LAST_CODE_ENUM = DEBUG_BREAK, |
| 357 LAST_GCED_ENUM = CELL, | 363 LAST_GCED_ENUM = CELL, |
| 358 // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding. | 364 // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding. |
| 359 LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID, | 365 LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID, |
| 360 LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE | 366 LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE |
| 361 }; | 367 }; |
| 362 | 368 |
| 363 | |
| 364 RelocInfo() {} | 369 RelocInfo() {} |
| 365 | 370 |
| 366 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) | 371 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) |
| 367 : pc_(pc), rmode_(rmode), data_(data), host_(host) { | 372 : pc_(pc), rmode_(rmode), data_(data), host_(host) { |
| 368 } | 373 } |
| 369 RelocInfo(byte* pc, double data64) | 374 RelocInfo(byte* pc, double data64) |
| 370 : pc_(pc), rmode_(NONE64), data64_(data64), host_(NULL) { | 375 : pc_(pc), rmode_(NONE64), data64_(data64), host_(NULL) { |
| 371 } | 376 } |
| 372 | 377 |
| 373 static inline bool IsRealRelocMode(Mode mode) { | 378 static inline bool IsRealRelocMode(Mode mode) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 Mode rmode() const { return rmode_; } | 450 Mode rmode() const { return rmode_; } |
| 446 intptr_t data() const { return data_; } | 451 intptr_t data() const { return data_; } |
| 447 double data64() const { return data64_; } | 452 double data64() const { return data64_; } |
| 448 uint64_t raw_data64() { | 453 uint64_t raw_data64() { |
| 449 return BitCast<uint64_t>(data64_); | 454 return BitCast<uint64_t>(data64_); |
| 450 } | 455 } |
| 451 Code* host() const { return host_; } | 456 Code* host() const { return host_; } |
| 452 void set_host(Code* host) { host_ = host; } | 457 void set_host(Code* host) { host_ = host; } |
| 453 | 458 |
| 454 // Apply a relocation by delta bytes | 459 // Apply a relocation by delta bytes |
| 455 INLINE(void apply(intptr_t delta)); | 460 INLINE(void apply(intptr_t delta, |
| 461 ICacheFlushMode icache_flush_mode = |
| 462 FLUSH_ICACHE_IF_NEEDED)); |
| 456 | 463 |
| 457 // Is the pointer this relocation info refers to coded like a plain pointer | 464 // Is the pointer this relocation info refers to coded like a plain pointer |
| 458 // or is it strange in some way (e.g. relative or patched into a series of | 465 // or is it strange in some way (e.g. relative or patched into a series of |
| 459 // instructions). | 466 // instructions). |
| 460 bool IsCodedSpecially(); | 467 bool IsCodedSpecially(); |
| 461 | 468 |
| 462 // If true, the pointer this relocation info refers to is an entry in the | 469 // If true, the pointer this relocation info refers to is an entry in the |
| 463 // constant pool, otherwise the pointer is embedded in the instruction stream. | 470 // constant pool, otherwise the pointer is embedded in the instruction stream. |
| 464 bool IsInConstantPool(); | 471 bool IsInConstantPool(); |
| 465 | 472 |
| 466 // Read/modify the code target in the branch/call instruction | 473 // Read/modify the code target in the branch/call instruction |
| 467 // this relocation applies to; | 474 // this relocation applies to; |
| 468 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) | 475 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) |
| 469 INLINE(Address target_address()); | 476 INLINE(Address target_address()); |
| 470 INLINE(void set_target_address(Address target, | 477 INLINE(void set_target_address(Address target, |
| 471 WriteBarrierMode mode = UPDATE_WRITE_BARRIER)); | 478 WriteBarrierMode write_barrier_mode = |
| 479 UPDATE_WRITE_BARRIER, |
| 480 ICacheFlushMode icache_flush_mode = |
| 481 FLUSH_ICACHE_IF_NEEDED)); |
| 472 INLINE(Object* target_object()); | 482 INLINE(Object* target_object()); |
| 473 INLINE(Handle<Object> target_object_handle(Assembler* origin)); | 483 INLINE(Handle<Object> target_object_handle(Assembler* origin)); |
| 474 INLINE(void set_target_object(Object* target, | 484 INLINE(void set_target_object(Object* target, |
| 475 WriteBarrierMode mode = UPDATE_WRITE_BARRIER)); | 485 WriteBarrierMode write_barrier_mode = |
| 486 UPDATE_WRITE_BARRIER, |
| 487 ICacheFlushMode icache_flush_mode = |
| 488 FLUSH_ICACHE_IF_NEEDED)); |
| 476 INLINE(Address target_runtime_entry(Assembler* origin)); | 489 INLINE(Address target_runtime_entry(Assembler* origin)); |
| 477 INLINE(void set_target_runtime_entry(Address target, | 490 INLINE(void set_target_runtime_entry(Address target, |
| 478 WriteBarrierMode mode = | 491 WriteBarrierMode write_barrier_mode = |
| 479 UPDATE_WRITE_BARRIER)); | 492 UPDATE_WRITE_BARRIER, |
| 493 ICacheFlushMode icache_flush_mode = |
| 494 FLUSH_ICACHE_IF_NEEDED)); |
| 480 INLINE(Cell* target_cell()); | 495 INLINE(Cell* target_cell()); |
| 481 INLINE(Handle<Cell> target_cell_handle()); | 496 INLINE(Handle<Cell> target_cell_handle()); |
| 482 INLINE(void set_target_cell(Cell* cell, | 497 INLINE(void set_target_cell(Cell* cell, |
| 483 WriteBarrierMode mode = UPDATE_WRITE_BARRIER)); | 498 WriteBarrierMode write_barrier_mode = |
| 499 UPDATE_WRITE_BARRIER, |
| 500 ICacheFlushMode icache_flush_mode = |
| 501 FLUSH_ICACHE_IF_NEEDED)); |
| 484 INLINE(Handle<Object> code_age_stub_handle(Assembler* origin)); | 502 INLINE(Handle<Object> code_age_stub_handle(Assembler* origin)); |
| 485 INLINE(Code* code_age_stub()); | 503 INLINE(Code* code_age_stub()); |
| 486 INLINE(void set_code_age_stub(Code* stub)); | 504 INLINE(void set_code_age_stub(Code* stub, |
| 505 ICacheFlushMode icache_flush_mode = |
| 506 FLUSH_ICACHE_IF_NEEDED)); |
| 487 | 507 |
| 488 // Returns the address of the constant pool entry where the target address | 508 // Returns the address of the constant pool entry where the target address |
| 489 // is held. This should only be called if IsInConstantPool returns true. | 509 // is held. This should only be called if IsInConstantPool returns true. |
| 490 INLINE(Address constant_pool_entry_address()); | 510 INLINE(Address constant_pool_entry_address()); |
| 491 | 511 |
| 492 // Read the address of the word containing the target_address in an | 512 // Read the address of the word containing the target_address in an |
| 493 // instruction stream. What this means exactly is architecture-independent. | 513 // instruction stream. What this means exactly is architecture-independent. |
| 494 // The only architecture-independent user of this function is the serializer. | 514 // The only architecture-independent user of this function is the serializer. |
| 495 // The serializer uses it to find out how many raw bytes of instruction to | 515 // The serializer uses it to find out how many raw bytes of instruction to |
| 496 // output before the next target. Architecture-independent code shouldn't | 516 // output before the next target. Architecture-independent code shouldn't |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1149 |
| 1130 private: | 1150 private: |
| 1131 int32_t multiplier_; | 1151 int32_t multiplier_; |
| 1132 int32_t shift_; | 1152 int32_t shift_; |
| 1133 }; | 1153 }; |
| 1134 | 1154 |
| 1135 | 1155 |
| 1136 } } // namespace v8::internal | 1156 } } // namespace v8::internal |
| 1137 | 1157 |
| 1138 #endif // V8_ASSEMBLER_H_ | 1158 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |