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

Side by Side Diff: src/assembler.cc

Issue 2056633002: [wasm] Separate compilation from instantiation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 6 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
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DCHECK(new_size == 0 || (new_base <= updated_reference &&
390 updated_reference < new_base + new_size));
391 UncheckedUpdateWasmMemoryReference(updated_reference, icache_flush_mode);
392 } else if (IsWasmMemorySizeReference(rmode_)) {
393 uint32_t updated_size_reference;
394 DCHECK(old_size == 0 || wasm_memory_size_reference() <= old_size);
395 updated_size_reference =
396 new_size + (wasm_memory_size_reference() - old_size);
397 DCHECK(updated_size_reference <= new_size);
398 UncheckedUpdateWasmMemorySize(updated_size_reference, icache_flush_mode);
399 } else {
400 UNREACHABLE();
401 }
402 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
403 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
404 }
405 }
406
407 void RelocInfo::update_wasm_global_reference(
408 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) {
409 DCHECK(IsWasmGlobalReference(rmode_));
410 Address updated_reference;
411 DCHECK(old_base <= wasm_global_reference());
412 updated_reference = new_base + (wasm_global_reference() - old_base);
413 DCHECK(new_base <= updated_reference);
414 UncheckedUpdateWasmMemoryReference(updated_reference, icache_flush_mode);
415 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
416 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t));
417 }
418 }
380 419
381 uint32_t RelocInfoWriter::WriteLongPCJump(uint32_t pc_delta) { 420 uint32_t RelocInfoWriter::WriteLongPCJump(uint32_t pc_delta) {
382 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. 421 // Return if the pc_delta can fit in kSmallPCDeltaBits bits.
383 // Otherwise write a variable length PC jump for the bits that do 422 // Otherwise write a variable length PC jump for the bits that do
384 // not fit in the kSmallPCDeltaBits bits. 423 // not fit in the kSmallPCDeltaBits bits.
385 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; 424 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta;
386 WriteMode(RelocInfo::PC_JUMP); 425 WriteMode(RelocInfo::PC_JUMP);
387 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; 426 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits;
388 DCHECK(pc_jump > 0); 427 DCHECK(pc_jump > 0);
389 // Write kChunkBits size chunks of the pc_jump. 428 // Write kChunkBits size chunks of the pc_jump.
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 2145
2107 2146
2108 void Assembler::DataAlign(int m) { 2147 void Assembler::DataAlign(int m) {
2109 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 2148 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
2110 while ((pc_offset() & (m - 1)) != 0) { 2149 while ((pc_offset() & (m - 1)) != 0) {
2111 db(0); 2150 db(0);
2112 } 2151 }
2113 } 2152 }
2114 } // namespace internal 2153 } // namespace internal
2115 } // namespace v8 2154 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698