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

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: feedback 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
« no previous file with comments | « src/assembler.h ('k') | src/ia32/assembler-ia32.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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 const int kChunkMask = (1 << kChunkBits) - 1; 365 const int kChunkMask = (1 << kChunkBits) - 1;
366 const int kLastChunkTagBits = 1; 366 const int kLastChunkTagBits = 1;
367 const int kLastChunkTagMask = 1; 367 const int kLastChunkTagMask = 1;
368 const int kLastChunkTag = 1; 368 const int kLastChunkTag = 1;
369 369
370 const int kCodeWithIdTag = 0; 370 const int kCodeWithIdTag = 0;
371 const int kNonstatementPositionTag = 1; 371 const int kNonstatementPositionTag = 1;
372 const int kStatementPositionTag = 2; 372 const int kStatementPositionTag = 2;
373 const int kDeoptReasonTag = 3; 373 const int kDeoptReasonTag = 3;
374 374
375 void RelocInfo::update_wasm_memory_reference(
376 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
377 ICacheFlushMode icache_flush_mode) {
378 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
379 if (IsWasmMemoryReference(rmode_)) {
380 Address updated_reference;
381 DCHECK(old_size == 0 || Memory::IsAddressInRange(
382 old_base, wasm_memory_reference(), old_size));
383 updated_reference = new_base + (wasm_memory_reference() - old_base);
384 DCHECK(new_size == 0 ||
385 Memory::IsAddressInRange(new_base, updated_reference, new_size));
386 unchecked_update_wasm_memory_reference(updated_reference,
387 icache_flush_mode);
388 } else if (IsWasmMemorySizeReference(rmode_)) {
389 uint32_t updated_size_reference;
390 DCHECK(old_size == 0 || wasm_memory_size_reference() <= old_size);
391 updated_size_reference =
392 new_size + (wasm_memory_size_reference() - old_size);
393 DCHECK(updated_size_reference <= new_size);
394 unchecked_update_wasm_memory_size(updated_size_reference,
395 icache_flush_mode);
396 } else {
397 UNREACHABLE();
398 }
399 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
400 Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
401 }
402 }
403
404 void RelocInfo::update_wasm_global_reference(
405 Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) {
406 DCHECK(IsWasmGlobalReference(rmode_));
407 Address updated_reference;
408 DCHECK(reinterpret_cast<uintptr_t>(old_base) <=
409 reinterpret_cast<uintptr_t>(wasm_global_reference()));
410 updated_reference = new_base + (wasm_global_reference() - old_base);
411 DCHECK(reinterpret_cast<uintptr_t>(new_base) <=
412 reinterpret_cast<uintptr_t>(updated_reference));
413 unchecked_update_wasm_memory_reference(updated_reference, icache_flush_mode);
414 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
415 Assembler::FlushICache(isolate_, pc_, sizeof(int32_t));
416 }
417 }
375 418
376 uint32_t RelocInfoWriter::WriteLongPCJump(uint32_t pc_delta) { 419 uint32_t RelocInfoWriter::WriteLongPCJump(uint32_t pc_delta) {
377 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. 420 // Return if the pc_delta can fit in kSmallPCDeltaBits bits.
378 // Otherwise write a variable length PC jump for the bits that do 421 // Otherwise write a variable length PC jump for the bits that do
379 // not fit in the kSmallPCDeltaBits bits. 422 // not fit in the kSmallPCDeltaBits bits.
380 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; 423 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta;
381 WriteMode(RelocInfo::PC_JUMP); 424 WriteMode(RelocInfo::PC_JUMP);
382 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; 425 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits;
383 DCHECK(pc_jump > 0); 426 DCHECK(pc_jump > 0);
384 // Write kChunkBits size chunks of the pc_jump. 427 // Write kChunkBits size chunks of the pc_jump.
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 2096
2054 2097
2055 void Assembler::DataAlign(int m) { 2098 void Assembler::DataAlign(int m) {
2056 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 2099 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
2057 while ((pc_offset() & (m - 1)) != 0) { 2100 while ((pc_offset() & (m - 1)) != 0) {
2058 db(0); 2101 db(0);
2059 } 2102 }
2060 } 2103 }
2061 } // namespace internal 2104 } // namespace internal
2062 } // namespace v8 2105 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698