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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 const int kChunkMask = (1 << kChunkBits) - 1; | 370 const int kChunkMask = (1 << kChunkBits) - 1; |
371 const int kLastChunkTagBits = 1; | 371 const int kLastChunkTagBits = 1; |
372 const int kLastChunkTagMask = 1; | 372 const int kLastChunkTagMask = 1; |
373 const int kLastChunkTag = 1; | 373 const int kLastChunkTag = 1; |
374 | 374 |
375 const int kCodeWithIdTag = 0; | 375 const int kCodeWithIdTag = 0; |
376 const int kNonstatementPositionTag = 1; | 376 const int kNonstatementPositionTag = 1; |
377 const int kStatementPositionTag = 2; | 377 const int kStatementPositionTag = 2; |
378 const int kDeoptReasonTag = 3; | 378 const int kDeoptReasonTag = 3; |
379 | 379 |
380 void RelocInfo::update_wasm_memory_reference( | |
381 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, | |
382 ICacheFlushMode icache_flush_mode) { | |
383 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); | |
384 if (IsWasmMemoryReference(rmode_)) { | |
385 Address updated_reference; | |
386 DCHECK(old_size == 0 || (old_base <= wasm_memory_reference() && | |
387 wasm_memory_reference() < old_base + old_size)); | |
388 updated_reference = new_base + (wasm_memory_reference() - old_base); | |
389 if (!(new_size == 0 || (new_base <= updated_reference && | |
titzer
2016/06/16 23:12:14
You can use V8_FATAL for this.
| |
390 updated_reference < new_base + new_size))) { | |
391 printf("new_size: %u\n", new_size); | |
392 printf("old_size: %u\n", old_size); | |
393 printf("wasm_memory_reference(): %p\n", | |
394 static_cast<void*>(wasm_memory_reference())); | |
395 printf("new_base: %p\n", static_cast<void*>(new_base)); | |
396 printf("old_base: %p\n", static_cast<void*>(old_base)); | |
397 printf("updated_reference: %p\n", static_cast<void*>(updated_reference)); | |
398 | |
399 DCHECK(false); | |
400 } | |
401 UncheckedUpdateWasmMemoryReference(updated_reference, icache_flush_mode); | |
402 } else if (IsWasmMemorySizeReference(rmode_)) { | |
403 uint32_t updated_size_reference; | |
404 DCHECK(old_size == 0 || wasm_memory_size_reference() <= old_size); | |
405 updated_size_reference = | |
406 new_size + (wasm_memory_size_reference() - old_size); | |
407 DCHECK(updated_size_reference <= new_size); | |
408 UncheckedUpdateWasmMemorySize(updated_size_reference, icache_flush_mode); | |
409 } else { | |
410 UNREACHABLE(); | |
411 } | |
412 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | |
413 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); | |
414 } | |
415 } | |
416 | |
417 void RelocInfo::update_wasm_global_reference( | |
418 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { | |
419 DCHECK(IsWasmGlobalReference(rmode_)); | |
420 Address updated_reference; | |
421 DCHECK(old_base <= wasm_global_reference()); | |
422 updated_reference = new_base + (wasm_global_reference() - old_base); | |
423 DCHECK(new_base <= updated_reference); | |
424 UncheckedUpdateWasmMemoryReference(updated_reference, icache_flush_mode); | |
425 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | |
426 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t)); | |
427 } | |
428 } | |
380 | 429 |
381 uint32_t RelocInfoWriter::WriteLongPCJump(uint32_t pc_delta) { | 430 uint32_t RelocInfoWriter::WriteLongPCJump(uint32_t pc_delta) { |
382 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. | 431 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. |
383 // Otherwise write a variable length PC jump for the bits that do | 432 // Otherwise write a variable length PC jump for the bits that do |
384 // not fit in the kSmallPCDeltaBits bits. | 433 // not fit in the kSmallPCDeltaBits bits. |
385 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; | 434 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; |
386 WriteMode(RelocInfo::PC_JUMP); | 435 WriteMode(RelocInfo::PC_JUMP); |
387 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; | 436 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; |
388 DCHECK(pc_jump > 0); | 437 DCHECK(pc_jump > 0); |
389 // Write kChunkBits size chunks of the pc_jump. | 438 // Write kChunkBits size chunks of the pc_jump. |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2106 | 2155 |
2107 | 2156 |
2108 void Assembler::DataAlign(int m) { | 2157 void Assembler::DataAlign(int m) { |
2109 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 2158 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
2110 while ((pc_offset() & (m - 1)) != 0) { | 2159 while ((pc_offset() & (m - 1)) != 0) { |
2111 db(0); | 2160 db(0); |
2112 } | 2161 } |
2113 } | 2162 } |
2114 } // namespace internal | 2163 } // namespace internal |
2115 } // namespace v8 | 2164 } // namespace v8 |
OLD | NEW |