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

Side by Side Diff: src/assembler.cc

Issue 2735103003: Merged: [wasm] Fix code specialization for empty memory buffer (Closed)
Patch Set: Created 3 years, 9 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/assembler.h ('k') | src/wasm/wasm-code-specialization.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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 const int kChunkBits = 7; 301 const int kChunkBits = 7;
302 const int kChunkMask = (1 << kChunkBits) - 1; 302 const int kChunkMask = (1 << kChunkBits) - 1;
303 const int kLastChunkTagBits = 1; 303 const int kLastChunkTagBits = 1;
304 const int kLastChunkTagMask = 1; 304 const int kLastChunkTagMask = 1;
305 const int kLastChunkTag = 1; 305 const int kLastChunkTag = 1;
306 306
307 const int kCodeWithIdTag = 0; 307 const int kCodeWithIdTag = 0;
308 const int kDeoptReasonTag = 1; 308 const int kDeoptReasonTag = 1;
309 309
310 void RelocInfo::update_wasm_memory_reference( 310 void RelocInfo::update_wasm_memory_reference(
311 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, 311 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) {
312 ICacheFlushMode icache_flush_mode) { 312 DCHECK(IsWasmMemoryReference(rmode_));
313 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); 313 DCHECK_GE(wasm_memory_reference(), old_base);
314 if (IsWasmMemoryReference(rmode_)) { 314 Address updated_reference = new_base + (wasm_memory_reference() - old_base);
315 Address updated_reference; 315 // The reference is not checked here but at runtime. Validity of references
316 DCHECK_GE(wasm_memory_reference(), old_base); 316 // may change over time.
317 updated_reference = new_base + (wasm_memory_reference() - old_base); 317 unchecked_update_wasm_memory_reference(updated_reference, icache_flush_mode);
318 // The reference is not checked here but at runtime. Validity of references
319 // may change over time.
320 unchecked_update_wasm_memory_reference(updated_reference,
321 icache_flush_mode);
322 } else if (IsWasmMemorySizeReference(rmode_)) {
323 uint32_t current_size_reference = wasm_memory_size_reference();
324 uint32_t updated_size_reference =
325 new_size + (current_size_reference - old_size);
326 unchecked_update_wasm_size(updated_size_reference, icache_flush_mode);
327 } else {
328 UNREACHABLE();
329 }
330 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 318 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
331 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t)); 319 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
332 } 320 }
321 }
322
323 void RelocInfo::update_wasm_memory_size(uint32_t old_size, uint32_t new_size,
324 ICacheFlushMode icache_flush_mode) {
325 DCHECK(IsWasmMemorySizeReference(rmode_));
326 uint32_t current_size_reference = wasm_memory_size_reference();
327 uint32_t updated_size_reference =
328 new_size + (current_size_reference - old_size);
329 unchecked_update_wasm_size(updated_size_reference, icache_flush_mode);
330 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
331 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
332 }
333 } 333 }
334 334
335 void RelocInfo::update_wasm_global_reference( 335 void RelocInfo::update_wasm_global_reference(
336 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) { 336 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) {
337 DCHECK(IsWasmGlobalReference(rmode_)); 337 DCHECK(IsWasmGlobalReference(rmode_));
338 Address updated_reference; 338 Address updated_reference;
339 DCHECK(reinterpret_cast<uintptr_t>(old_base) <= 339 DCHECK(reinterpret_cast<uintptr_t>(old_base) <=
340 reinterpret_cast<uintptr_t>(wasm_global_reference())); 340 reinterpret_cast<uintptr_t>(wasm_global_reference()));
341 updated_reference = new_base + (wasm_global_reference() - old_base); 341 updated_reference = new_base + (wasm_global_reference() - old_base);
342 DCHECK(reinterpret_cast<uintptr_t>(new_base) <= 342 DCHECK(reinterpret_cast<uintptr_t>(new_base) <=
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 1928
1929 1929
1930 void Assembler::DataAlign(int m) { 1930 void Assembler::DataAlign(int m) {
1931 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 1931 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1932 while ((pc_offset() & (m - 1)) != 0) { 1932 while ((pc_offset() & (m - 1)) != 0) {
1933 db(0); 1933 db(0);
1934 } 1934 }
1935 } 1935 }
1936 } // namespace internal 1936 } // namespace internal
1937 } // namespace v8 1937 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/wasm/wasm-code-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698