diff options
Diffstat (limited to 'deps/v8/src/builtins/ppc/builtins-ppc.cc')
-rw-r--r-- | deps/v8/src/builtins/ppc/builtins-ppc.cc | 492 |
1 files changed, 268 insertions, 224 deletions
diff --git a/deps/v8/src/builtins/ppc/builtins-ppc.cc b/deps/v8/src/builtins/ppc/builtins-ppc.cc index 460d7492970..367838f82cc 100644 --- a/deps/v8/src/builtins/ppc/builtins-ppc.cc +++ b/deps/v8/src/builtins/ppc/builtins-ppc.cc @@ -87,7 +87,7 @@ void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args, // here which will cause scratch to become negative. __ sub(scratch, sp, scratch); // Check if the arguments will overflow the stack. - __ ShiftLeftImm(r0, num_args, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r0, num_args, Operand(kSystemPointerSizeLog2)); __ cmp(scratch, r0); __ ble(stack_overflow); // Signed comparison. } @@ -130,16 +130,16 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) { // -- r6: new target // -- r7: pointer to last argument // -- cr0: condition indicating whether r3 is zero - // -- sp[0*kPointerSize]: the hole (receiver) - // -- sp[1*kPointerSize]: number of arguments (tagged) - // -- sp[2*kPointerSize]: context + // -- sp[0*kSystemPointerSize]: the hole (receiver) + // -- sp[1*kSystemPointerSize]: number of arguments (tagged) + // -- sp[2*kSystemPointerSize]: context // ----------------------------------- __ beq(&no_args, cr0); - __ ShiftLeftImm(scratch, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(scratch, r3, Operand(kSystemPointerSizeLog2)); __ sub(sp, sp, scratch); __ mtctr(r3); __ bind(&loop); - __ subi(scratch, scratch, Operand(kPointerSize)); + __ subi(scratch, scratch, Operand(kSystemPointerSize)); __ LoadPX(r0, MemOperand(r7, scratch)); __ StorePX(r0, MemOperand(sp, scratch)); __ bdnz(&loop); @@ -166,7 +166,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) { __ SmiToPtrArrayOffset(r4, r4); __ add(sp, sp, r4); - __ addi(sp, sp, Operand(kPointerSize)); + __ addi(sp, sp, Operand(kSystemPointerSize)); __ blr(); __ bind(&stack_overflow); @@ -202,14 +202,15 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { __ Push(r6); // ----------- S t a t e ------------- - // -- sp[0*kPointerSize]: new target - // -- sp[1*kPointerSize]: padding - // -- r4 and sp[2*kPointerSize]: constructor function - // -- sp[3*kPointerSize]: number of arguments (tagged) - // -- sp[4*kPointerSize]: context + // -- sp[0*kSystemPointerSize]: new target + // -- sp[1*kSystemPointerSize]: padding + // -- r4 and sp[2*kSystemPointerSize]: constructor function + // -- sp[3*kSystemPointerSize]: number of arguments (tagged) + // -- sp[4*kSystemPointerSize]: context // ----------------------------------- - __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); __ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kFlagsOffset)); __ DecodeField<SharedFunctionInfo::FunctionKindBits>(r7); __ JumpIfIsInRange(r7, kDefaultDerivedConstructor, kDerivedConstructor, @@ -228,11 +229,11 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- r3: receiver - // -- Slot 4 / sp[0*kPointerSize]: new target - // -- Slot 3 / sp[1*kPointerSize]: padding - // -- Slot 2 / sp[2*kPointerSize]: constructor function - // -- Slot 1 / sp[3*kPointerSize]: number of arguments (tagged) - // -- Slot 0 / sp[4*kPointerSize]: context + // -- Slot 4 / sp[0*kSystemPointerSize]: new target + // -- Slot 3 / sp[1*kSystemPointerSize]: padding + // -- Slot 2 / sp[2*kSystemPointerSize]: constructor function + // -- Slot 1 / sp[3*kSystemPointerSize]: number of arguments (tagged) + // -- Slot 0 / sp[4*kSystemPointerSize]: context // ----------------------------------- // Deoptimizer enters here. masm->isolate()->heap()->SetConstructStubCreateDeoptPCOffset( @@ -248,12 +249,12 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- r6: new target - // -- sp[0*kPointerSize]: implicit receiver - // -- sp[1*kPointerSize]: implicit receiver - // -- sp[2*kPointerSize]: padding - // -- sp[3*kPointerSize]: constructor function - // -- sp[4*kPointerSize]: number of arguments (tagged) - // -- sp[5*kPointerSize]: context + // -- sp[0*kSystemPointerSize]: implicit receiver + // -- sp[1*kSystemPointerSize]: implicit receiver + // -- sp[2*kSystemPointerSize]: padding + // -- sp[3*kSystemPointerSize]: constructor function + // -- sp[4*kSystemPointerSize]: number of arguments (tagged) + // -- sp[5*kSystemPointerSize]: context // ----------------------------------- // Restore constructor function and argument count. @@ -284,20 +285,20 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { // -- r6: new target // -- r7: pointer to last argument // -- cr0: condition indicating whether r3 is zero - // -- sp[0*kPointerSize]: implicit receiver - // -- sp[1*kPointerSize]: implicit receiver - // -- sp[2*kPointerSize]: padding - // -- r4 and sp[3*kPointerSize]: constructor function - // -- sp[4*kPointerSize]: number of arguments (tagged) - // -- sp[5*kPointerSize]: context + // -- sp[0*kSystemPointerSize]: implicit receiver + // -- sp[1*kSystemPointerSize]: implicit receiver + // -- sp[2*kSystemPointerSize]: padding + // -- r4 and sp[3*kSystemPointerSize]: constructor function + // -- sp[4*kSystemPointerSize]: number of arguments (tagged) + // -- sp[5*kSystemPointerSize]: context // ----------------------------------- __ cmpi(r3, Operand::Zero()); __ beq(&no_args); - __ ShiftLeftImm(r9, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r9, r3, Operand(kSystemPointerSizeLog2)); __ sub(sp, sp, r9); __ mtctr(r3); __ bind(&loop); - __ subi(r9, r9, Operand(kPointerSize)); + __ subi(r9, r9, Operand(kSystemPointerSize)); __ LoadPX(r0, MemOperand(r7, r9)); __ StorePX(r0, MemOperand(sp, r9)); __ bdnz(&loop); @@ -311,11 +312,11 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- r0: constructor result - // -- sp[0*kPointerSize]: implicit receiver - // -- sp[1*kPointerSize]: padding - // -- sp[2*kPointerSize]: constructor function - // -- sp[3*kPointerSize]: number of arguments - // -- sp[4*kPointerSize]: context + // -- sp[0*kSystemPointerSize]: implicit receiver + // -- sp[1*kSystemPointerSize]: padding + // -- sp[2*kSystemPointerSize]: constructor function + // -- sp[3*kSystemPointerSize]: number of arguments + // -- sp[4*kSystemPointerSize]: context // ----------------------------------- // Store offset of return address for deoptimizer. @@ -366,7 +367,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { __ SmiToPtrArrayOffset(r4, r4); __ add(sp, sp, r4); - __ addi(sp, sp, Operand(kPointerSize)); + __ addi(sp, sp, Operand(kSystemPointerSize)); __ blr(); } @@ -381,8 +382,9 @@ static void GetSharedFunctionInfoBytecode(MacroAssembler* masm, __ CompareObjectType(sfi_data, scratch1, scratch1, INTERPRETER_DATA_TYPE); __ bne(&done); - __ LoadP(sfi_data, - FieldMemOperand(sfi_data, InterpreterData::kBytecodeArrayOffset)); + __ LoadTaggedPointerField( + sfi_data, + FieldMemOperand(sfi_data, InterpreterData::kBytecodeArrayOffset)); __ bind(&done); } @@ -396,14 +398,16 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { __ AssertGeneratorObject(r4); // Store input value into generator object. - __ StoreP(r3, FieldMemOperand(r4, JSGeneratorObject::kInputOrDebugPosOffset), - r0); + __ StoreTaggedField( + r3, FieldMemOperand(r4, JSGeneratorObject::kInputOrDebugPosOffset), r0); __ RecordWriteField(r4, JSGeneratorObject::kInputOrDebugPosOffset, r3, r6, kLRHasNotBeenSaved, kDontSaveFPRegs); // Load suspended function and context. - __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); - __ LoadP(cp, FieldMemOperand(r7, JSFunction::kContextOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); + __ LoadTaggedPointerField(cp, + FieldMemOperand(r7, JSFunction::kContextOffset)); // Flood function if we are stepping. Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; @@ -436,7 +440,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { __ blt(&stack_overflow); // Push receiver. - __ LoadP(scratch, FieldMemOperand(r4, JSGeneratorObject::kReceiverOffset)); + __ LoadTaggedPointerField( + scratch, FieldMemOperand(r4, JSGeneratorObject::kReceiverOffset)); __ Push(scratch); // ----------- S t a t e ------------- @@ -448,23 +453,26 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { // ----------------------------------- // Copy the function arguments from the generator object's register file. - __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); __ LoadHalfWord( r6, FieldMemOperand(r6, SharedFunctionInfo::kFormalParameterCountOffset)); - __ LoadP(r5, FieldMemOperand( - r4, JSGeneratorObject::kParametersAndRegistersOffset)); + __ LoadTaggedPointerField( + r5, + FieldMemOperand(r4, JSGeneratorObject::kParametersAndRegistersOffset)); { Label loop, done_loop; __ cmpi(r6, Operand::Zero()); __ ble(&done_loop); - // setup r9 to first element address - kPointerSize + // setup r9 to first element address - kTaggedSize __ addi(r9, r5, - Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); + Operand(FixedArray::kHeaderSize - kHeapObjectTag - kTaggedSize)); __ mtctr(r6); __ bind(&loop); - __ LoadPU(scratch, MemOperand(r9, kPointerSize)); + __ LoadAnyTaggedField(scratch, MemOperand(r9, kTaggedSize)); + __ addi(r9, r9, Operand(kTaggedSize)); __ push(scratch); __ bdnz(&loop); @@ -473,8 +481,10 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { // Underlying function needs to have bytecode available. if (FLAG_debug_code) { - __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); - __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset)); + __ LoadTaggedPointerField( + r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset)); GetSharedFunctionInfoBytecode(masm, r6, r3); __ CompareObjectType(r6, r6, r6, BYTECODE_ARRAY_TYPE); __ Assert(eq, AbortReason::kMissingBytecodeArray); @@ -488,7 +498,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { __ mr(r6, r4); __ mr(r4, r7); static_assert(kJavaScriptCallCodeStartRegister == r5, "ABI mismatch"); - __ LoadP(r5, FieldMemOperand(r4, JSFunction::kCodeOffset)); + __ LoadTaggedPointerField(r5, FieldMemOperand(r4, JSFunction::kCodeOffset)); __ JumpCodeObject(r5); } @@ -500,7 +510,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { __ PushRoot(RootIndex::kTheHoleValue); __ CallRuntime(Runtime::kDebugOnFunctionCall); __ Pop(r4); - __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); } __ b(&stepping_prepared); @@ -510,7 +521,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { __ Push(r4); __ CallRuntime(Runtime::kDebugPrepareStepInSuspendedGenerator); __ Pop(r4); - __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); } __ b(&stepping_prepared); @@ -560,7 +572,7 @@ void Generate_JSEntryVariant(MacroAssembler* masm, StackFrame::Type type, // PPC LINUX ABI: // preserve LR in pre-reserved slot in caller's frame __ mflr(r0); - __ StoreP(r0, MemOperand(sp, kStackFrameLRSlot * kPointerSize)); + __ StoreP(r0, MemOperand(sp, kStackFrameLRSlot * kSystemPointerSize)); // Save callee saved registers on the stack. __ MultiPush(kCalleeSaved); @@ -695,7 +707,7 @@ void Generate_JSEntryVariant(MacroAssembler* masm, StackFrame::Type type, __ MultiPop(kCalleeSaved); // Return - __ LoadP(r0, MemOperand(sp, kStackFrameLRSlot * kPointerSize)); + __ LoadP(r0, MemOperand(sp, kStackFrameLRSlot * kSystemPointerSize)); __ mtlr(r0); __ blr(); } @@ -729,7 +741,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc, // here which will cause scratch1 to become negative. __ sub(scratch1, sp, scratch1); // Check if the arguments will overflow the stack. - __ ShiftLeftImm(scratch2, argc, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(scratch2, argc, Operand(kSystemPointerSizeLog2)); __ cmp(scratch1, scratch2); __ bgt(&okay); // Signed comparison. @@ -787,13 +799,13 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, // r3: argc // r8: argv, i.e. points to first arg Label loop, entry; - __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r0, r3, Operand(kSystemPointerSizeLog2)); __ add(r5, r8, r0); // r5 points past last arg. __ b(&entry); __ bind(&loop); __ LoadP(r9, MemOperand(r8)); // read next parameter - __ addi(r8, r8, Operand(kPointerSize)); + __ addi(r8, r8, Operand(kSystemPointerSize)); __ LoadP(r0, MemOperand(r9)); // dereference handle __ push(r0); // push parameter __ bind(&entry); @@ -851,8 +863,8 @@ static void ReplaceClosureCodeWithOptimizedCode(MacroAssembler* masm, Register scratch1, Register scratch2) { // Store code entry in the closure. - __ StoreP(optimized_code, FieldMemOperand(closure, JSFunction::kCodeOffset), - r0); + __ StoreTaggedField(optimized_code, + FieldMemOperand(closure, JSFunction::kCodeOffset), r0); __ mr(scratch1, optimized_code); // Write barrier clobbers scratch1 below. __ RecordWriteField(closure, JSFunction::kCodeOffset, scratch1, scratch2, kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, @@ -900,8 +912,9 @@ static void TailCallOptimizedCodeSlot(MacroAssembler* masm, // Check if the optimized code is marked for deopt. If it is, call the // runtime to clear it. Label found_deoptimized_code; - __ LoadP(scratch, FieldMemOperand(optimized_code_entry, - Code::kCodeDataContainerOffset)); + __ LoadTaggedPointerField( + scratch, + FieldMemOperand(optimized_code_entry, Code::kCodeDataContainerOffset)); __ LoadWordArith( scratch, FieldMemOperand(scratch, CodeDataContainer::kKindSpecificFlagsOffset)); @@ -1057,10 +1070,12 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { // Get the bytecode array from the function object and load it into // kInterpreterBytecodeArrayRegister. - __ LoadP(r3, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r3, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); // Load original bytecode array or the debug copy. - __ LoadP(kInterpreterBytecodeArrayRegister, - FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); + __ LoadTaggedPointerField( + kInterpreterBytecodeArrayRegister, + FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); GetSharedFunctionInfoBytecode(masm, kInterpreterBytecodeArrayRegister, r7); // The bytecode array could have been flushed from the shared function info, @@ -1071,15 +1086,17 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { __ bne(&compile_lazy); // Load the feedback vector from the closure. - __ LoadP(feedback_vector, - FieldMemOperand(closure, JSFunction::kFeedbackCellOffset)); - __ LoadP(feedback_vector, - FieldMemOperand(feedback_vector, Cell::kValueOffset)); + __ LoadTaggedPointerField( + feedback_vector, + FieldMemOperand(closure, JSFunction::kFeedbackCellOffset)); + __ LoadTaggedPointerField( + feedback_vector, FieldMemOperand(feedback_vector, Cell::kValueOffset)); Label push_stack_frame; // Check if feedback vector is valid. If valid, check for optimized code // and update invocation count. Otherwise, setup the stack frame. - __ LoadP(r7, FieldMemOperand(feedback_vector, HeapObject::kMapOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(feedback_vector, HeapObject::kMapOffset)); __ LoadHalfWord(r7, FieldMemOperand(r7, Map::kInstanceTypeOffset)); __ cmpi(r7, Operand(FEEDBACK_VECTOR_TYPE)); __ bne(&push_stack_frame); @@ -1087,9 +1104,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { Register optimized_code_entry = r7; // Read off the optimized code slot in the feedback vector. - __ LoadP(optimized_code_entry, - FieldMemOperand(feedback_vector, - FeedbackVector::kOptimizedCodeWeakOrSmiOffset)); + __ LoadAnyTaggedField( + optimized_code_entry, + FieldMemOperand(feedback_vector, + FeedbackVector::kOptimizedCodeWeakOrSmiOffset)); // Check if the optimized code slot is not empty. Label optimized_code_slot_not_empty; __ CmpSmiLiteral(optimized_code_entry, @@ -1156,7 +1174,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { // TODO(rmcilroy): Consider doing more than one push per loop iteration. Label loop, no_args; __ LoadRoot(kInterpreterAccumulatorRegister, RootIndex::kUndefinedValue); - __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC); + __ ShiftRightImm(r5, r5, Operand(kSystemPointerSizeLog2), SetRC); __ beq(&no_args, cr0); __ mtctr(r5); __ bind(&loop); @@ -1174,7 +1192,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { BytecodeArray::kIncomingNewTargetOrGeneratorRegisterOffset)); __ cmpi(r8, Operand::Zero()); __ beq(&no_incoming_new_target_or_generator_register); - __ ShiftLeftImm(r8, r8, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r8, r8, Operand(kSystemPointerSizeLog2)); __ StorePX(r6, MemOperand(fp, r8)); __ bind(&no_incoming_new_target_or_generator_register); @@ -1197,7 +1215,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { ExternalReference::interpreter_dispatch_table_address(masm->isolate())); __ lbzx(r6, MemOperand(kInterpreterBytecodeArrayRegister, kInterpreterBytecodeOffsetRegister)); - __ ShiftLeftImm(r6, r6, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r6, r6, Operand(kSystemPointerSizeLog2)); __ LoadPX(kJavaScriptCallCodeStartRegister, MemOperand(kInterpreterDispatchTableRegister, r6)); __ Call(kJavaScriptCallCodeStartRegister); @@ -1282,10 +1300,10 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm, Label loop, skip; __ cmpi(count, Operand::Zero()); __ beq(&skip); - __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU + __ addi(index, index, Operand(kSystemPointerSize)); // Bias up for LoadPU __ mtctr(count); __ bind(&loop); - __ LoadPU(scratch, MemOperand(index, -kPointerSize)); + __ LoadPU(scratch, MemOperand(index, -kSystemPointerSize)); __ push(scratch); __ bdnz(&loop); __ bind(&skip); @@ -1409,15 +1427,17 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) { // get the custom trampoline, otherwise grab the entry address of the global // trampoline. __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); - __ LoadP(r5, FieldMemOperand(r5, JSFunction::kSharedFunctionInfoOffset)); - __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kFunctionDataOffset)); + __ LoadTaggedPointerField( + r5, FieldMemOperand(r5, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r5, FieldMemOperand(r5, SharedFunctionInfo::kFunctionDataOffset)); __ CompareObjectType(r5, kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, INTERPRETER_DATA_TYPE); __ bne(&builtin_trampoline); - __ LoadP(r5, - FieldMemOperand(r5, InterpreterData::kInterpreterTrampolineOffset)); + __ LoadTaggedPointerField( + r5, FieldMemOperand(r5, InterpreterData::kInterpreterTrampolineOffset)); __ addi(r5, r5, Operand(Code::kHeaderSize - kHeapObjectTag)); __ b(&trampoline_loaded); @@ -1472,7 +1492,7 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) { Register scratch = temps.Acquire(); __ lbzx(ip, MemOperand(kInterpreterBytecodeArrayRegister, kInterpreterBytecodeOffsetRegister)); - __ ShiftLeftImm(scratch, scratch, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(scratch, scratch, Operand(kSystemPointerSizeLog2)); __ LoadPX(kJavaScriptCallCodeStartRegister, MemOperand(kInterpreterDispatchTableRegister, scratch)); __ Jump(kJavaScriptCallCodeStartRegister); @@ -1538,9 +1558,10 @@ void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, // Overwrite the hole inserted by the deoptimizer with the return value from // the LAZY deopt point. __ StoreP( - r3, MemOperand( - sp, config->num_allocatable_general_registers() * kPointerSize + - BuiltinContinuationFrameConstants::kFixedFrameSize)); + r3, + MemOperand(sp, config->num_allocatable_general_registers() * + kSystemPointerSize + + BuiltinContinuationFrameConstants::kFixedFrameSize)); } for (int i = allocatable_register_count - 1; i >= 0; --i) { int code = config->GetAllocatableGeneralCode(i); @@ -1591,8 +1612,8 @@ void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { } DCHECK_EQ(kInterpreterAccumulatorRegister.code(), r3.code()); - __ LoadP(r3, MemOperand(sp, 0 * kPointerSize)); - __ addi(sp, sp, Operand(1 * kPointerSize)); + __ LoadP(r3, MemOperand(sp, 0 * kSystemPointerSize)); + __ addi(sp, sp, Operand(1 * kSystemPointerSize)); __ Ret(); } @@ -1616,7 +1637,8 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { // Load deoptimization data from the code object. // <deopt_data> = <code>[#deoptimization_data_offset] - __ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); + __ LoadTaggedPointerField( + r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); { ConstantPoolUnavailableScope constant_pool_unavailable(masm); @@ -1628,10 +1650,9 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { // Load the OSR entrypoint offset from the deoptimization data. // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] - __ LoadP(r4, - FieldMemOperand(r4, FixedArray::OffsetOfElementAt( - DeoptimizationData::kOsrPcOffsetIndex))); - __ SmiUntag(r4); + __ SmiUntagField( + r4, FieldMemOperand(r4, FixedArray::OffsetOfElementAt( + DeoptimizationData::kOsrPcOffsetIndex))); // Compute the target address = code start + osr_offset __ add(r0, r3, r4); @@ -1659,16 +1680,16 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { Register arg_size = r8; Register new_sp = r6; Register scratch = r7; - __ ShiftLeftImm(arg_size, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(arg_size, r3, Operand(kSystemPointerSizeLog2)); __ add(new_sp, sp, arg_size); __ LoadRoot(scratch, RootIndex::kUndefinedValue); __ mr(r5, scratch); __ LoadP(r4, MemOperand(new_sp, 0)); // receiver - __ cmpi(arg_size, Operand(kPointerSize)); + __ cmpi(arg_size, Operand(kSystemPointerSize)); __ blt(&skip); - __ LoadP(scratch, MemOperand(new_sp, 1 * -kPointerSize)); // thisArg + __ LoadP(scratch, MemOperand(new_sp, 1 * -kSystemPointerSize)); // thisArg __ beq(&skip); - __ LoadP(r5, MemOperand(new_sp, 2 * -kPointerSize)); // argArray + __ LoadP(r5, MemOperand(new_sp, 2 * -kSystemPointerSize)); // argArray __ bind(&skip); __ mr(sp, new_sp); __ StoreP(scratch, MemOperand(sp, 0)); @@ -1717,7 +1738,7 @@ void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { // 2. Get the callable to call (passed as receiver) from the stack. // r3: actual number of arguments - __ ShiftLeftImm(r5, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r5, r3, Operand(kSystemPointerSizeLog2)); __ LoadPX(r4, MemOperand(sp, r5)); // 3. Shift arguments and return address one slot down on the stack @@ -1733,9 +1754,9 @@ void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { __ mtctr(r3); __ bind(&loop); - __ LoadP(scratch, MemOperand(r5, -kPointerSize)); + __ LoadP(scratch, MemOperand(r5, -kSystemPointerSize)); __ StoreP(scratch, MemOperand(r5)); - __ subi(r5, r5, Operand(kPointerSize)); + __ subi(r5, r5, Operand(kSystemPointerSize)); __ bdnz(&loop); // Adjust the actual number of arguments and remove the top element // (which is a copy of the last argument). @@ -1764,19 +1785,20 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) { Register arg_size = r8; Register new_sp = r6; Register scratch = r7; - __ ShiftLeftImm(arg_size, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(arg_size, r3, Operand(kSystemPointerSizeLog2)); __ add(new_sp, sp, arg_size); __ LoadRoot(r4, RootIndex::kUndefinedValue); __ mr(scratch, r4); __ mr(r5, r4); - __ cmpi(arg_size, Operand(kPointerSize)); + __ cmpi(arg_size, Operand(kSystemPointerSize)); __ blt(&skip); - __ LoadP(r4, MemOperand(new_sp, 1 * -kPointerSize)); // target + __ LoadP(r4, MemOperand(new_sp, 1 * -kSystemPointerSize)); // target __ beq(&skip); - __ LoadP(scratch, MemOperand(new_sp, 2 * -kPointerSize)); // thisArgument - __ cmpi(arg_size, Operand(2 * kPointerSize)); + __ LoadP(scratch, + MemOperand(new_sp, 2 * -kSystemPointerSize)); // thisArgument + __ cmpi(arg_size, Operand(2 * kSystemPointerSize)); __ beq(&skip); - __ LoadP(r5, MemOperand(new_sp, 3 * -kPointerSize)); // argumentsList + __ LoadP(r5, MemOperand(new_sp, 3 * -kSystemPointerSize)); // argumentsList __ bind(&skip); __ mr(sp, new_sp); __ StoreP(scratch, MemOperand(sp, 0)); @@ -1814,21 +1836,21 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { Label skip; Register arg_size = r8; Register new_sp = r7; - __ ShiftLeftImm(arg_size, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(arg_size, r3, Operand(kSystemPointerSizeLog2)); __ add(new_sp, sp, arg_size); __ LoadRoot(r4, RootIndex::kUndefinedValue); __ mr(r5, r4); __ mr(r6, r4); __ StoreP(r4, MemOperand(new_sp, 0)); // receiver (undefined) - __ cmpi(arg_size, Operand(kPointerSize)); + __ cmpi(arg_size, Operand(kSystemPointerSize)); __ blt(&skip); - __ LoadP(r4, MemOperand(new_sp, 1 * -kPointerSize)); // target + __ LoadP(r4, MemOperand(new_sp, 1 * -kSystemPointerSize)); // target __ mr(r6, r4); // new.target defaults to target __ beq(&skip); - __ LoadP(r5, MemOperand(new_sp, 2 * -kPointerSize)); // argumentsList - __ cmpi(arg_size, Operand(2 * kPointerSize)); + __ LoadP(r5, MemOperand(new_sp, 2 * -kSystemPointerSize)); // argumentsList + __ cmpi(arg_size, Operand(2 * kSystemPointerSize)); __ beq(&skip); - __ LoadP(r6, MemOperand(new_sp, 3 * -kPointerSize)); // new.target + __ LoadP(r6, MemOperand(new_sp, 3 * -kSystemPointerSize)); // new.target __ bind(&skip); __ mr(sp, new_sp); } @@ -1875,7 +1897,7 @@ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { // Get the number of arguments passed (as a smi), tear down the frame and // then tear down the parameters. __ LoadP(r4, MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); - int stack_adjustment = kPointerSize; // adjust for receiver + int stack_adjustment = kSystemPointerSize; // adjust for receiver __ LeaveFrame(StackFrame::ARGUMENTS_ADAPTOR, stack_adjustment); __ SmiToPtrArrayOffset(r0, r4); __ add(sp, sp, r0); @@ -1898,7 +1920,8 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm, // Allow r5 to be a FixedArray, or a FixedDoubleArray if r7 == 0. Label ok, fail; __ AssertNotSmi(r5); - __ LoadP(scratch, FieldMemOperand(r5, HeapObject::kMapOffset)); + __ LoadTaggedPointerField(scratch, + FieldMemOperand(r5, HeapObject::kMapOffset)); __ LoadHalfWord(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); __ cmpi(scratch, Operand(FIXED_ARRAY_TYPE)); @@ -1924,10 +1947,11 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm, __ cmpi(r7, Operand::Zero()); __ beq(&no_args); __ addi(r5, r5, - Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); + Operand(FixedArray::kHeaderSize - kHeapObjectTag - kTaggedSize)); __ mtctr(r7); __ bind(&loop); - __ LoadPU(scratch, MemOperand(r5, kPointerSize)); + __ LoadTaggedPointerField(scratch, MemOperand(r5, kTaggedSize)); + __ addi(r5, r5, Operand(kTaggedSize)); __ CompareRoot(scratch, RootIndex::kTheHoleValue); __ bne(&skip); __ LoadRoot(scratch, RootIndex::kUndefinedValue); @@ -1961,7 +1985,8 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm, if (mode == CallOrConstructMode::kConstruct) { Label new_target_constructor, new_target_not_constructor; __ JumpIfSmi(r6, &new_target_not_constructor); - __ LoadP(scratch, FieldMemOperand(r6, HeapObject::kMapOffset)); + __ LoadTaggedPointerField(scratch, + FieldMemOperand(r6, HeapObject::kMapOffset)); __ lbz(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); __ TestBit(scratch, Map::Bits1::IsConstructorBit::kShift, r0); __ bne(&new_target_constructor, cr0); @@ -1985,7 +2010,8 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm, __ beq(&arguments_adaptor); { __ LoadP(r8, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); - __ LoadP(r8, FieldMemOperand(r8, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r8, FieldMemOperand(r8, JSFunction::kSharedFunctionInfoOffset)); __ LoadHalfWord( r8, FieldMemOperand(r8, SharedFunctionInfo::kFormalParameterCountOffset)); @@ -2011,11 +2037,11 @@ void Builtins::Generate_CallOrConstructForwardVarargs(MacroAssembler* masm, // Forward the arguments from the caller frame. { Label loop; - __ addi(r7, r7, Operand(kPointerSize)); + __ addi(r7, r7, Operand(kSystemPointerSize)); __ add(r3, r3, r8); __ bind(&loop); { - __ ShiftLeftImm(scratch, r8, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(scratch, r8, Operand(kSystemPointerSizeLog2)); __ LoadPX(scratch, MemOperand(r7, scratch)); __ push(scratch); __ subi(r8, r8, Operand(1)); @@ -2045,7 +2071,8 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, // See ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) // Check that the function is not a "classConstructor". Label class_constructor; - __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); __ lwz(r6, FieldMemOperand(r5, SharedFunctionInfo::kFlagsOffset)); __ TestBitMask(r6, SharedFunctionInfo::IsClassConstructorBit::kMask, r0); __ bne(&class_constructor, cr0); @@ -2053,7 +2080,8 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, // Enter the context of the function; ToObject has to run in the function // context, and we also need to take the global proxy from the function // context in case of conversion. - __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); + __ LoadTaggedPointerField(cp, + FieldMemOperand(r4, JSFunction::kContextOffset)); // We need to convert the receiver for non-native sloppy mode functions. Label done_convert; __ andi(r0, r6, @@ -2073,7 +2101,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, __ LoadGlobalProxy(r6); } else { Label convert_to_object, convert_receiver; - __ ShiftLeftImm(r6, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r6, r3, Operand(kSystemPointerSizeLog2)); __ LoadPX(r6, MemOperand(sp, r6)); __ JumpIfSmi(r6, &convert_to_object); STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); @@ -2107,10 +2135,11 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, __ Pop(r3, r4); __ SmiUntag(r3); } - __ LoadP(r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); __ bind(&convert_receiver); } - __ ShiftLeftImm(r7, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r7, r3, Operand(kSystemPointerSizeLog2)); __ StorePX(r6, MemOperand(sp, r7)); } __ bind(&done_convert); @@ -2146,9 +2175,9 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { // Load [[BoundArguments]] into r5 and length of that into r7. Label no_bound_arguments; - __ LoadP(r5, FieldMemOperand(r4, JSBoundFunction::kBoundArgumentsOffset)); - __ LoadP(r7, FieldMemOperand(r5, FixedArray::kLengthOffset)); - __ SmiUntag(r7, SetRC); + __ LoadTaggedPointerField( + r5, FieldMemOperand(r4, JSBoundFunction::kBoundArgumentsOffset)); + __ SmiUntagField(r7, FieldMemOperand(r5, FixedArray::kLengthOffset), SetRC); __ beq(&no_bound_arguments, cr0); { // ----------- S t a t e ------------- @@ -2163,9 +2192,8 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { // Reserve stack space for the [[BoundArguments]]. { Label done; - __ mr(scratch, sp); // preserve previous stack pointer - __ ShiftLeftImm(r10, r7, Operand(kPointerSizeLog2)); - __ sub(sp, sp, r10); + __ ShiftLeftImm(r10, r7, Operand(kSystemPointerSizeLog2)); + __ sub(r0, sp, r10); // Check the stack for overflow. We are not trying to catch interruptions // (i.e. debug break and preemption) here, so check the "real stack // limit". @@ -2173,11 +2201,9 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { UseScratchRegisterScope temps(masm); Register scratch = temps.Acquire(); LoadStackLimit(masm, scratch, StackLimitKind::kRealStackLimit); - __ cmpl(sp, scratch); + __ cmpl(r0, scratch); } __ bgt(&done); // Signed comparison. - // Restore the stack pointer. - __ mr(sp, scratch); { FrameScope scope(masm, StackFrame::MANUAL); __ EnterFrame(StackFrame::INTERNAL); @@ -2186,6 +2212,9 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { __ bind(&done); } + __ mr(scratch, sp); + __ mr(sp, r0); + // Relocate arguments down the stack. // -- r3 : the number of arguments (not including the receiver) // -- r9 : the previous stack pointer @@ -2199,7 +2228,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { __ bind(&loop); __ LoadPX(r0, MemOperand(scratch, r8)); __ StorePX(r0, MemOperand(sp, r8)); - __ addi(r8, r8, Operand(kPointerSize)); + __ addi(r8, r8, Operand(kSystemPointerSize)); __ bdnz(&loop); __ bind(&skip); } @@ -2207,13 +2236,15 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { // Copy [[BoundArguments]] to the stack (below the arguments). { Label loop; - __ addi(r5, r5, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); + __ ShiftLeftImm(r10, r7, Operand(kTaggedSizeLog2)); + __ addi(r10, r10, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); __ add(r5, r5, r10); __ mtctr(r7); __ bind(&loop); - __ LoadPU(r0, MemOperand(r5, -kPointerSize)); - __ StorePX(r0, MemOperand(sp, r8)); - __ addi(r8, r8, Operand(kPointerSize)); + __ LoadAnyTaggedField(ip, MemOperand(r5, -kTaggedSize), r0); + __ StorePX(ip, MemOperand(sp, r8)); + __ addi(r8, r8, Operand(kSystemPointerSize)); + __ addi(r5, r5, Operand(-kTaggedSize)); __ bdnz(&loop); __ add(r3, r3, r7); } @@ -2232,16 +2263,17 @@ void Builtins::Generate_CallBoundFunctionImpl(MacroAssembler* masm) { __ AssertBoundFunction(r4); // Patch the receiver to [[BoundThis]]. - __ LoadP(r6, FieldMemOperand(r4, JSBoundFunction::kBoundThisOffset)); - __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); + __ LoadAnyTaggedField(r6, + FieldMemOperand(r4, JSBoundFunction::kBoundThisOffset)); + __ ShiftLeftImm(r0, r3, Operand(kSystemPointerSizeLog2)); __ StorePX(r6, MemOperand(sp, r0)); // Push the [[BoundArguments]] onto the stack. Generate_PushBoundArguments(masm); // Call the [[BoundTargetFunction]] via the Call builtin. - __ LoadP(r4, - FieldMemOperand(r4, JSBoundFunction::kBoundTargetFunctionOffset)); + __ LoadTaggedPointerField( + r4, FieldMemOperand(r4, JSBoundFunction::kBoundTargetFunctionOffset)); __ Jump(BUILTIN_CODE(masm->isolate(), Call_ReceiverIsAny), RelocInfo::CODE_TARGET); } @@ -2275,7 +2307,7 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { // 2. Call to something else, which might have a [[Call]] internal method (if // not we raise an exception). // Overwrite the original receiver the (original) target. - __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r8, r3, Operand(kSystemPointerSizeLog2)); __ StorePX(r4, MemOperand(sp, r8)); // Let the "call_as_function_delegate" take care of the rest. __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4); @@ -2309,7 +2341,8 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { Label call_generic_stub; // Jump to JSBuiltinsConstructStub or JSConstructStubGeneric. - __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); __ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kFlagsOffset)); __ mov(ip, Operand(SharedFunctionInfo::ConstructAsBuiltinBit::kMask)); __ and_(r7, r7, ip, SetRC); @@ -2338,15 +2371,15 @@ void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) { // Patch new.target to [[BoundTargetFunction]] if new.target equals target. Label skip; - __ cmp(r4, r6); + __ CompareTagged(r4, r6); __ bne(&skip); - __ LoadP(r6, - FieldMemOperand(r4, JSBoundFunction::kBoundTargetFunctionOffset)); + __ LoadTaggedPointerField( + r6, FieldMemOperand(r4, JSBoundFunction::kBoundTargetFunctionOffset)); __ bind(&skip); // Construct the [[BoundTargetFunction]] via the Construct builtin. - __ LoadP(r4, - FieldMemOperand(r4, JSBoundFunction::kBoundTargetFunctionOffset)); + __ LoadTaggedPointerField( + r4, FieldMemOperand(r4, JSBoundFunction::kBoundTargetFunctionOffset)); __ Jump(BUILTIN_CODE(masm->isolate(), Construct), RelocInfo::CODE_TARGET); } @@ -2364,7 +2397,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) { __ JumpIfSmi(r4, &non_constructor); // Check if target has a [[Construct]] internal method. - __ LoadP(r7, FieldMemOperand(r4, HeapObject::kMapOffset)); + __ LoadTaggedPointerField(r7, FieldMemOperand(r4, HeapObject::kMapOffset)); __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); __ TestBit(r5, Map::Bits1::IsConstructorBit::kShift, r0); __ beq(&non_constructor, cr0); @@ -2390,7 +2423,7 @@ void Builtins::Generate_Construct(MacroAssembler* masm) { __ bind(&non_proxy); { // Overwrite the original receiver with the (original) target. - __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r8, r3, Operand(kSystemPointerSizeLog2)); __ StorePX(r4, MemOperand(sp, r8)); // Let the "call_as_constructor_delegate" take care of the rest. __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r4); @@ -2416,7 +2449,8 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { Label dont_adapt_arguments, stack_overflow, skip_adapt_arguments; __ cmpli(r5, Operand(kDontAdaptArgumentsSentinel)); __ beq(&dont_adapt_arguments); - __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); + __ LoadTaggedPointerField( + r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); __ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kFlagsOffset)); __ TestBitMask(r7, SharedFunctionInfo::IsSafeToSkipArgumentsAdaptorBit::kMask, r0); @@ -2444,8 +2478,8 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { __ SmiToPtrArrayOffset(r3, r3); __ add(r3, r3, fp); // adjust for return address and receiver - __ addi(r3, r3, Operand(2 * kPointerSize)); - __ ShiftLeftImm(r7, r5, Operand(kPointerSizeLog2)); + __ addi(r3, r3, Operand(2 * kSystemPointerSize)); + __ ShiftLeftImm(r7, r5, Operand(kSystemPointerSizeLog2)); __ sub(r7, r3, r7); // Copy the arguments (including the receiver) to the new stack frame. @@ -2460,7 +2494,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { __ LoadP(r0, MemOperand(r3, 0)); __ push(r0); __ cmp(r3, r7); // Compare before moving to next argument. - __ subi(r3, r3, Operand(kPointerSize)); + __ subi(r3, r3, Operand(kSystemPointerSize)); __ bne(©); __ b(&invoke); @@ -2488,10 +2522,10 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { Label copy; __ bind(©); // Adjust load for return address and receiver. - __ LoadP(r0, MemOperand(r3, 2 * kPointerSize)); + __ LoadP(r0, MemOperand(r3, 2 * kSystemPointerSize)); __ push(r0); __ cmp(r3, fp); // Compare before moving to next argument. - __ subi(r3, r3, Operand(kPointerSize)); + __ subi(r3, r3, Operand(kSystemPointerSize)); __ bne(©); // Fill the remaining expected arguments with undefined. @@ -2499,12 +2533,12 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // r5: expected number of arguments // r6: new target (passed through to callee) __ LoadRoot(r0, RootIndex::kUndefinedValue); - __ ShiftLeftImm(r7, r5, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r7, r5, Operand(kSystemPointerSizeLog2)); __ sub(r7, fp, r7); // Adjust for frame. __ subi(r7, r7, Operand(ArgumentsAdaptorFrameConstants::kFixedFrameSizeFromFp + - kPointerSize)); + kSystemPointerSize)); Label fill; __ bind(&fill); @@ -2520,7 +2554,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // r4 : function (passed through to callee) // r6 : new target (passed through to callee) static_assert(kJavaScriptCallCodeStartRegister == r5, "ABI mismatch"); - __ LoadP(r5, FieldMemOperand(r4, JSFunction::kCodeOffset)); + __ LoadTaggedPointerField(r5, FieldMemOperand(r4, JSFunction::kCodeOffset)); __ CallCodeObject(r5); // Store offset of return address for deoptimizer. @@ -2549,7 +2583,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // Remove superfluous parameters from the stack. __ sub(r7, r3, r5); __ mr(r3, r5); - __ ShiftLeftImm(r7, r7, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r7, r7, Operand(kSystemPointerSizeLog2)); __ add(sp, sp, r7); __ b(&dont_adapt_arguments); } @@ -2572,8 +2606,9 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { // Dont adapt arguments. // ------------------------------------------- __ bind(&dont_adapt_arguments); + __ RecordComment("-- Call without adapting args --"); static_assert(kJavaScriptCallCodeStartRegister == r5, "ABI mismatch"); - __ LoadP(r5, FieldMemOperand(r4, JSFunction::kCodeOffset)); + __ LoadTaggedPointerField(r5, FieldMemOperand(r4, JSFunction::kCodeOffset)); __ JumpCodeObject(r5); __ bind(&stack_overflow); @@ -2663,9 +2698,9 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, __ mr(r4, r5); } else { // Compute the argv pointer. - __ ShiftLeftImm(r4, r3, Operand(kPointerSizeLog2)); + __ ShiftLeftImm(r4, r3, Operand(kSystemPointerSizeLog2)); __ add(r4, r4, sp); - __ subi(r4, r4, Operand(kPointerSize)); + __ subi(r4, r4, Operand(kSystemPointerSize)); } // Enter the exit frame that transitions from JavaScript to C++. @@ -2701,7 +2736,8 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, // buffer as implicit first argument. __ mr(r5, r4); __ mr(r4, r3); - __ addi(r3, sp, Operand((kStackFrameExtraParamSlot + 1) * kPointerSize)); + __ addi(r3, sp, + Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize)); isolate_reg = r6; } @@ -2713,7 +2749,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, // If return value is on the stack, pop it to registers. if (needs_return_buffer) { - __ LoadP(r4, MemOperand(r3, kPointerSize)); + __ LoadP(r4, MemOperand(r3, kSystemPointerSize)); __ LoadP(r3, MemOperand(r3)); } @@ -2828,7 +2864,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) { __ Push(result_reg, scratch); // Account for saved regs. - int argument_offset = 2 * kPointerSize; + int argument_offset = 2 * kSystemPointerSize; // Load double input. __ lfd(double_scratch, MemOperand(sp, argument_offset)); @@ -2850,7 +2886,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) { __ Push(scratch_high, scratch_low); // Account for saved regs. - argument_offset += 2 * kPointerSize; + argument_offset += 2 * kSystemPointerSize; __ lwz(scratch_high, MemOperand(sp, argument_offset + Register::kExponentOffset)); @@ -2921,7 +2957,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) { __ bind(&done); __ Pop(scratch_high, scratch_low); // Account for saved regs. - argument_offset -= 2 * kPointerSize; + argument_offset -= 2 * kSystemPointerSize; __ bind(&fastpath_done); __ StoreP(result_reg, MemOperand(sp, argument_offset)); @@ -3092,33 +3128,33 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { // Set up FunctionCallbackInfo's implicit_args on the stack as follows: // // Target state: - // sp[0 * kPointerSize]: kHolder - // sp[1 * kPointerSize]: kIsolate - // sp[2 * kPointerSize]: undefined (kReturnValueDefaultValue) - // sp[3 * kPointerSize]: undefined (kReturnValue) - // sp[4 * kPointerSize]: kData - // sp[5 * kPointerSize]: undefined (kNewTarget) + // sp[0 * kSystemPointerSize]: kHolder + // sp[1 * kSystemPointerSize]: kIsolate + // sp[2 * kSystemPointerSize]: undefined (kReturnValueDefaultValue) + // sp[3 * kSystemPointerSize]: undefined (kReturnValue) + // sp[4 * kSystemPointerSize]: kData + // sp[5 * kSystemPointerSize]: undefined (kNewTarget) // Reserve space on the stack. - __ subi(sp, sp, Operand(FCA::kArgsLength * kPointerSize)); + __ subi(sp, sp, Operand(FCA::kArgsLength * kSystemPointerSize)); // kHolder. - __ StoreP(holder, MemOperand(sp, 0 * kPointerSize)); + __ StoreP(holder, MemOperand(sp, 0 * kSystemPointerSize)); // kIsolate. __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); - __ StoreP(scratch, MemOperand(sp, 1 * kPointerSize)); + __ StoreP(scratch, MemOperand(sp, 1 * kSystemPointerSize)); // kReturnValueDefaultValue and kReturnValue. __ LoadRoot(scratch, RootIndex::kUndefinedValue); - __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); - __ StoreP(scratch, MemOperand(sp, 3 * kPointerSize)); + __ StoreP(scratch, MemOperand(sp, 2 * kSystemPointerSize)); + __ StoreP(scratch, MemOperand(sp, 3 * kSystemPointerSize)); // kData. - __ StoreP(call_data, MemOperand(sp, 4 * kPointerSize)); + __ StoreP(call_data, MemOperand(sp, 4 * kSystemPointerSize)); // kNewTarget. - __ StoreP(scratch, MemOperand(sp, 5 * kPointerSize)); + __ StoreP(scratch, MemOperand(sp, 5 * kSystemPointerSize)); // Keep a pointer to kHolder (= implicit_args) in a scratch register. // We use it below to set up the FunctionCallbackInfo object. @@ -3140,31 +3176,34 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { // FunctionCallbackInfo::implicit_args_ (points at kHolder as set up above). // Arguments are after the return address (pushed by EnterExitFrame()). - __ StoreP(scratch, - MemOperand(sp, (kStackFrameExtraParamSlot + 1) * kPointerSize)); + __ StoreP(scratch, MemOperand(sp, (kStackFrameExtraParamSlot + 1) * + kSystemPointerSize)); // FunctionCallbackInfo::values_ (points at the first varargs argument passed // on the stack). - __ addi(scratch, scratch, Operand((FCA::kArgsLength - 1) * kPointerSize)); - __ ShiftLeftImm(ip, argc, Operand(kPointerSizeLog2)); + __ addi(scratch, scratch, + Operand((FCA::kArgsLength - 1) * kSystemPointerSize)); + __ ShiftLeftImm(ip, argc, Operand(kSystemPointerSizeLog2)); __ add(scratch, scratch, ip); - __ StoreP(scratch, - MemOperand(sp, (kStackFrameExtraParamSlot + 2) * kPointerSize)); + __ StoreP(scratch, MemOperand(sp, (kStackFrameExtraParamSlot + 2) * + kSystemPointerSize)); // FunctionCallbackInfo::length_. - __ stw(argc, MemOperand(sp, (kStackFrameExtraParamSlot + 3) * kPointerSize)); + __ stw(argc, + MemOperand(sp, (kStackFrameExtraParamSlot + 3) * kSystemPointerSize)); // We also store the number of bytes to drop from the stack after returning // from the API function here. __ mov(scratch, - Operand((FCA::kArgsLength + 1 /* receiver */) * kPointerSize)); - __ ShiftLeftImm(ip, argc, Operand(kPointerSizeLog2)); + Operand((FCA::kArgsLength + 1 /* receiver */) * kSystemPointerSize)); + __ ShiftLeftImm(ip, argc, Operand(kSystemPointerSizeLog2)); __ add(scratch, scratch, ip); - __ StoreP(scratch, - MemOperand(sp, (kStackFrameExtraParamSlot + 4) * kPointerSize)); + __ StoreP(scratch, MemOperand(sp, (kStackFrameExtraParamSlot + 4) * + kSystemPointerSize)); // v8::InvocationCallback's argument. - __ addi(r3, sp, Operand((kStackFrameExtraParamSlot + 1) * kPointerSize)); + __ addi(r3, sp, + Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize)); ExternalReference thunk_ref = ExternalReference::invoke_function_callback(); @@ -3172,11 +3211,11 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { // TODO(jgruber): Document what these arguments are. static constexpr int kStackSlotsAboveFCA = 2; MemOperand return_value_operand( - fp, (kStackSlotsAboveFCA + FCA::kReturnValueOffset) * kPointerSize); + fp, (kStackSlotsAboveFCA + FCA::kReturnValueOffset) * kSystemPointerSize); static constexpr int kUseStackSpaceOperand = 0; MemOperand stack_space_operand( - sp, (kStackFrameExtraParamSlot + 4) * kPointerSize); + sp, (kStackFrameExtraParamSlot + 4) * kSystemPointerSize); AllowExternalCallThatCantCauseGC scope(masm); CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, @@ -3210,14 +3249,16 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { __ push(receiver); // Push data from AccessorInfo. - __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); + __ LoadAnyTaggedField(scratch, + FieldMemOperand(callback, AccessorInfo::kDataOffset)); __ push(scratch); __ LoadRoot(scratch, RootIndex::kUndefinedValue); __ Push(scratch, scratch); __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); __ Push(scratch, holder); __ Push(Smi::zero()); // should_throw_on_error -> false - __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); + __ LoadTaggedPointerField( + scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); __ push(scratch); // v8::PropertyCallbackInfo::args_ array and name handle. @@ -3225,20 +3266,20 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { // Load address of v8::PropertyAccessorInfo::args_ array and name handle. __ mr(r3, sp); // r3 = Handle<Name> - __ addi(r4, r3, Operand(1 * kPointerSize)); // r4 = v8::PCI::args_ + __ addi(r4, r3, Operand(1 * kSystemPointerSize)); // r4 = v8::PCI::args_ -// If ABI passes Handles (pointer-sized struct) in a register: -// -// Create 2 extra slots on stack: -// [0] space for DirectCEntryStub's LR save -// [1] AccessorInfo& -// -// Otherwise: -// -// Create 3 extra slots on stack: -// [0] space for DirectCEntryStub's LR save -// [1] copy of Handle (first arg) -// [2] AccessorInfo& + // If ABI passes Handles (pointer-sized struct) in a register: + // + // Create 2 extra slots on stack: + // [0] space for DirectCEntryStub's LR save + // [1] AccessorInfo& + // + // Otherwise: + // + // Create 3 extra slots on stack: + // [0] space for DirectCEntryStub's LR save + // [1] copy of Handle (first arg) + // [2] AccessorInfo& if (ABI_PASSES_HANDLES_IN_REGS) { accessorInfoSlot = kStackFrameExtraParamSlot + 1; apiStackSpace = 2; @@ -3253,26 +3294,28 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { if (!ABI_PASSES_HANDLES_IN_REGS) { // pass 1st arg by reference - __ StoreP(r3, MemOperand(sp, arg0Slot * kPointerSize)); - __ addi(r3, sp, Operand(arg0Slot * kPointerSize)); + __ StoreP(r3, MemOperand(sp, arg0Slot * kSystemPointerSize)); + __ addi(r3, sp, Operand(arg0Slot * kSystemPointerSize)); } // Create v8::PropertyCallbackInfo object on the stack and initialize // it's args_ field. - __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kPointerSize)); - __ addi(r4, sp, Operand(accessorInfoSlot * kPointerSize)); + __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kSystemPointerSize)); + __ addi(r4, sp, Operand(accessorInfoSlot * kSystemPointerSize)); // r4 = v8::PropertyCallbackInfo& ExternalReference thunk_ref = ExternalReference::invoke_accessor_getter_callback(); - __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); + __ LoadTaggedPointerField( + scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); __ LoadP(api_function_address, FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); // +3 is to skip prolog, return address and name handle. MemOperand return_value_operand( - fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); + fp, + (PropertyCallbackArguments::kReturnValueOffset + 3) * kSystemPointerSize); MemOperand* const kUseStackSpaceConstant = nullptr; CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, kStackUnwindSpace, kUseStackSpaceConstant, @@ -3285,16 +3328,17 @@ void Builtins::Generate_DirectCEntry(MacroAssembler* masm) { // Place the return address on the stack, making the call // GC safe. The RegExp backend also relies on this. __ mflr(r0); - __ StoreP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize)); + __ StoreP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kSystemPointerSize)); if (ABI_USES_FUNCTION_DESCRIPTORS) { // AIX/PPC64BE Linux use a function descriptor; - __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(temp2, kPointerSize)); + __ LoadP(ToRegister(ABI_TOC_REGISTER), + MemOperand(temp2, kSystemPointerSize)); __ LoadP(temp2, MemOperand(temp2, 0)); // Instruction address } __ Call(temp2); // Call the C++ function. - __ LoadP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize)); + __ LoadP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kSystemPointerSize)); __ mtlr(r0); __ blr(); } |