diff options
Diffstat (limited to 'deps/v8/src/ppc/macro-assembler-ppc.cc')
-rw-r--r-- | deps/v8/src/ppc/macro-assembler-ppc.cc | 135 |
1 files changed, 60 insertions, 75 deletions
diff --git a/deps/v8/src/ppc/macro-assembler-ppc.cc b/deps/v8/src/ppc/macro-assembler-ppc.cc index 7cd895583a..676cb2c60e 100644 --- a/deps/v8/src/ppc/macro-assembler-ppc.cc +++ b/deps/v8/src/ppc/macro-assembler-ppc.cc @@ -5,8 +5,6 @@ #include <assert.h> // For assert #include <limits.h> // For LONG_MIN, LONG_MAX. -#include "src/v8.h" - #if V8_TARGET_ARCH_PPC #include "src/base/bits.h" @@ -14,7 +12,7 @@ #include "src/bootstrapper.h" #include "src/codegen.h" #include "src/cpu-profiler.h" -#include "src/debug.h" +#include "src/debug/debug.h" #include "src/runtime/runtime.h" namespace v8 { @@ -176,26 +174,13 @@ void MacroAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, } -void MacroAssembler::Ret(Condition cond) { - DCHECK(cond == al); - blr(); -} - - -void MacroAssembler::Drop(int count, Condition cond) { - DCHECK(cond == al); +void MacroAssembler::Drop(int count) { if (count > 0) { Add(sp, sp, count * kPointerSize, r0); } } -void MacroAssembler::Ret(int drop, Condition cond) { - Drop(drop, cond); - Ret(cond); -} - - void MacroAssembler::Call(Label* target) { b(target, SetLK); } @@ -237,30 +222,59 @@ void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) { } -void MacroAssembler::MultiPush(RegList regs) { +void MacroAssembler::MultiPush(RegList regs, Register location) { int16_t num_to_push = NumberOfBitsSet(regs); int16_t stack_offset = num_to_push * kPointerSize; - subi(sp, sp, Operand(stack_offset)); - for (int16_t i = kNumRegisters - 1; i >= 0; i--) { + subi(location, location, Operand(stack_offset)); + for (int16_t i = Register::kNumRegisters - 1; i >= 0; i--) { if ((regs & (1 << i)) != 0) { stack_offset -= kPointerSize; - StoreP(ToRegister(i), MemOperand(sp, stack_offset)); + StoreP(ToRegister(i), MemOperand(location, stack_offset)); } } } -void MacroAssembler::MultiPop(RegList regs) { +void MacroAssembler::MultiPop(RegList regs, Register location) { int16_t stack_offset = 0; - for (int16_t i = 0; i < kNumRegisters; i++) { + for (int16_t i = 0; i < Register::kNumRegisters; i++) { if ((regs & (1 << i)) != 0) { - LoadP(ToRegister(i), MemOperand(sp, stack_offset)); + LoadP(ToRegister(i), MemOperand(location, stack_offset)); stack_offset += kPointerSize; } } - addi(sp, sp, Operand(stack_offset)); + addi(location, location, Operand(stack_offset)); +} + + +void MacroAssembler::MultiPushDoubles(RegList dregs, Register location) { + int16_t num_to_push = NumberOfBitsSet(dregs); + int16_t stack_offset = num_to_push * kDoubleSize; + + subi(location, location, Operand(stack_offset)); + for (int16_t i = DoubleRegister::kNumRegisters - 1; i >= 0; i--) { + if ((dregs & (1 << i)) != 0) { + DoubleRegister dreg = DoubleRegister::from_code(i); + stack_offset -= kDoubleSize; + stfd(dreg, MemOperand(location, stack_offset)); + } + } +} + + +void MacroAssembler::MultiPopDoubles(RegList dregs, Register location) { + int16_t stack_offset = 0; + + for (int16_t i = 0; i < DoubleRegister::kNumRegisters; i++) { + if ((dregs & (1 << i)) != 0) { + DoubleRegister dreg = DoubleRegister::from_code(i); + lfd(dreg, MemOperand(location, stack_offset)); + stack_offset += kDoubleSize; + } + } + addi(location, location, Operand(stack_offset)); } @@ -497,7 +511,7 @@ void MacroAssembler::RememberedSetHelper(Register object, // For debug tests. beq(&done, cr0); } else { DCHECK(and_then == kReturnAtEnd); - beq(&done, cr0); + Ret(eq, cr0); } mflr(r0); push(r0); @@ -838,7 +852,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { // Optionally save all volatile double registers. if (save_doubles) { - SaveFPRegs(sp, 0, DoubleRegister::kNumVolatileRegisters); + MultiPushDoubles(kCallerSavedDoubles); // Note that d0 will be accessible at // fp - ExitFrameConstants::kFrameSize - // kNumVolatileRegisters * kDoubleSize, @@ -904,7 +918,7 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, const int offset = (ExitFrameConstants::kFrameSize + kNumRegs * kDoubleSize); addi(r6, fp, Operand(-offset)); - RestoreFPRegs(r6, 0, kNumRegs); + MultiPopDoubles(kCallerSavedDoubles, r6); } // Clear top frame. @@ -1147,10 +1161,11 @@ void MacroAssembler::IsObjectNameType(Register object, Register scratch, void MacroAssembler::DebugBreak() { li(r3, Operand::Zero()); - mov(r4, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); + mov(r4, + Operand(ExternalReference(Runtime::kHandleDebuggerStatement, isolate()))); CEntryStub ces(isolate(), 1); DCHECK(AllowThisStubCall(&ces)); - Call(ces.GetCode(), RelocInfo::DEBUG_BREAK); + Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); } @@ -1583,26 +1598,6 @@ void MacroAssembler::Allocate(Register object_size, Register result, } -void MacroAssembler::UndoAllocationInNewSpace(Register object, - Register scratch) { - ExternalReference new_space_allocation_top = - ExternalReference::new_space_allocation_top_address(isolate()); - - // Make sure the object has no tag before resetting top. - ClearRightImm(object, object, Operand(kHeapObjectTagSize)); -#ifdef DEBUG - // Check that the object un-allocated is below the current top. - mov(scratch, Operand(new_space_allocation_top)); - LoadP(scratch, MemOperand(scratch)); - cmp(object, scratch); - Check(lt, kUndoAllocationOfNonAllocatedMemory); -#endif - // Write the address of the object to un-allocate as the current top. - mov(scratch, Operand(new_space_allocation_top)); - StoreP(object, MemOperand(scratch)); -} - - void MacroAssembler::AllocateTwoByteString(Register result, Register length, Register scratch1, Register scratch2, Register scratch3, @@ -2987,28 +2982,6 @@ void MacroAssembler::InitializeFieldsWithFiller(Register start_offset, } -void MacroAssembler::SaveFPRegs(Register location, int first, int count) { - DCHECK(count > 0); - int cur = first; - subi(location, location, Operand(count * kDoubleSize)); - for (int i = 0; i < count; i++) { - DoubleRegister reg = DoubleRegister::from_code(cur++); - stfd(reg, MemOperand(location, i * kDoubleSize)); - } -} - - -void MacroAssembler::RestoreFPRegs(Register location, int first, int count) { - DCHECK(count > 0); - int cur = first + count - 1; - for (int i = count - 1; i >= 0; i--) { - DoubleRegister reg = DoubleRegister::from_code(cur--); - lfd(reg, MemOperand(location, i * kDoubleSize)); - } - addi(location, location, Operand(count * kDoubleSize)); -} - - void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialOneByte( Register first, Register second, Register scratch1, Register scratch2, Label* failure) { @@ -4557,23 +4530,35 @@ void MacroAssembler::JumpIfDictionaryInPrototypeChain(Register object, Register scratch1, Label* found) { DCHECK(!scratch1.is(scratch0)); - Factory* factory = isolate()->factory(); Register current = scratch0; - Label loop_again; + Label loop_again, end; // scratch contained elements pointer. mr(current, object); + LoadP(current, FieldMemOperand(current, HeapObject::kMapOffset)); + LoadP(current, FieldMemOperand(current, Map::kPrototypeOffset)); + CompareRoot(current, Heap::kNullValueRootIndex); + beq(&end); // Loop based on the map going up the prototype chain. bind(&loop_again); LoadP(current, FieldMemOperand(current, HeapObject::kMapOffset)); + + STATIC_ASSERT(JS_PROXY_TYPE < JS_OBJECT_TYPE); + STATIC_ASSERT(JS_VALUE_TYPE < JS_OBJECT_TYPE); + lbz(scratch1, FieldMemOperand(current, Map::kInstanceTypeOffset)); + cmpi(scratch1, Operand(JS_OBJECT_TYPE)); + blt(found); + lbz(scratch1, FieldMemOperand(current, Map::kBitField2Offset)); DecodeField<Map::ElementsKindBits>(scratch1); cmpi(scratch1, Operand(DICTIONARY_ELEMENTS)); beq(found); LoadP(current, FieldMemOperand(current, Map::kPrototypeOffset)); - Cmpi(current, Operand(factory->null_value()), r0); + CompareRoot(current, Heap::kNullValueRootIndex); bne(&loop_again); + + bind(&end); } |