diff options
author | Alexandre Rames <alexandre.rames@linaro.org> | 2016-10-25 17:20:51 +0100 |
---|---|---|
committer | Alexandre Rames <alexandre.rames@linaro.org> | 2016-10-26 11:27:43 +0100 |
commit | 07d1aa5b941ace15deb01e5df2c79e677039c4ae (patch) | |
tree | 1999287bc79caa85d949311c916162f7e11359cd /src/aarch64/macro-assembler-aarch64.h | |
parent | fac0a468cc6d7319f12a279beaded4236b6b394d (diff) |
AArch64: follow the design guidelines for `ExactAssemblyScope`.
Change-Id: I5b942e033681c69f5e6cac3a669b3b3ebacbf1f8
Diffstat (limited to 'src/aarch64/macro-assembler-aarch64.h')
-rw-r--r-- | src/aarch64/macro-assembler-aarch64.h | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/src/aarch64/macro-assembler-aarch64.h b/src/aarch64/macro-assembler-aarch64.h index 437ca7aa..dbad4557 100644 --- a/src/aarch64/macro-assembler-aarch64.h +++ b/src/aarch64/macro-assembler-aarch64.h @@ -3160,56 +3160,15 @@ inline void LiteralPool::SetNextRecommendedCheckpoint(ptrdiff_t offset) { recommended_checkpoint_ = offset; } -// Use this scope when you need a one-to-one mapping between methods and -// instructions. This scope prevents the MacroAssembler from being called and -// pools from being emitted. It also asserts the number of instructions emitted -// is what you specified when creating the scope. -class InstructionAccurateScope : public EmissionCheckScope { +class InstructionAccurateScope : public ExactAssemblyScope { public: - InstructionAccurateScope(MacroAssembler* masm, - int64_t count, - SizePolicy size_policy = kExactSize) - : EmissionCheckScope(masm, (count * kInstructionSize), size_policy) { - VIXL_ASSERT(size_policy != kNoAssert); -#ifdef VIXL_DEBUG - old_allow_macro_instructions_ = masm->AllowMacroInstructions(); - masm->SetAllowMacroInstructions(false); -#else - USE(old_allow_macro_instructions_); -#endif - } - - virtual ~InstructionAccurateScope() { -#ifdef VIXL_DEBUG - MacroAssembler* masm = reinterpret_cast<MacroAssembler*>(assembler_); - masm->SetAllowMacroInstructions(old_allow_macro_instructions_); -#endif - } - - private: - InstructionAccurateScope(MacroAssembler* masm, - int64_t count, - SizePolicy size_policy, - PoolPolicy pool_policy) - : EmissionCheckScope(masm, - (count * kInstructionSize), - size_policy, - pool_policy) { - VIXL_ASSERT(size_policy != kNoAssert); -#ifdef VIXL_DEBUG - old_allow_macro_instructions_ = masm->AllowMacroInstructions(); - masm->SetAllowMacroInstructions(false); -#endif - } - - // Grant access to the above private constructor for pool emission methods. - friend void LiteralPool::Emit(LiteralPool::EmitOption); - friend void VeneerPool::Emit(VeneerPool::EmitOption, size_t); - - bool old_allow_macro_instructions_; + VIXL_DEPRECATED("ExactAssemblyScope", + InstructionAccurateScope(MacroAssembler* masm, + int64_t count, + SizePolicy size_policy = kExactSize)) + : ExactAssemblyScope(masm, count * kInstructionSize, size_policy) {} }; - class BlockLiteralPoolScope { public: explicit BlockLiteralPoolScope(MacroAssembler* masm) : masm_(masm) { @@ -3388,7 +3347,7 @@ void MacroAssembler::CallRuntime(R (*function)(P...)) { Label start; bind(&start); { - InstructionAccurateScope scope(this, 1); + ExactAssemblyScope scope(this, kInstructionSize); hlt(kRuntimeCallOpcode); } VIXL_ASSERT(GetSizeOfCodeGeneratedSince(&start) == |