Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: src/assembler.h

Issue 1921203002: Add new relocation type WASM_MEMORY_SIZE_REFERENCE, use relocatable pointers to update wasm memory … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ben's review Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/assembler-arm64-inl.h ('k') | src/assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
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,
388 // To relocate pointers into the wasm memory embedded in wasm code 387 // To relocate pointers into the wasm memory embedded in wasm code
389 WASM_MEMORY_REFERENCE, 388 WASM_MEMORY_REFERENCE,
389 WASM_MEMORY_SIZE_REFERENCE,
390 CELL,
390 391
391 // Everything after runtime_entry (inclusive) is not GC'ed. 392 // Everything after runtime_entry (inclusive) is not GC'ed.
392 RUNTIME_ENTRY, 393 RUNTIME_ENTRY,
393 COMMENT, 394 COMMENT,
394 POSITION, // See comment for kNoPosition above. 395 POSITION, // See comment for kNoPosition above.
395 STATEMENT_POSITION, // See comment for kNoPosition above. 396 STATEMENT_POSITION, // See comment for kNoPosition above.
396 397
397 // Additional code inserted for debug break slot. 398 // Additional code inserted for debug break slot.
398 DEBUG_BREAK_SLOT_AT_POSITION, 399 DEBUG_BREAK_SLOT_AT_POSITION,
399 DEBUG_BREAK_SLOT_AT_RETURN, 400 DEBUG_BREAK_SLOT_AT_RETURN,
(...skipping 23 matching lines...) Expand all
423 // Pseudo-types 424 // Pseudo-types
424 NUMBER_OF_MODES, 425 NUMBER_OF_MODES,
425 NONE32, // never recorded 32-bit value 426 NONE32, // never recorded 32-bit value
426 NONE64, // never recorded 64-bit value 427 NONE64, // never recorded 64-bit value
427 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by 428 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by
428 // code aging. 429 // code aging.
429 430
430 FIRST_REAL_RELOC_MODE = CODE_TARGET, 431 FIRST_REAL_RELOC_MODE = CODE_TARGET,
431 LAST_REAL_RELOC_MODE = VENEER_POOL, 432 LAST_REAL_RELOC_MODE = VENEER_POOL,
432 LAST_CODE_ENUM = DEBUGGER_STATEMENT, 433 LAST_CODE_ENUM = DEBUGGER_STATEMENT,
433 LAST_GCED_ENUM = WASM_MEMORY_REFERENCE, 434 LAST_GCED_ENUM = WASM_MEMORY_SIZE_REFERENCE,
434 FIRST_SHAREABLE_RELOC_MODE = CELL, 435 FIRST_SHAREABLE_RELOC_MODE = CELL,
435 }; 436 };
436 437
437 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); 438 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt);
438 439
439 explicit RelocInfo(Isolate* isolate) : isolate_(isolate) { 440 explicit RelocInfo(Isolate* isolate) : isolate_(isolate) {
440 DCHECK_NOT_NULL(isolate); 441 DCHECK_NOT_NULL(isolate);
441 } 442 }
442 443
443 RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host) 444 RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 515 }
515 static inline bool IsCodeAgeSequence(Mode mode) { 516 static inline bool IsCodeAgeSequence(Mode mode) {
516 return mode == CODE_AGE_SEQUENCE; 517 return mode == CODE_AGE_SEQUENCE;
517 } 518 }
518 static inline bool IsGeneratorContinuation(Mode mode) { 519 static inline bool IsGeneratorContinuation(Mode mode) {
519 return mode == GENERATOR_CONTINUATION; 520 return mode == GENERATOR_CONTINUATION;
520 } 521 }
521 static inline bool IsWasmMemoryReference(Mode mode) { 522 static inline bool IsWasmMemoryReference(Mode mode) {
522 return mode == WASM_MEMORY_REFERENCE; 523 return mode == WASM_MEMORY_REFERENCE;
523 } 524 }
525 static inline bool IsWasmMemorySizeReference(Mode mode) {
526 return mode == WASM_MEMORY_SIZE_REFERENCE;
527 }
524 static inline int ModeMask(Mode mode) { return 1 << mode; } 528 static inline int ModeMask(Mode mode) { return 1 << mode; }
525 529
526 // Accessors 530 // Accessors
527 Isolate* isolate() const { return isolate_; } 531 Isolate* isolate() const { return isolate_; }
528 byte* pc() const { return pc_; } 532 byte* pc() const { return pc_; }
529 void set_pc(byte* pc) { pc_ = pc; } 533 void set_pc(byte* pc) { pc_ = pc; }
530 Mode rmode() const { return rmode_; } 534 Mode rmode() const { return rmode_; }
531 intptr_t data() const { return data_; } 535 intptr_t data() const { return data_; }
532 Code* host() const { return host_; } 536 Code* host() const { return host_; }
533 void set_host(Code* host) { host_ = host; } 537 void set_host(Code* host) { host_ = host; }
534 538
535 // Apply a relocation by delta bytes. When the code object is moved, PC 539 // Apply a relocation by delta bytes. When the code object is moved, PC
536 // relative addresses have to be updated as well as absolute addresses 540 // relative addresses have to be updated as well as absolute addresses
537 // inside the code (internal references). 541 // inside the code (internal references).
538 // Do not forget to flush the icache afterwards! 542 // Do not forget to flush the icache afterwards!
539 INLINE(void apply(intptr_t delta)); 543 INLINE(void apply(intptr_t delta));
540 544
541 // Is the pointer this relocation info refers to coded like a plain pointer 545 // Is the pointer this relocation info refers to coded like a plain pointer
542 // or is it strange in some way (e.g. relative or patched into a series of 546 // or is it strange in some way (e.g. relative or patched into a series of
543 // instructions). 547 // instructions).
544 bool IsCodedSpecially(); 548 bool IsCodedSpecially();
545 549
546 // If true, the pointer this relocation info refers to is an entry in the 550 // If true, the pointer this relocation info refers to is an entry in the
547 // constant pool, otherwise the pointer is embedded in the instruction stream. 551 // constant pool, otherwise the pointer is embedded in the instruction stream.
548 bool IsInConstantPool(); 552 bool IsInConstantPool();
549 553
554 Address wasm_memory_reference();
555 uint32_t wasm_memory_size_reference();
556 void update_wasm_memory_reference(
557 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
558 ICacheFlushMode icache_flush_mode = SKIP_ICACHE_FLUSH);
559
550 // this relocation applies to; 560 // this relocation applies to;
551 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 561 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
552 INLINE(Address target_address()); 562 INLINE(Address target_address());
553 INLINE(void set_target_address(Address target, 563 INLINE(void set_target_address(Address target,
554 WriteBarrierMode write_barrier_mode = 564 WriteBarrierMode write_barrier_mode =
555 UPDATE_WRITE_BARRIER, 565 UPDATE_WRITE_BARRIER,
556 ICacheFlushMode icache_flush_mode = 566 ICacheFlushMode icache_flush_mode =
557 FLUSH_ICACHE_IF_NEEDED)); 567 FLUSH_ICACHE_IF_NEEDED));
558 INLINE(Object* target_object()); 568 INLINE(Object* target_object());
559 INLINE(Handle<Object> target_object_handle(Assembler* origin)); 569 INLINE(Handle<Object> target_object_handle(Assembler* origin));
(...skipping 14 matching lines...) Expand all
574 WriteBarrierMode write_barrier_mode = 584 WriteBarrierMode write_barrier_mode =
575 UPDATE_WRITE_BARRIER, 585 UPDATE_WRITE_BARRIER,
576 ICacheFlushMode icache_flush_mode = 586 ICacheFlushMode icache_flush_mode =
577 FLUSH_ICACHE_IF_NEEDED)); 587 FLUSH_ICACHE_IF_NEEDED));
578 INLINE(Handle<Object> code_age_stub_handle(Assembler* origin)); 588 INLINE(Handle<Object> code_age_stub_handle(Assembler* origin));
579 INLINE(Code* code_age_stub()); 589 INLINE(Code* code_age_stub());
580 INLINE(void set_code_age_stub(Code* stub, 590 INLINE(void set_code_age_stub(Code* stub,
581 ICacheFlushMode icache_flush_mode = 591 ICacheFlushMode icache_flush_mode =
582 FLUSH_ICACHE_IF_NEEDED)); 592 FLUSH_ICACHE_IF_NEEDED));
583 593
584 INLINE(Address wasm_memory_reference());
585 INLINE(void update_wasm_memory_reference(
586 Address old_base, Address new_base, size_t old_size, size_t new_size,
587 ICacheFlushMode icache_flush_mode = SKIP_ICACHE_FLUSH));
588 // Returns the address of the constant pool entry where the target address 594 // Returns the address of the constant pool entry where the target address
589 // is held. This should only be called if IsInConstantPool returns true. 595 // is held. This should only be called if IsInConstantPool returns true.
590 INLINE(Address constant_pool_entry_address()); 596 INLINE(Address constant_pool_entry_address());
591 597
592 // Read the address of the word containing the target_address in an 598 // Read the address of the word containing the target_address in an
593 // instruction stream. What this means exactly is architecture-independent. 599 // instruction stream. What this means exactly is architecture-independent.
594 // The only architecture-independent user of this function is the serializer. 600 // The only architecture-independent user of this function is the serializer.
595 // The serializer uses it to find out how many raw bytes of instruction to 601 // The serializer uses it to find out how many raw bytes of instruction to
596 // output before the next target. Architecture-independent code shouldn't 602 // output before the next target. Architecture-independent code shouldn't
597 // dereference the pointer it gets back from this. 603 // dereference the pointer it gets back from this.
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 std::vector<ConstantPoolEntry> shared_entries; 1332 std::vector<ConstantPoolEntry> shared_entries;
1327 }; 1333 };
1328 1334
1329 Label emitted_label_; // Records pc_offset of emitted pool 1335 Label emitted_label_; // Records pc_offset of emitted pool
1330 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; 1336 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
1331 }; 1337 };
1332 1338
1333 } // namespace internal 1339 } // namespace internal
1334 } // namespace v8 1340 } // namespace v8
1335 #endif // V8_ASSEMBLER_H_ 1341 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm64/assembler-arm64-inl.h ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698