From: mbrandy Date: Fri, 11 Sep 2015 15:09:56 +0000 (-0700) Subject: PPC: Make FlushICache part of Assembler(Base) and take Isolate as parameter. X-Git-Tag: upstream/4.7.83~342 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31026cd5a0e192b6b1f79f4b27bcbadca60c265e;p=platform%2Fupstream%2Fv8.git PPC: Make FlushICache part of Assembler(Base) and take Isolate as parameter. Port 9fc4fc141fa1d1aa1a3ccb901518cdffa0d6d268 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} --- diff --git a/src/ppc/assembler-ppc-inl.h b/src/ppc/assembler-ppc-inl.h index 35968fc68..b1e282575 100644 --- a/src/ppc/assembler-ppc-inl.h +++ b/src/ppc/assembler-ppc-inl.h @@ -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(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; diff --git a/src/ppc/code-stubs-ppc.h b/src/ppc/code-stubs-ppc.h index 85f3c9ca9..bc6c26b21 100644 --- a/src/ppc/code-stubs-ppc.h +++ b/src/ppc/code-stubs-ppc.h @@ -147,8 +147,9 @@ class RecordWriteStub : public PlatformCodeStub { break; } DCHECK(GetMode(stub) == mode); - CpuFeatures::FlushICache(stub->instruction_start() + Assembler::kInstrSize, - 2 * Assembler::kInstrSize); + Assembler::FlushICache(stub->GetIsolate(), + stub->instruction_start() + Assembler::kInstrSize, + 2 * Assembler::kInstrSize); } DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); diff --git a/src/ppc/codegen-ppc.cc b/src/ppc/codegen-ppc.cc index 3032da8b1..b313d11bb 100644 --- a/src/ppc/codegen-ppc.cc +++ b/src/ppc/codegen-ppc.cc @@ -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(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); diff --git a/src/ppc/cpu-ppc.cc b/src/ppc/cpu-ppc.cc index 079aa2340..a42fa5396 100644 --- a/src/ppc/cpu-ppc.cc +++ b/src/ppc/cpu-ppc.cc @@ -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 diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc index af9d261b9..d7697f062 100644 --- a/src/ppc/macro-assembler-ppc.cc +++ b/src/ppc/macro-assembler-ppc.cc @@ -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.