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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 DCHECK_GE(wasm_memory_reference(), old_base); | 327 DCHECK_GE(wasm_memory_reference(), old_base); |
328 updated_reference = new_base + (wasm_memory_reference() - old_base); | 328 updated_reference = new_base + (wasm_memory_reference() - old_base); |
329 // The reference is not checked here but at runtime. Validity of references | 329 // The reference is not checked here but at runtime. Validity of references |
330 // may change over time. | 330 // may change over time. |
331 unchecked_update_wasm_memory_reference(updated_reference, | 331 unchecked_update_wasm_memory_reference(updated_reference, |
332 icache_flush_mode); | 332 icache_flush_mode); |
333 } else if (IsWasmMemorySizeReference(rmode_)) { | 333 } else if (IsWasmMemorySizeReference(rmode_)) { |
334 uint32_t current_size_reference = wasm_memory_size_reference(); | 334 uint32_t current_size_reference = wasm_memory_size_reference(); |
335 uint32_t updated_size_reference = | 335 uint32_t updated_size_reference = |
336 new_size + (current_size_reference - old_size); | 336 new_size + (current_size_reference - old_size); |
337 unchecked_update_wasm_memory_size(updated_size_reference, | 337 unchecked_update_wasm_size(updated_size_reference, icache_flush_mode); |
338 icache_flush_mode); | |
339 } else { | 338 } else { |
340 UNREACHABLE(); | 339 UNREACHABLE(); |
341 } | 340 } |
342 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 341 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
343 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); | 342 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); |
344 } | 343 } |
345 } | 344 } |
346 | 345 |
347 void RelocInfo::update_wasm_global_reference( | 346 void RelocInfo::update_wasm_global_reference( |
348 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { | 347 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { |
349 DCHECK(IsWasmGlobalReference(rmode_)); | 348 DCHECK(IsWasmGlobalReference(rmode_)); |
350 Address updated_reference; | 349 Address updated_reference; |
351 DCHECK(reinterpret_cast<uintptr_t>(old_base) <= | 350 DCHECK(reinterpret_cast<uintptr_t>(old_base) <= |
352 reinterpret_cast<uintptr_t>(wasm_global_reference())); | 351 reinterpret_cast<uintptr_t>(wasm_global_reference())); |
353 updated_reference = new_base + (wasm_global_reference() - old_base); | 352 updated_reference = new_base + (wasm_global_reference() - old_base); |
354 DCHECK(reinterpret_cast<uintptr_t>(new_base) <= | 353 DCHECK(reinterpret_cast<uintptr_t>(new_base) <= |
355 reinterpret_cast<uintptr_t>(updated_reference)); | 354 reinterpret_cast<uintptr_t>(updated_reference)); |
356 unchecked_update_wasm_memory_reference(updated_reference, icache_flush_mode); | 355 unchecked_update_wasm_memory_reference(updated_reference, icache_flush_mode); |
357 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 356 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
358 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t)); | 357 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t)); |
359 } | 358 } |
360 } | 359 } |
361 | 360 |
| 361 void RelocInfo::update_wasm_function_table_size_reference( |
| 362 uint32_t old_size, uint32_t new_size, ICacheFlushMode icache_flush_mode) { |
| 363 DCHECK(IsWasmFunctionTableSizeReference(rmode_)); |
| 364 uint32_t current_size_reference = wasm_function_table_size_reference(); |
| 365 uint32_t updated_size_reference = |
| 366 new_size + (current_size_reference - old_size); |
| 367 unchecked_update_wasm_size(updated_size_reference, icache_flush_mode); |
| 368 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
| 369 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); |
| 370 } |
| 371 } |
| 372 |
362 void RelocInfo::set_target_address(Address target, | 373 void RelocInfo::set_target_address(Address target, |
363 WriteBarrierMode write_barrier_mode, | 374 WriteBarrierMode write_barrier_mode, |
364 ICacheFlushMode icache_flush_mode) { | 375 ICacheFlushMode icache_flush_mode) { |
365 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 376 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
366 Assembler::set_target_address_at(isolate_, pc_, host_, target, | 377 Assembler::set_target_address_at(isolate_, pc_, host_, target, |
367 icache_flush_mode); | 378 icache_flush_mode); |
368 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && | 379 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && |
369 IsCodeTarget(rmode_)) { | 380 IsCodeTarget(rmode_)) { |
370 Object* target_code = Code::GetCodeFromTargetAddress(target); | 381 Object* target_code = Code::GetCodeFromTargetAddress(target); |
371 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 382 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: | 773 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: |
763 return "debug break slot at tail call"; | 774 return "debug break slot at tail call"; |
764 case CODE_AGE_SEQUENCE: | 775 case CODE_AGE_SEQUENCE: |
765 return "code age sequence"; | 776 return "code age sequence"; |
766 case WASM_MEMORY_REFERENCE: | 777 case WASM_MEMORY_REFERENCE: |
767 return "wasm memory reference"; | 778 return "wasm memory reference"; |
768 case WASM_MEMORY_SIZE_REFERENCE: | 779 case WASM_MEMORY_SIZE_REFERENCE: |
769 return "wasm memory size reference"; | 780 return "wasm memory size reference"; |
770 case WASM_GLOBAL_REFERENCE: | 781 case WASM_GLOBAL_REFERENCE: |
771 return "wasm global value reference"; | 782 return "wasm global value reference"; |
| 783 case WASM_FUNCTION_TABLE_SIZE_REFERENCE: |
| 784 return "wasm function table size reference"; |
772 case NUMBER_OF_MODES: | 785 case NUMBER_OF_MODES: |
773 case PC_JUMP: | 786 case PC_JUMP: |
774 UNREACHABLE(); | 787 UNREACHABLE(); |
775 return "number_of_modes"; | 788 return "number_of_modes"; |
776 } | 789 } |
777 return "unknown relocation type"; | 790 return "unknown relocation type"; |
778 } | 791 } |
779 | 792 |
780 | 793 |
781 void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT | 794 void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 case DEOPT_ID: | 872 case DEOPT_ID: |
860 case CONST_POOL: | 873 case CONST_POOL: |
861 case VENEER_POOL: | 874 case VENEER_POOL: |
862 case DEBUG_BREAK_SLOT_AT_POSITION: | 875 case DEBUG_BREAK_SLOT_AT_POSITION: |
863 case DEBUG_BREAK_SLOT_AT_RETURN: | 876 case DEBUG_BREAK_SLOT_AT_RETURN: |
864 case DEBUG_BREAK_SLOT_AT_CALL: | 877 case DEBUG_BREAK_SLOT_AT_CALL: |
865 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: | 878 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: |
866 case WASM_MEMORY_REFERENCE: | 879 case WASM_MEMORY_REFERENCE: |
867 case WASM_MEMORY_SIZE_REFERENCE: | 880 case WASM_MEMORY_SIZE_REFERENCE: |
868 case WASM_GLOBAL_REFERENCE: | 881 case WASM_GLOBAL_REFERENCE: |
| 882 case WASM_FUNCTION_TABLE_SIZE_REFERENCE: |
869 case NONE32: | 883 case NONE32: |
870 case NONE64: | 884 case NONE64: |
871 break; | 885 break; |
872 case NUMBER_OF_MODES: | 886 case NUMBER_OF_MODES: |
873 case PC_JUMP: | 887 case PC_JUMP: |
874 UNREACHABLE(); | 888 UNREACHABLE(); |
875 break; | 889 break; |
876 case CODE_AGE_SEQUENCE: | 890 case CODE_AGE_SEQUENCE: |
877 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); | 891 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); |
878 break; | 892 break; |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 | 1932 |
1919 | 1933 |
1920 void Assembler::DataAlign(int m) { | 1934 void Assembler::DataAlign(int m) { |
1921 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 1935 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
1922 while ((pc_offset() & (m - 1)) != 0) { | 1936 while ((pc_offset() & (m - 1)) != 0) { |
1923 db(0); | 1937 db(0); |
1924 } | 1938 } |
1925 } | 1939 } |
1926 } // namespace internal | 1940 } // namespace internal |
1927 } // namespace v8 | 1941 } // namespace v8 |
OLD | NEW |