| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 // They use a custom noncompact encoding. | 414 // They use a custom noncompact encoding. |
| 415 CONST_POOL, | 415 CONST_POOL, |
| 416 VENEER_POOL, | 416 VENEER_POOL, |
| 417 | 417 |
| 418 DEOPT_REASON, // Deoptimization reason index. | 418 DEOPT_REASON, // Deoptimization reason index. |
| 419 DEOPT_ID, // Deoptimization inlining id. | 419 DEOPT_ID, // Deoptimization inlining id. |
| 420 | 420 |
| 421 // This is not an actual reloc mode, but used to encode a long pc jump that | 421 // This is not an actual reloc mode, but used to encode a long pc jump that |
| 422 // cannot be encoded as part of another record. | 422 // cannot be encoded as part of another record. |
| 423 PC_JUMP, | 423 PC_JUMP, |
| 424 | 424 WASM_DIRECT_CALL, |
| 425 // Pseudo-types | 425 // Pseudo-types |
| 426 NUMBER_OF_MODES, | 426 NUMBER_OF_MODES, |
| 427 NONE32, // never recorded 32-bit value | 427 NONE32, // never recorded 32-bit value |
| 428 NONE64, // never recorded 64-bit value | 428 NONE64, // never recorded 64-bit value |
| 429 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by | 429 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by |
| 430 // code aging. | 430 // code aging. |
| 431 | 431 |
| 432 FIRST_REAL_RELOC_MODE = CODE_TARGET, | 432 FIRST_REAL_RELOC_MODE = CODE_TARGET, |
| 433 LAST_REAL_RELOC_MODE = VENEER_POOL, | 433 LAST_REAL_RELOC_MODE = VENEER_POOL, |
| 434 LAST_CODE_ENUM = DEBUGGER_STATEMENT, | 434 LAST_CODE_ENUM = DEBUGGER_STATEMENT, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 522 } |
| 523 static inline bool IsGeneratorContinuation(Mode mode) { | 523 static inline bool IsGeneratorContinuation(Mode mode) { |
| 524 return mode == GENERATOR_CONTINUATION; | 524 return mode == GENERATOR_CONTINUATION; |
| 525 } | 525 } |
| 526 static inline bool IsWasmMemoryReference(Mode mode) { | 526 static inline bool IsWasmMemoryReference(Mode mode) { |
| 527 return mode == WASM_MEMORY_REFERENCE; | 527 return mode == WASM_MEMORY_REFERENCE; |
| 528 } | 528 } |
| 529 static inline bool IsWasmMemorySizeReference(Mode mode) { | 529 static inline bool IsWasmMemorySizeReference(Mode mode) { |
| 530 return mode == WASM_MEMORY_SIZE_REFERENCE; | 530 return mode == WASM_MEMORY_SIZE_REFERENCE; |
| 531 } | 531 } |
| 532 static inline bool IsWasmDirectCall(Mode mode) { |
| 533 return mode == WASM_DIRECT_CALL; |
| 534 } |
| 532 static inline int ModeMask(Mode mode) { return 1 << mode; } | 535 static inline int ModeMask(Mode mode) { return 1 << mode; } |
| 533 | 536 |
| 534 // Accessors | 537 // Accessors |
| 535 Isolate* isolate() const { return isolate_; } | 538 Isolate* isolate() const { return isolate_; } |
| 536 byte* pc() const { return pc_; } | 539 byte* pc() const { return pc_; } |
| 537 void set_pc(byte* pc) { pc_ = pc; } | 540 void set_pc(byte* pc) { pc_ = pc; } |
| 538 Mode rmode() const { return rmode_; } | 541 Mode rmode() const { return rmode_; } |
| 539 intptr_t data() const { return data_; } | 542 intptr_t data() const { return data_; } |
| 540 Code* host() const { return host_; } | 543 Code* host() const { return host_; } |
| 541 void set_host(Code* host) { host_ = host; } | 544 void set_host(Code* host) { host_ = host; } |
| 542 | 545 |
| 543 // Apply a relocation by delta bytes. When the code object is moved, PC | 546 // Apply a relocation by delta bytes. When the code object is moved, PC |
| 544 // relative addresses have to be updated as well as absolute addresses | 547 // relative addresses have to be updated as well as absolute addresses |
| 545 // inside the code (internal references). | 548 // inside the code (internal references). |
| 546 // Do not forget to flush the icache afterwards! | 549 // Do not forget to flush the icache afterwards! |
| 547 INLINE(void apply(intptr_t delta)); | 550 INLINE(void apply(intptr_t delta)); |
| 548 | 551 |
| 549 // Is the pointer this relocation info refers to coded like a plain pointer | 552 // Is the pointer this relocation info refers to coded like a plain pointer |
| 550 // or is it strange in some way (e.g. relative or patched into a series of | 553 // or is it strange in some way (e.g. relative or patched into a series of |
| 551 // instructions). | 554 // instructions). |
| 552 bool IsCodedSpecially(); | 555 bool IsCodedSpecially(); |
| 553 | 556 |
| 554 // If true, the pointer this relocation info refers to is an entry in the | 557 // If true, the pointer this relocation info refers to is an entry in the |
| 555 // constant pool, otherwise the pointer is embedded in the instruction stream. | 558 // constant pool, otherwise the pointer is embedded in the instruction stream. |
| 556 bool IsInConstantPool(); | 559 bool IsInConstantPool(); |
| 557 | 560 |
| 558 Address wasm_memory_reference(); | 561 Address wasm_memory_reference(); |
| 559 uint32_t wasm_memory_size_reference(); | 562 uint32_t wasm_memory_size_reference(); |
| 563 uint32_t wasm_function_index(); |
| 564 |
| 560 void update_wasm_memory_reference( | 565 void update_wasm_memory_reference( |
| 561 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, | 566 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, |
| 562 ICacheFlushMode icache_flush_mode = SKIP_ICACHE_FLUSH); | 567 ICacheFlushMode icache_flush_mode = SKIP_ICACHE_FLUSH); |
| 563 | 568 |
| 564 // this relocation applies to; | 569 // this relocation applies to; |
| 565 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) | 570 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) |
| 566 INLINE(Address target_address()); | 571 INLINE(Address target_address()); |
| 567 INLINE(void set_target_address(Address target, | 572 INLINE(void set_target_address(Address target, |
| 568 WriteBarrierMode write_barrier_mode = | 573 WriteBarrierMode write_barrier_mode = |
| 569 UPDATE_WRITE_BARRIER, | 574 UPDATE_WRITE_BARRIER, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 #ifdef ENABLE_DISASSEMBLER | 663 #ifdef ENABLE_DISASSEMBLER |
| 659 // Printing | 664 // Printing |
| 660 static const char* RelocModeName(Mode rmode); | 665 static const char* RelocModeName(Mode rmode); |
| 661 void Print(Isolate* isolate, std::ostream& os); // NOLINT | 666 void Print(Isolate* isolate, std::ostream& os); // NOLINT |
| 662 #endif // ENABLE_DISASSEMBLER | 667 #endif // ENABLE_DISASSEMBLER |
| 663 #ifdef VERIFY_HEAP | 668 #ifdef VERIFY_HEAP |
| 664 void Verify(Isolate* isolate); | 669 void Verify(Isolate* isolate); |
| 665 #endif | 670 #endif |
| 666 | 671 |
| 667 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; | 672 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; |
| 673 static const int kWasmDirectCallMask = 1 << WASM_DIRECT_CALL; |
| 668 static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; | 674 static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; |
| 669 static const int kDataMask = | 675 static const int kDataMask = |
| 670 (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); | 676 (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); |
| 671 static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION | | 677 static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION | |
| 672 1 << DEBUG_BREAK_SLOT_AT_RETURN | | 678 1 << DEBUG_BREAK_SLOT_AT_RETURN | |
| 673 1 << DEBUG_BREAK_SLOT_AT_CALL; | 679 1 << DEBUG_BREAK_SLOT_AT_CALL; |
| 674 static const int kApplyMask; // Modes affected by apply. Depends on arch. | 680 static const int kApplyMask; // Modes affected by apply. Depends on arch. |
| 675 | 681 |
| 676 private: | 682 private: |
| 677 Isolate* isolate_; | 683 Isolate* isolate_; |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 std::vector<ConstantPoolEntry> shared_entries; | 1342 std::vector<ConstantPoolEntry> shared_entries; |
| 1337 }; | 1343 }; |
| 1338 | 1344 |
| 1339 Label emitted_label_; // Records pc_offset of emitted pool | 1345 Label emitted_label_; // Records pc_offset of emitted pool |
| 1340 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1346 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; |
| 1341 }; | 1347 }; |
| 1342 | 1348 |
| 1343 } // namespace internal | 1349 } // namespace internal |
| 1344 } // namespace v8 | 1350 } // namespace v8 |
| 1345 #endif // V8_ASSEMBLER_H_ | 1351 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |