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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 enum Mode { | 386 enum Mode { |
387 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 387 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). |
388 CODE_TARGET, // Code target which is not any of the above. | 388 CODE_TARGET, // Code target which is not any of the above. |
389 CODE_TARGET_WITH_ID, | 389 CODE_TARGET_WITH_ID, |
390 DEBUGGER_STATEMENT, // Code target for the debugger statement. | 390 DEBUGGER_STATEMENT, // Code target for the debugger statement. |
391 EMBEDDED_OBJECT, | 391 EMBEDDED_OBJECT, |
392 // To relocate pointers into the wasm memory embedded in wasm code | 392 // To relocate pointers into the wasm memory embedded in wasm code |
393 WASM_MEMORY_REFERENCE, | 393 WASM_MEMORY_REFERENCE, |
394 WASM_GLOBAL_REFERENCE, | 394 WASM_GLOBAL_REFERENCE, |
395 WASM_MEMORY_SIZE_REFERENCE, | 395 WASM_MEMORY_SIZE_REFERENCE, |
| 396 WASM_MEMTYPE_SIZE_REFERENCE, |
396 CELL, | 397 CELL, |
397 | 398 |
398 // Everything after runtime_entry (inclusive) is not GC'ed. | 399 // Everything after runtime_entry (inclusive) is not GC'ed. |
399 RUNTIME_ENTRY, | 400 RUNTIME_ENTRY, |
400 COMMENT, | 401 COMMENT, |
401 | 402 |
402 // Additional code inserted for debug break slot. | 403 // Additional code inserted for debug break slot. |
403 DEBUG_BREAK_SLOT_AT_POSITION, | 404 DEBUG_BREAK_SLOT_AT_POSITION, |
404 DEBUG_BREAK_SLOT_AT_RETURN, | 405 DEBUG_BREAK_SLOT_AT_RETURN, |
405 DEBUG_BREAK_SLOT_AT_CALL, | 406 DEBUG_BREAK_SLOT_AT_CALL, |
(...skipping 24 matching lines...) Expand all Loading... |
430 // Pseudo-types | 431 // Pseudo-types |
431 NUMBER_OF_MODES, | 432 NUMBER_OF_MODES, |
432 NONE32, // never recorded 32-bit value | 433 NONE32, // never recorded 32-bit value |
433 NONE64, // never recorded 64-bit value | 434 NONE64, // never recorded 64-bit value |
434 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by | 435 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by |
435 // code aging. | 436 // code aging. |
436 | 437 |
437 FIRST_REAL_RELOC_MODE = CODE_TARGET, | 438 FIRST_REAL_RELOC_MODE = CODE_TARGET, |
438 LAST_REAL_RELOC_MODE = VENEER_POOL, | 439 LAST_REAL_RELOC_MODE = VENEER_POOL, |
439 LAST_CODE_ENUM = DEBUGGER_STATEMENT, | 440 LAST_CODE_ENUM = DEBUGGER_STATEMENT, |
440 LAST_GCED_ENUM = WASM_MEMORY_SIZE_REFERENCE, | 441 LAST_GCED_ENUM = WASM_MEMTYPE_SIZE_REFERENCE, |
441 FIRST_SHAREABLE_RELOC_MODE = CELL, | 442 FIRST_SHAREABLE_RELOC_MODE = CELL, |
442 }; | 443 }; |
443 | 444 |
444 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); | 445 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); |
445 | 446 |
446 explicit RelocInfo(Isolate* isolate) : isolate_(isolate) { | 447 explicit RelocInfo(Isolate* isolate) : isolate_(isolate) { |
447 DCHECK_NOT_NULL(isolate); | 448 DCHECK_NOT_NULL(isolate); |
448 } | 449 } |
449 | 450 |
450 RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host) | 451 RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 524 } |
524 static inline bool IsGeneratorContinuation(Mode mode) { | 525 static inline bool IsGeneratorContinuation(Mode mode) { |
525 return mode == GENERATOR_CONTINUATION; | 526 return mode == GENERATOR_CONTINUATION; |
526 } | 527 } |
527 static inline bool IsWasmMemoryReference(Mode mode) { | 528 static inline bool IsWasmMemoryReference(Mode mode) { |
528 return mode == WASM_MEMORY_REFERENCE; | 529 return mode == WASM_MEMORY_REFERENCE; |
529 } | 530 } |
530 static inline bool IsWasmMemorySizeReference(Mode mode) { | 531 static inline bool IsWasmMemorySizeReference(Mode mode) { |
531 return mode == WASM_MEMORY_SIZE_REFERENCE; | 532 return mode == WASM_MEMORY_SIZE_REFERENCE; |
532 } | 533 } |
| 534 static inline bool IsWasmMemtypeSizeReference(Mode mode) { |
| 535 return mode == WASM_MEMTYPE_SIZE_REFERENCE; |
| 536 } |
533 static inline bool IsWasmGlobalReference(Mode mode) { | 537 static inline bool IsWasmGlobalReference(Mode mode) { |
534 return mode == WASM_GLOBAL_REFERENCE; | 538 return mode == WASM_GLOBAL_REFERENCE; |
535 } | 539 } |
| 540 static inline bool IsWasmReference(Mode mode) { |
| 541 return mode == WASM_MEMORY_REFERENCE || |
| 542 mode == WASM_MEMORY_SIZE_REFERENCE || |
| 543 mode == WASM_MEMTYPE_SIZE_REFERENCE || mode == WASM_GLOBAL_REFERENCE; |
| 544 } |
| 545 static inline bool IsWasmSizeReference(Mode mode) { |
| 546 return mode == WASM_MEMORY_SIZE_REFERENCE || |
| 547 mode == WASM_MEMTYPE_SIZE_REFERENCE; |
| 548 } |
536 static inline int ModeMask(Mode mode) { return 1 << mode; } | 549 static inline int ModeMask(Mode mode) { return 1 << mode; } |
537 | 550 |
538 // Accessors | 551 // Accessors |
539 Isolate* isolate() const { return isolate_; } | 552 Isolate* isolate() const { return isolate_; } |
540 byte* pc() const { return pc_; } | 553 byte* pc() const { return pc_; } |
541 void set_pc(byte* pc) { pc_ = pc; } | 554 void set_pc(byte* pc) { pc_ = pc; } |
542 Mode rmode() const { return rmode_; } | 555 Mode rmode() const { return rmode_; } |
543 intptr_t data() const { return data_; } | 556 intptr_t data() const { return data_; } |
544 Code* host() const { return host_; } | 557 Code* host() const { return host_; } |
545 void set_host(Code* host) { host_ = host; } | 558 void set_host(Code* host) { host_ = host; } |
546 | 559 |
547 // Apply a relocation by delta bytes. When the code object is moved, PC | 560 // Apply a relocation by delta bytes. When the code object is moved, PC |
548 // relative addresses have to be updated as well as absolute addresses | 561 // relative addresses have to be updated as well as absolute addresses |
549 // inside the code (internal references). | 562 // inside the code (internal references). |
550 // Do not forget to flush the icache afterwards! | 563 // Do not forget to flush the icache afterwards! |
551 INLINE(void apply(intptr_t delta)); | 564 INLINE(void apply(intptr_t delta)); |
552 | 565 |
553 // Is the pointer this relocation info refers to coded like a plain pointer | 566 // Is the pointer this relocation info refers to coded like a plain pointer |
554 // or is it strange in some way (e.g. relative or patched into a series of | 567 // or is it strange in some way (e.g. relative or patched into a series of |
555 // instructions). | 568 // instructions). |
556 bool IsCodedSpecially(); | 569 bool IsCodedSpecially(); |
557 | 570 |
558 // If true, the pointer this relocation info refers to is an entry in the | 571 // If true, the pointer this relocation info refers to is an entry in the |
559 // constant pool, otherwise the pointer is embedded in the instruction stream. | 572 // constant pool, otherwise the pointer is embedded in the instruction stream. |
560 bool IsInConstantPool(); | 573 bool IsInConstantPool(); |
561 | 574 |
562 Address wasm_memory_reference(); | 575 Address wasm_memory_reference(); |
563 Address wasm_global_reference(); | 576 Address wasm_global_reference(); |
564 uint32_t wasm_memory_size_reference(); | 577 uint32_t wasm_memory_size_reference(); |
| 578 uint8_t wasm_memtype_size_reference(); |
565 void update_wasm_memory_reference( | 579 void update_wasm_memory_reference( |
566 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, | 580 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, |
567 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); | 581 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); |
568 void update_wasm_global_reference( | 582 void update_wasm_global_reference( |
569 Address old_base, Address new_base, | 583 Address old_base, Address new_base, |
570 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); | 584 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); |
571 void set_target_address( | 585 void set_target_address( |
572 Address target, | 586 Address target, |
573 WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER, | 587 WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER, |
574 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); | 588 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 std::vector<ConstantPoolEntry> shared_entries; | 1295 std::vector<ConstantPoolEntry> shared_entries; |
1282 }; | 1296 }; |
1283 | 1297 |
1284 Label emitted_label_; // Records pc_offset of emitted pool | 1298 Label emitted_label_; // Records pc_offset of emitted pool |
1285 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1299 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; |
1286 }; | 1300 }; |
1287 | 1301 |
1288 } // namespace internal | 1302 } // namespace internal |
1289 } // namespace v8 | 1303 } // namespace v8 |
1290 #endif // V8_ASSEMBLER_H_ | 1304 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |