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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // The maximum pc delta that will use the short encoding. | 378 // The maximum pc delta that will use the short encoding. |
379 static const int kMaxSmallPCDelta; | 379 static const int kMaxSmallPCDelta; |
380 | 380 |
381 enum Mode { | 381 enum Mode { |
382 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 382 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). |
383 CODE_TARGET, // Code target which is not any of the above. | 383 CODE_TARGET, // Code target which is not any of the above. |
384 CODE_TARGET_WITH_ID, | 384 CODE_TARGET_WITH_ID, |
385 DEBUGGER_STATEMENT, // Code target for the debugger statement. | 385 DEBUGGER_STATEMENT, // Code target for the debugger statement. |
386 EMBEDDED_OBJECT, | 386 EMBEDDED_OBJECT, |
387 CELL, | 387 CELL, |
388 // To relocate pointers into the wasm memory embedded in wasm code | |
389 WASM_MEMORY_REFERENCE, | |
390 | 388 |
391 // Everything after runtime_entry (inclusive) is not GC'ed. | 389 // Everything after runtime_entry (inclusive) is not GC'ed. |
392 RUNTIME_ENTRY, | 390 RUNTIME_ENTRY, |
393 COMMENT, | 391 COMMENT, |
394 POSITION, // See comment for kNoPosition above. | 392 POSITION, // See comment for kNoPosition above. |
395 STATEMENT_POSITION, // See comment for kNoPosition above. | 393 STATEMENT_POSITION, // See comment for kNoPosition above. |
396 | 394 |
397 // Additional code inserted for debug break slot. | 395 // Additional code inserted for debug break slot. |
398 DEBUG_BREAK_SLOT_AT_POSITION, | 396 DEBUG_BREAK_SLOT_AT_POSITION, |
399 DEBUG_BREAK_SLOT_AT_RETURN, | 397 DEBUG_BREAK_SLOT_AT_RETURN, |
(...skipping 22 matching lines...) Expand all Loading... |
422 // Pseudo-types | 420 // Pseudo-types |
423 NUMBER_OF_MODES, | 421 NUMBER_OF_MODES, |
424 NONE32, // never recorded 32-bit value | 422 NONE32, // never recorded 32-bit value |
425 NONE64, // never recorded 64-bit value | 423 NONE64, // never recorded 64-bit value |
426 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by | 424 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by |
427 // code aging. | 425 // code aging. |
428 | 426 |
429 FIRST_REAL_RELOC_MODE = CODE_TARGET, | 427 FIRST_REAL_RELOC_MODE = CODE_TARGET, |
430 LAST_REAL_RELOC_MODE = VENEER_POOL, | 428 LAST_REAL_RELOC_MODE = VENEER_POOL, |
431 LAST_CODE_ENUM = DEBUGGER_STATEMENT, | 429 LAST_CODE_ENUM = DEBUGGER_STATEMENT, |
432 LAST_GCED_ENUM = WASM_MEMORY_REFERENCE, | 430 LAST_GCED_ENUM = CELL, |
433 FIRST_SHAREABLE_RELOC_MODE = CELL, | |
434 }; | 431 }; |
435 | 432 |
436 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); | 433 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); |
437 | 434 |
438 explicit RelocInfo(Isolate* isolate) : isolate_(isolate) { | 435 explicit RelocInfo(Isolate* isolate) : isolate_(isolate) { |
439 DCHECK_NOT_NULL(isolate); | 436 DCHECK_NOT_NULL(isolate); |
440 } | 437 } |
441 | 438 |
442 RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host) | 439 RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host) |
443 : isolate_(isolate), pc_(pc), rmode_(rmode), data_(data), host_(host) { | 440 : isolate_(isolate), pc_(pc), rmode_(rmode), data_(data), host_(host) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 } | 504 } |
508 static inline bool IsNone(Mode mode) { | 505 static inline bool IsNone(Mode mode) { |
509 return mode == NONE32 || mode == NONE64; | 506 return mode == NONE32 || mode == NONE64; |
510 } | 507 } |
511 static inline bool IsCodeAgeSequence(Mode mode) { | 508 static inline bool IsCodeAgeSequence(Mode mode) { |
512 return mode == CODE_AGE_SEQUENCE; | 509 return mode == CODE_AGE_SEQUENCE; |
513 } | 510 } |
514 static inline bool IsGeneratorContinuation(Mode mode) { | 511 static inline bool IsGeneratorContinuation(Mode mode) { |
515 return mode == GENERATOR_CONTINUATION; | 512 return mode == GENERATOR_CONTINUATION; |
516 } | 513 } |
517 static inline bool IsWasmMemoryReference(Mode mode) { | |
518 return mode == WASM_MEMORY_REFERENCE; | |
519 } | |
520 static inline int ModeMask(Mode mode) { return 1 << mode; } | 514 static inline int ModeMask(Mode mode) { return 1 << mode; } |
521 | 515 |
522 // Accessors | 516 // Accessors |
523 Isolate* isolate() const { return isolate_; } | 517 Isolate* isolate() const { return isolate_; } |
524 byte* pc() const { return pc_; } | 518 byte* pc() const { return pc_; } |
525 void set_pc(byte* pc) { pc_ = pc; } | 519 void set_pc(byte* pc) { pc_ = pc; } |
526 Mode rmode() const { return rmode_; } | 520 Mode rmode() const { return rmode_; } |
527 intptr_t data() const { return data_; } | 521 intptr_t data() const { return data_; } |
528 Code* host() const { return host_; } | 522 Code* host() const { return host_; } |
529 void set_host(Code* host) { host_ = host; } | 523 void set_host(Code* host) { host_ = host; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 WriteBarrierMode write_barrier_mode = | 564 WriteBarrierMode write_barrier_mode = |
571 UPDATE_WRITE_BARRIER, | 565 UPDATE_WRITE_BARRIER, |
572 ICacheFlushMode icache_flush_mode = | 566 ICacheFlushMode icache_flush_mode = |
573 FLUSH_ICACHE_IF_NEEDED)); | 567 FLUSH_ICACHE_IF_NEEDED)); |
574 INLINE(Handle<Object> code_age_stub_handle(Assembler* origin)); | 568 INLINE(Handle<Object> code_age_stub_handle(Assembler* origin)); |
575 INLINE(Code* code_age_stub()); | 569 INLINE(Code* code_age_stub()); |
576 INLINE(void set_code_age_stub(Code* stub, | 570 INLINE(void set_code_age_stub(Code* stub, |
577 ICacheFlushMode icache_flush_mode = | 571 ICacheFlushMode icache_flush_mode = |
578 FLUSH_ICACHE_IF_NEEDED)); | 572 FLUSH_ICACHE_IF_NEEDED)); |
579 | 573 |
580 INLINE(Address wasm_memory_reference()); | |
581 INLINE(void update_wasm_memory_reference( | |
582 Address old_base, Address new_base, size_t old_size, size_t new_size, | |
583 ICacheFlushMode icache_flush_mode = SKIP_ICACHE_FLUSH)); | |
584 // Returns the address of the constant pool entry where the target address | 574 // Returns the address of the constant pool entry where the target address |
585 // is held. This should only be called if IsInConstantPool returns true. | 575 // is held. This should only be called if IsInConstantPool returns true. |
586 INLINE(Address constant_pool_entry_address()); | 576 INLINE(Address constant_pool_entry_address()); |
587 | 577 |
588 // Read the address of the word containing the target_address in an | 578 // Read the address of the word containing the target_address in an |
589 // instruction stream. What this means exactly is architecture-independent. | 579 // instruction stream. What this means exactly is architecture-independent. |
590 // The only architecture-independent user of this function is the serializer. | 580 // The only architecture-independent user of this function is the serializer. |
591 // The serializer uses it to find out how many raw bytes of instruction to | 581 // The serializer uses it to find out how many raw bytes of instruction to |
592 // output before the next target. Architecture-independent code shouldn't | 582 // output before the next target. Architecture-independent code shouldn't |
593 // dereference the pointer it gets back from this. | 583 // dereference the pointer it gets back from this. |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 std::vector<ConstantPoolEntry> shared_entries; | 1301 std::vector<ConstantPoolEntry> shared_entries; |
1312 }; | 1302 }; |
1313 | 1303 |
1314 Label emitted_label_; // Records pc_offset of emitted pool | 1304 Label emitted_label_; // Records pc_offset of emitted pool |
1315 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1305 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; |
1316 }; | 1306 }; |
1317 | 1307 |
1318 } // namespace internal | 1308 } // namespace internal |
1319 } // namespace v8 | 1309 } // namespace v8 |
1320 #endif // V8_ASSEMBLER_H_ | 1310 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |