Commit 31026cd5 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: Make FlushICache part of Assembler(Base) and take Isolate as parameter.

Port 9fc4fc14

R=mlippautz@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, dstence@us.ibm.com
BUG=chromium:524425
LOG=N

Review URL: https://codereview.chromium.org/1339673002

Cr-Commit-Position: refs/heads/master@{#30698}
parent 62ab109d
......@@ -698,7 +698,7 @@ void Assembler::set_target_address_at(Address pc, Address constant_pool,
*(p + 3) = instr4;
*(p + 4) = instr5;
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
CpuFeatures::FlushICache(p, 5 * kInstrSize);
Assembler::FlushICacheWithoutIsolate(p, 5 * kInstrSize);
}
#else
uint32_t* p = reinterpret_cast<uint32_t*>(pc);
......@@ -713,7 +713,7 @@ void Assembler::set_target_address_at(Address pc, Address constant_pool,
*p = instr1;
*(p + 1) = instr2;
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
CpuFeatures::FlushICache(p, 2 * kInstrSize);
Assembler::FlushICacheWithoutIsolate(p, 2 * kInstrSize);
}
#endif
return;
......
......@@ -147,7 +147,8 @@ class RecordWriteStub : public PlatformCodeStub {
break;
}
DCHECK(GetMode(stub) == mode);
CpuFeatures::FlushICache(stub->instruction_start() + Assembler::kInstrSize,
Assembler::FlushICache(stub->GetIsolate(),
stub->instruction_start() + Assembler::kInstrSize,
2 * Assembler::kInstrSize);
}
......
......@@ -62,7 +62,7 @@ UnaryMathFunction CreateExpFunction() {
DCHECK(!RelocInfo::RequiresRelocation(desc));
#endif
CpuFeatures::FlushICache(buffer, actual_size);
Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
base::OS::ProtectCode(buffer, actual_size);
#if !defined(USE_SIMULATOR)
......@@ -99,7 +99,7 @@ UnaryMathFunction CreateSqrtFunction() {
DCHECK(!RelocInfo::RequiresRelocation(desc));
#endif
CpuFeatures::FlushICache(buffer, actual_size);
Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
base::OS::ProtectCode(buffer, actual_size);
return FUNCTION_CAST<UnaryMathFunction>(buffer);
#endif
......@@ -660,7 +660,7 @@ void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, Code::Age age,
uint32_t young_length = isolate->code_aging_helper()->young_sequence_length();
if (age == kNoAgeCodeAge) {
isolate->code_aging_helper()->CopyYoungSequenceTo(sequence);
CpuFeatures::FlushICache(sequence, young_length);
Assembler::FlushICache(isolate, sequence, young_length);
} else {
// FIXED_SEQUENCE
Code* stub = GetCodeAgeStub(isolate, age, parity);
......
......@@ -8,26 +8,12 @@
#include "src/assembler.h"
#include "src/macro-assembler.h"
#include "src/simulator.h" // for cache flushing.
namespace v8 {
namespace internal {
void CpuFeatures::FlushICache(void* buffer, size_t size) {
// Nothing to do flushing no instructions.
if (size == 0) {
return;
}
#if defined(USE_SIMULATOR)
// Not generating PPC instructions for C-code. This means that we are
// building an PPC emulator based target. We should notify the simulator
// that the Icache was flushed.
// None of this code ends up in the snapshot so there are no issues
// around whether or not to generate the code when building snapshots.
Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), buffer, size);
#else
#if !defined(USE_SIMULATOR)
if (CpuFeatures::IsSupported(INSTR_AND_DATA_CACHE_COHERENCY)) {
__asm__ __volatile__(
"sync \n"
......@@ -54,7 +40,7 @@ void CpuFeatures::FlushICache(void* buffer, size_t size) {
: "r"(pointer));
}
#endif // USE_SIMULATOR
#endif // !USE_SIMULATOR
}
} // namespace internal
} // namespace v8
......
......@@ -4380,7 +4380,7 @@ CodePatcher::CodePatcher(byte* address, int instructions,
CodePatcher::~CodePatcher() {
// Indicate that code has changed.
if (flush_cache_ == FLUSH) {
CpuFeatures::FlushICache(address_, size_);
Assembler::FlushICacheWithoutIsolate(address_, size_);
}
// Check that the code was patched as expected.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment