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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 | 344 |
345 const int kCodeWithIdTag = 0; | 345 const int kCodeWithIdTag = 0; |
346 const int kDeoptReasonTag = 1; | 346 const int kDeoptReasonTag = 1; |
347 | 347 |
348 void RelocInfo::update_wasm_memory_reference( | 348 void RelocInfo::update_wasm_memory_reference( |
349 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, | 349 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, |
350 ICacheFlushMode icache_flush_mode) { | 350 ICacheFlushMode icache_flush_mode) { |
351 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); | 351 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); |
352 if (IsWasmMemoryReference(rmode_)) { | 352 if (IsWasmMemoryReference(rmode_)) { |
353 Address updated_reference; | 353 Address updated_reference; |
354 DCHECK_GE(wasm_memory_reference(), old_base); | |
354 updated_reference = new_base + (wasm_memory_reference() - old_base); | 355 updated_reference = new_base + (wasm_memory_reference() - old_base); |
355 // The reference is not checked here but at runtime. Validity of references | 356 // The reference is not checked here but at runtime. Validity of references |
356 // may change over time. | 357 // may change over time. |
357 unchecked_update_wasm_memory_reference(updated_reference, | 358 unchecked_update_wasm_memory_reference(updated_reference, |
358 icache_flush_mode); | 359 icache_flush_mode); |
359 } else if (IsWasmMemorySizeReference(rmode_)) { | 360 } else if (IsWasmMemorySizeReference(rmode_)) { |
360 uint32_t updated_size_reference; | 361 uint32_t current_size_reference = wasm_memory_size_reference(); |
361 DCHECK(old_size == 0 || wasm_memory_size_reference() <= old_size); | 362 DCHECK(old_size == 0 || current_size_reference <= old_size); |
362 updated_size_reference = | 363 uint32_t offset = old_size - current_size_reference; |
363 new_size + (wasm_memory_size_reference() - old_size); | 364 DCHECK_GE(new_size, offset); |
gdeepti
2016/09/17 01:25:58
I'm confused by this check, could you explain why
Mircea Trofin
2016/09/17 01:40:03
If new_size < offset, then the calculation of upda
gdeepti
2016/09/17 02:24:20
Offset in this case is the offset into memory rela
Mircea Trofin
2016/09/19 18:15:49
It's just checking locally the assumption about th
| |
364 DCHECK(updated_size_reference <= new_size); | 365 uint32_t updated_size_reference = new_size - offset; |
365 unchecked_update_wasm_memory_size(updated_size_reference, | 366 unchecked_update_wasm_memory_size(updated_size_reference, |
366 icache_flush_mode); | 367 icache_flush_mode); |
367 } else { | 368 } else { |
368 UNREACHABLE(); | 369 UNREACHABLE(); |
369 } | 370 } |
370 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 371 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
371 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); | 372 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); |
372 } | 373 } |
373 } | 374 } |
374 | 375 |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1957 | 1958 |
1958 | 1959 |
1959 void Assembler::DataAlign(int m) { | 1960 void Assembler::DataAlign(int m) { |
1960 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 1961 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
1961 while ((pc_offset() & (m - 1)) != 0) { | 1962 while ((pc_offset() & (m - 1)) != 0) { |
1962 db(0); | 1963 db(0); |
1963 } | 1964 } |
1964 } | 1965 } |
1965 } // namespace internal | 1966 } // namespace internal |
1966 } // namespace v8 | 1967 } // namespace v8 |
OLD | NEW |