[wasm] Flush the instruction cache on the WasmCodeManager

Flush the icache after JIT-ing using the WasmCodeManager. Also, re-enable
tests that were previously failing on Linux ARM.

Bug: v8:7138
Change-Id: I8e18b80dba58df173a2360f8ac365ee5daaf3239
Reviewed-on: https://chromium-review.googlesource.com/802961
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Reviewed-by: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49800}
This commit is contained in:
Mircea Trofin 2017-12-01 08:13:36 -08:00 committed by Commit Bot
parent 2b14a3f7fe
commit e0447f9972
5 changed files with 14 additions and 18 deletions

View File

@ -290,6 +290,9 @@ WasmCode* NativeModule::AddOwnedCode(
auto insert_before = std::upper_bound(owned_code_.begin(), owned_code_.end(), auto insert_before = std::upper_bound(owned_code_.begin(), owned_code_.end(),
code, owned_code_comparer_); code, owned_code_comparer_);
owned_code_.insert(insert_before, std::move(code)); owned_code_.insert(insert_before, std::move(code));
wasm_code_manager_->FlushICache(ret->instructions().start(),
ret->instructions().size());
return ret; return ret;
} }
@ -904,6 +907,11 @@ intptr_t WasmCodeManager::remaining_uncommitted() const {
return remaining_uncommitted_.Value(); return remaining_uncommitted_.Value();
} }
void WasmCodeManager::FlushICache(Address start, size_t size) {
Assembler::FlushICache(reinterpret_cast<internal::Isolate*>(isolate_), start,
size);
}
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -361,6 +361,10 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
WasmCode* GetCodeFromStartAddress(Address pc) const; WasmCode* GetCodeFromStartAddress(Address pc) const;
intptr_t remaining_uncommitted() const; intptr_t remaining_uncommitted() const;
// TODO(mtrofin): replace this API with an alternative that is Isolate-
// independent.
void FlushICache(Address start, size_t size);
private: private:
friend class NativeModule; friend class NativeModule;
@ -383,6 +387,8 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
// worth requesting a GC on memory pressure. // worth requesting a GC on memory pressure.
size_t active_ = 0; size_t active_ = 0;
base::AtomicNumber<intptr_t> remaining_uncommitted_; base::AtomicNumber<intptr_t> remaining_uncommitted_;
// TODO(mtrofin): remove the dependency on isolate.
v8::Isolate* isolate_; v8::Isolate* isolate_;
}; };

View File

@ -385,10 +385,4 @@
'test-dtoa/*': [SKIP], 'test-dtoa/*': [SKIP],
}], # variant == wasm_traps }], # variant == wasm_traps
##############################################################################
# BUG(v8:7138).
['arch == arm and not simulator_run and variant == wasm_traps', {
'*': [SKIP],
}], # arch == arm and not simulator_run and variant == wasm_traps
] ]

View File

@ -36,10 +36,4 @@
# tested standalone. # tested standalone.
'fail/modules-skip*': [SKIP], 'fail/modules-skip*': [SKIP],
}], # ALWAYS }], # ALWAYS
##############################################################################
# BUG(v8:7138).
['arch == arm and not simulator_run and variant == wasm_traps', {
'*': [SKIP],
}], # arch == arm and not simulator_run and variant == wasm_traps
] ]

View File

@ -744,12 +744,6 @@
'wasm/liftoff': [SKIP], 'wasm/liftoff': [SKIP],
}], # arch != x64 and arch != ia32 }], # arch != x64 and arch != ia32
##############################################################################
# BUG(v8:7138).
['arch == arm and not simulator_run and variant == wasm_traps', {
'*': [SKIP],
}], # arch == arm and not simulator_run and variant == wasm_traps
############################################################################## ##############################################################################
['variant == liftoff', { ['variant == liftoff', {
# In the liftoff variant, liftoff compilation happens even though the test # In the liftoff variant, liftoff compilation happens even though the test