summaryrefslogtreecommitdiff
path: root/chromium/v8/src/wasm/wasm-code-specialization.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/wasm/wasm-code-specialization.cc')
-rw-r--r--chromium/v8/src/wasm/wasm-code-specialization.cc70
1 files changed, 35 insertions, 35 deletions
diff --git a/chromium/v8/src/wasm/wasm-code-specialization.cc b/chromium/v8/src/wasm/wasm-code-specialization.cc
index 416d1d600ab..f261f44991a 100644
--- a/chromium/v8/src/wasm/wasm-code-specialization.cc
+++ b/chromium/v8/src/wasm/wasm-code-specialization.cc
@@ -83,32 +83,33 @@ bool IsAtWasmDirectCallTarget(RelocIterator& it) {
} // namespace
-CodeSpecialization::CodeSpecialization(Isolate* isolate, Zone* zone)
- : isolate_(isolate) {}
+CodeSpecialization::CodeSpecialization(Isolate* isolate, Zone* zone) {}
CodeSpecialization::~CodeSpecialization() {}
void CodeSpecialization::RelocateWasmContextReferences(Address new_context) {
DCHECK_NOT_NULL(new_context);
- DCHECK_NULL(new_wasm_context_address);
- new_wasm_context_address = new_context;
+ DCHECK_NULL(new_wasm_context_address_);
+ new_wasm_context_address_ = new_context;
}
void CodeSpecialization::PatchTableSize(uint32_t old_size, uint32_t new_size) {
- DCHECK(old_function_table_size == 0 && new_function_table_size == 0);
- old_function_table_size = old_size;
- new_function_table_size = new_size;
+ DCHECK(old_function_table_size_ == 0 && new_function_table_size_ == 0);
+ old_function_table_size_ = old_size;
+ new_function_table_size_ = new_size;
}
void CodeSpecialization::RelocateDirectCalls(
Handle<WasmInstanceObject> instance) {
- DCHECK(relocate_direct_calls_instance.is_null());
+ DCHECK(relocate_direct_calls_instance_.is_null());
DCHECK(!instance.is_null());
- relocate_direct_calls_instance = instance;
+ relocate_direct_calls_instance_ = instance;
}
void CodeSpecialization::RelocatePointer(Address old_ptr, Address new_ptr) {
- pointers_to_relocate.insert(std::make_pair(old_ptr, new_ptr));
+ DCHECK_EQ(0, pointers_to_relocate_.count(old_ptr));
+ DCHECK_EQ(0, pointers_to_relocate_.count(new_ptr));
+ pointers_to_relocate_.insert(std::make_pair(old_ptr, new_ptr));
}
bool CodeSpecialization::ApplyToWholeInstance(
@@ -147,14 +148,14 @@ bool CodeSpecialization::ApplyToWholeInstance(
// Patch all exported functions (JS_TO_WASM_FUNCTION).
int reloc_mode = 0;
// We need to patch WASM_CONTEXT_REFERENCE to put the correct address.
- if (new_wasm_context_address) {
+ if (new_wasm_context_address_) {
reloc_mode |= RelocInfo::ModeMask(RelocInfo::WASM_CONTEXT_REFERENCE);
}
// Patch CODE_TARGET if we shall relocate direct calls. If we patch direct
- // calls, the instance registered for that (relocate_direct_calls_instance)
+ // calls, the instance registered for that (relocate_direct_calls_instance_)
// should match the instance we currently patch (instance).
- if (!relocate_direct_calls_instance.is_null()) {
- DCHECK_EQ(instance, *relocate_direct_calls_instance);
+ if (!relocate_direct_calls_instance_.is_null()) {
+ DCHECK_EQ(instance, *relocate_direct_calls_instance_);
reloc_mode |=
RelocInfo::ModeMask(FLAG_wasm_jit_to_native ? RelocInfo::JS_TO_WASM_CALL
: RelocInfo::CODE_TARGET);
@@ -170,24 +171,23 @@ bool CodeSpecialization::ApplyToWholeInstance(
RelocInfo::Mode mode = it.rinfo()->rmode();
switch (mode) {
case RelocInfo::WASM_CONTEXT_REFERENCE:
- it.rinfo()->set_wasm_context_reference(export_wrapper->GetIsolate(),
- new_wasm_context_address,
+ it.rinfo()->set_wasm_context_reference(new_wasm_context_address_,
icache_flush_mode);
break;
case RelocInfo::JS_TO_WASM_CALL: {
DCHECK(FLAG_wasm_jit_to_native);
const WasmCode* new_code = native_module->GetCode(exp.index);
- it.rinfo()->set_js_to_wasm_address(
- nullptr, new_code->instructions().start(), SKIP_ICACHE_FLUSH);
+ it.rinfo()->set_js_to_wasm_address(new_code->instructions().start(),
+ SKIP_ICACHE_FLUSH);
} break;
case RelocInfo::CODE_TARGET: {
DCHECK(!FLAG_wasm_jit_to_native);
// Ignore calls to other builtins like ToNumber.
if (!IsAtWasmDirectCallTarget(it)) continue;
Code* new_code = Code::cast(code_table->get(exp.index));
- it.rinfo()->set_target_address(
- new_code->GetIsolate(), new_code->instruction_start(),
- UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
+ it.rinfo()->set_target_address(new_code->instruction_start(),
+ UPDATE_WRITE_BARRIER,
+ SKIP_ICACHE_FLUSH);
} break;
default:
UNREACHABLE();
@@ -210,9 +210,9 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
DCHECK_EQ(wasm::WasmCode::kFunction, code.GetWasmCode()->kind());
}
- bool patch_table_size = old_function_table_size || new_function_table_size;
- bool reloc_direct_calls = !relocate_direct_calls_instance.is_null();
- bool reloc_pointers = pointers_to_relocate.size() > 0;
+ bool patch_table_size = old_function_table_size_ || new_function_table_size_;
+ bool reloc_direct_calls = !relocate_direct_calls_instance_.is_null();
+ bool reloc_pointers = pointers_to_relocate_.size() > 0;
int reloc_mode = 0;
auto add_mode = [&reloc_mode](bool cond, RelocInfo::Mode mode) {
@@ -253,7 +253,7 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
// bytes to find the new compiled function.
size_t offset = it.rinfo()->pc() - code.GetCode()->instruction_start();
if (!patch_direct_calls_helper) {
- patch_direct_calls_helper.emplace(*relocate_direct_calls_instance,
+ patch_direct_calls_helper.emplace(*relocate_direct_calls_instance_,
*code.GetCode());
}
int byte_pos = AdvanceSourcePositionTableIterator(
@@ -262,10 +262,9 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
patch_direct_calls_helper->decoder,
patch_direct_calls_helper->func_bytes + byte_pos);
FixedArray* code_table =
- relocate_direct_calls_instance->compiled_module()->code_table();
+ relocate_direct_calls_instance_->compiled_module()->code_table();
Code* new_code = Code::cast(code_table->get(called_func_index));
- it.rinfo()->set_target_address(new_code->GetIsolate(),
- new_code->instruction_start(),
+ it.rinfo()->set_target_address(new_code->instruction_start(),
UPDATE_WRITE_BARRIER, icache_flush_mode);
changed = true;
} break;
@@ -280,7 +279,7 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
size_t offset =
it.rinfo()->pc() - code.GetWasmCode()->instructions().start();
if (!patch_direct_calls_helper) {
- patch_direct_calls_helper.emplace(*relocate_direct_calls_instance,
+ patch_direct_calls_helper.emplace(*relocate_direct_calls_instance_,
code.GetWasmCode());
}
int byte_pos = AdvanceSourcePositionTableIterator(
@@ -289,23 +288,24 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
patch_direct_calls_helper->decoder,
patch_direct_calls_helper->func_bytes + byte_pos);
const WasmCode* new_code = native_module->GetCode(called_func_index);
- it.rinfo()->set_wasm_call_address(
- isolate_, new_code->instructions().start(), icache_flush_mode);
+ it.rinfo()->set_wasm_call_address(new_code->instructions().start(),
+ icache_flush_mode);
changed = true;
} break;
case RelocInfo::WASM_GLOBAL_HANDLE: {
DCHECK(reloc_pointers);
Address old_ptr = it.rinfo()->global_handle();
- if (pointers_to_relocate.count(old_ptr) == 1) {
- Address new_ptr = pointers_to_relocate[old_ptr];
- it.rinfo()->set_global_handle(isolate_, new_ptr, icache_flush_mode);
+ auto entry = pointers_to_relocate_.find(old_ptr);
+ if (entry != pointers_to_relocate_.end()) {
+ Address new_ptr = entry->second;
+ it.rinfo()->set_global_handle(new_ptr, icache_flush_mode);
changed = true;
}
} break;
case RelocInfo::WASM_FUNCTION_TABLE_SIZE_REFERENCE:
DCHECK(patch_table_size);
it.rinfo()->update_wasm_function_table_size_reference(
- isolate_, old_function_table_size, new_function_table_size,
+ old_function_table_size_, new_function_table_size_,
icache_flush_mode);
changed = true;
break;