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

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 1759383003: [compiler] Add relocatable pointer constants for wasm memory references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips/mips64 compile Created 4 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 10
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 Node* ret = graph()->NewNode(jsgraph()->common()->Return(), val, call, start); 2031 Node* ret = graph()->NewNode(jsgraph()->common()->Return(), val, call, start);
2032 2032
2033 MergeControlToEnd(jsgraph(), ret); 2033 MergeControlToEnd(jsgraph(), ret);
2034 } 2034 }
2035 2035
2036 2036
2037 Node* WasmGraphBuilder::MemBuffer(uint32_t offset) { 2037 Node* WasmGraphBuilder::MemBuffer(uint32_t offset) {
2038 DCHECK(module_ && module_->instance); 2038 DCHECK(module_ && module_->instance);
2039 if (offset == 0) { 2039 if (offset == 0) {
2040 if (!mem_buffer_) { 2040 if (!mem_buffer_) {
2041 mem_buffer_ = jsgraph()->IntPtrConstant( 2041 mem_buffer_ = jsgraph()->RelocatableIntPtrConstant(
2042 reinterpret_cast<uintptr_t>(module_->instance->mem_start)); 2042 reinterpret_cast<uintptr_t>(module_->instance->mem_start),
2043 RelocInfo::WASM_MEMORY_REFERENCE);
2043 } 2044 }
2044 return mem_buffer_; 2045 return mem_buffer_;
2045 } else { 2046 } else {
2046 return jsgraph()->IntPtrConstant( 2047 return jsgraph()->RelocatableIntPtrConstant(
2047 reinterpret_cast<uintptr_t>(module_->instance->mem_start + offset)); 2048 reinterpret_cast<uintptr_t>(module_->instance->mem_start + offset),
2049 RelocInfo::WASM_MEMORY_REFERENCE);
2048 } 2050 }
2049 } 2051 }
2050 2052
2051 2053
2052 Node* WasmGraphBuilder::MemSize(uint32_t offset) { 2054 Node* WasmGraphBuilder::MemSize(uint32_t offset) {
2053 DCHECK(module_ && module_->instance); 2055 DCHECK(module_ && module_->instance);
2054 uint32_t size = static_cast<uint32_t>(module_->instance->mem_size); 2056 uint32_t size = static_cast<uint32_t>(module_->instance->mem_size);
2055 if (offset == 0) { 2057 if (offset == 0) {
2056 if (!mem_size_) mem_size_ = jsgraph()->Int32Constant(size); 2058 if (!mem_size_) mem_size_ = jsgraph()->Int32Constant(size);
2057 return mem_size_; 2059 return mem_size_;
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 module_env->module->GetName(function.name_offset)); 2485 module_env->module->GetName(function.name_offset));
2484 } 2486 }
2485 2487
2486 return code; 2488 return code;
2487 } 2489 }
2488 2490
2489 2491
2490 } // namespace compiler 2492 } // namespace compiler
2491 } // namespace internal 2493 } // namespace internal
2492 } // namespace v8 2494 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698