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

Side by Side Diff: src/assembler.cc

Issue 2416543002: [wasm] Fix bounds check for zero initial memory. (Closed)
Patch Set: Fix bot failure Created 4 years, 2 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 | « no previous file | src/compiler/wasm-compiler.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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 Address updated_reference; 345 Address updated_reference;
346 DCHECK_GE(wasm_memory_reference(), old_base); 346 DCHECK_GE(wasm_memory_reference(), old_base);
347 updated_reference = new_base + (wasm_memory_reference() - old_base); 347 updated_reference = new_base + (wasm_memory_reference() - old_base);
348 // The reference is not checked here but at runtime. Validity of references 348 // The reference is not checked here but at runtime. Validity of references
349 // may change over time. 349 // may change over time.
350 unchecked_update_wasm_memory_reference(updated_reference, 350 unchecked_update_wasm_memory_reference(updated_reference,
351 icache_flush_mode); 351 icache_flush_mode);
352 } else if (IsWasmMemorySizeReference(rmode_)) { 352 } else if (IsWasmMemorySizeReference(rmode_)) {
353 uint32_t current_size_reference = wasm_memory_size_reference(); 353 uint32_t current_size_reference = wasm_memory_size_reference();
354 DCHECK(old_size == 0 || current_size_reference <= old_size); 354 DCHECK(old_size == 0 || current_size_reference <= old_size);
355 uint32_t offset = old_size - current_size_reference; 355 uint32_t updated_size_reference =
356 DCHECK_GE(new_size, offset); 356 new_size + (current_size_reference - old_size);
357 uint32_t updated_size_reference = new_size - offset;
358 unchecked_update_wasm_memory_size(updated_size_reference, 357 unchecked_update_wasm_memory_size(updated_size_reference,
359 icache_flush_mode); 358 icache_flush_mode);
360 } else { 359 } else {
361 UNREACHABLE(); 360 UNREACHABLE();
362 } 361 }
363 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 362 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
364 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); 363 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
365 } 364 }
366 } 365 }
367 366
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 1938
1940 1939
1941 void Assembler::DataAlign(int m) { 1940 void Assembler::DataAlign(int m) {
1942 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 1941 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1943 while ((pc_offset() & (m - 1)) != 0) { 1942 while ((pc_offset() & (m - 1)) != 0) {
1944 db(0); 1943 db(0);
1945 } 1944 }
1946 } 1945 }
1947 } // namespace internal 1946 } // namespace internal
1948 } // namespace v8 1947 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698