| Index: src/ppc/macro-assembler-ppc.cc
|
| diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc
|
| index 2e3fafa09df51a87bc6cb251d92e96a972082abc..40a4524824be06e7b575016e5cd367096f8a566c 100644
|
| --- a/src/ppc/macro-assembler-ppc.cc
|
| +++ b/src/ppc/macro-assembler-ppc.cc
|
| @@ -591,42 +591,69 @@ void MacroAssembler::RememberedSetHelper(Register object, // For debug tests.
|
| }
|
| }
|
|
|
| -
|
| -void MacroAssembler::PushFixedFrame(Register marker_reg) {
|
| +void MacroAssembler::PushCommonFrame(Register marker_reg) {
|
| + int fp_delta = 0;
|
| mflr(r0);
|
| if (FLAG_enable_embedded_constant_pool) {
|
| if (marker_reg.is_valid()) {
|
| - Push(r0, fp, kConstantPoolRegister, cp, marker_reg);
|
| + Push(r0, fp, kConstantPoolRegister, marker_reg);
|
| + fp_delta = 2;
|
| } else {
|
| - Push(r0, fp, kConstantPoolRegister, cp);
|
| + Push(r0, fp, kConstantPoolRegister);
|
| + fp_delta = 1;
|
| }
|
| } else {
|
| if (marker_reg.is_valid()) {
|
| - Push(r0, fp, cp, marker_reg);
|
| + Push(r0, fp, marker_reg);
|
| + fp_delta = 1;
|
| } else {
|
| - Push(r0, fp, cp);
|
| + Push(r0, fp);
|
| + fp_delta = 0;
|
| }
|
| }
|
| + addi(fp, sp, Operand(fp_delta * kPointerSize));
|
| }
|
|
|
| -
|
| -void MacroAssembler::PopFixedFrame(Register marker_reg) {
|
| +void MacroAssembler::PopCommonFrame(Register marker_reg) {
|
| if (FLAG_enable_embedded_constant_pool) {
|
| if (marker_reg.is_valid()) {
|
| - Pop(r0, fp, kConstantPoolRegister, cp, marker_reg);
|
| + Pop(r0, fp, kConstantPoolRegister, marker_reg);
|
| } else {
|
| - Pop(r0, fp, kConstantPoolRegister, cp);
|
| + Pop(r0, fp, kConstantPoolRegister);
|
| }
|
| } else {
|
| if (marker_reg.is_valid()) {
|
| - Pop(r0, fp, cp, marker_reg);
|
| + Pop(r0, fp, marker_reg);
|
| } else {
|
| - Pop(r0, fp, cp);
|
| + Pop(r0, fp);
|
| }
|
| }
|
| mtlr(r0);
|
| }
|
|
|
| +void MacroAssembler::PushStandardFrame(Register function_reg) {
|
| + int fp_delta = 0;
|
| + mflr(r0);
|
| + if (FLAG_enable_embedded_constant_pool) {
|
| + if (function_reg.is_valid()) {
|
| + Push(r0, fp, kConstantPoolRegister, cp, function_reg);
|
| + fp_delta = 3;
|
| + } else {
|
| + Push(r0, fp, kConstantPoolRegister, cp);
|
| + fp_delta = 2;
|
| + }
|
| + } else {
|
| + if (function_reg.is_valid()) {
|
| + Push(r0, fp, cp, function_reg);
|
| + fp_delta = 2;
|
| + } else {
|
| + Push(r0, fp, cp);
|
| + fp_delta = 1;
|
| + }
|
| + }
|
| + addi(fp, sp, Operand(fp_delta * kPointerSize));
|
| +}
|
| +
|
| void MacroAssembler::RestoreFrameStateForTailCall() {
|
| if (FLAG_enable_embedded_constant_pool) {
|
| LoadP(kConstantPoolRegister,
|
| @@ -870,12 +897,10 @@ void MacroAssembler::LoadConstantPoolPointerRegister() {
|
| mov_label_addr(kConstantPoolRegister, ConstantPoolPosition());
|
| }
|
|
|
| -
|
| -void MacroAssembler::StubPrologue(Register base, int prologue_offset) {
|
| - LoadSmiLiteral(r11, Smi::FromInt(StackFrame::STUB));
|
| - PushFixedFrame(r11);
|
| - // Adjust FP to point to saved FP.
|
| - addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| +void MacroAssembler::StubPrologue(StackFrame::Type type, Register base,
|
| + int prologue_offset) {
|
| + LoadSmiLiteral(r11, Smi::FromInt(type));
|
| + PushCommonFrame(r11);
|
| if (FLAG_enable_embedded_constant_pool) {
|
| if (!base.is(no_reg)) {
|
| // base contains prologue address
|
| @@ -911,9 +936,7 @@ void MacroAssembler::Prologue(bool code_pre_aging, Register base,
|
| }
|
| } else {
|
| // This matches the code found in GetNoCodeAgeSequence()
|
| - PushFixedFrame(r4);
|
| - // Adjust fp to point to saved fp.
|
| - addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| + PushStandardFrame(r4);
|
| for (int i = 0; i < kNoCodeAgeSequenceNops; i++) {
|
| nop();
|
| }
|
| @@ -938,20 +961,20 @@ void MacroAssembler::EmitLoadTypeFeedbackVector(Register vector) {
|
| void MacroAssembler::EnterFrame(StackFrame::Type type,
|
| bool load_constant_pool_pointer_reg) {
|
| if (FLAG_enable_embedded_constant_pool && load_constant_pool_pointer_reg) {
|
| - PushFixedFrame();
|
| - // This path should not rely on ip containing code entry.
|
| + // Push type explicitly so we can leverage the constant pool.
|
| + // This path cannot rely on ip containing code entry.
|
| + PushCommonFrame();
|
| LoadConstantPoolPointerRegister();
|
| LoadSmiLiteral(ip, Smi::FromInt(type));
|
| push(ip);
|
| } else {
|
| LoadSmiLiteral(ip, Smi::FromInt(type));
|
| - PushFixedFrame(ip);
|
| + PushCommonFrame(ip);
|
| + }
|
| + if (type == StackFrame::INTERNAL) {
|
| + mov(r0, Operand(CodeObject()));
|
| + push(r0);
|
| }
|
| - // Adjust FP to point to saved FP.
|
| - addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| -
|
| - mov(r0, Operand(CodeObject()));
|
| - push(r0);
|
| }
|
|
|
|
|
| @@ -967,11 +990,8 @@ int MacroAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) {
|
| LoadP(r0, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
|
| LoadP(ip, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| if (FLAG_enable_embedded_constant_pool) {
|
| - const int exitOffset = ExitFrameConstants::kConstantPoolOffset;
|
| - const int standardOffset = StandardFrameConstants::kConstantPoolOffset;
|
| - const int offset =
|
| - ((type == StackFrame::EXIT) ? exitOffset : standardOffset);
|
| - LoadP(kConstantPoolRegister, MemOperand(fp, offset));
|
| + LoadP(kConstantPoolRegister,
|
| + MemOperand(fp, StandardFrameConstants::kConstantPoolOffset));
|
| }
|
| mtlr(r0);
|
| frame_ends = pc_offset();
|
| @@ -1008,12 +1028,10 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
| // all of the pushes that have happened inside of V8
|
| // since we were called from C code
|
|
|
| - // replicate ARM frame - TODO make this more closely follow PPC ABI
|
| - mflr(r0);
|
| - Push(r0, fp);
|
| - mr(fp, sp);
|
| + LoadSmiLiteral(ip, Smi::FromInt(StackFrame::EXIT));
|
| + PushCommonFrame(ip);
|
| // Reserve room for saved entry sp and code object.
|
| - subi(sp, sp, Operand(ExitFrameConstants::kFrameSize));
|
| + subi(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp));
|
|
|
| if (emit_debug_code()) {
|
| li(r8, Operand::Zero());
|
| @@ -1098,7 +1116,7 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count,
|
| // Calculate the stack location of the saved doubles and restore them.
|
| const int kNumRegs = kNumCallerSavedDoubles;
|
| const int offset =
|
| - (ExitFrameConstants::kFrameSize + kNumRegs * kDoubleSize);
|
| + (ExitFrameConstants::kFixedFrameSizeFromFp + kNumRegs * kDoubleSize);
|
| addi(r6, fp, Operand(-offset));
|
| MultiPopDoubles(kCallerSavedDoubles, r6);
|
| }
|
| @@ -1477,8 +1495,20 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
|
| DCHECK(!holder_reg.is(ip));
|
| DCHECK(!scratch.is(ip));
|
|
|
| - // Load current lexical context from the stack frame.
|
| - LoadP(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| + // Load current lexical context from the active StandardFrame, which
|
| + // may require crawling past STUB frames.
|
| + Label load_context;
|
| + Label has_context;
|
| + DCHECK(!ip.is(scratch));
|
| + mr(ip, fp);
|
| + bind(&load_context);
|
| + LoadP(scratch,
|
| + MemOperand(ip, CommonFrameConstants::kContextOrFrameTypeOffset));
|
| + JumpIfNotSmi(scratch, &has_context);
|
| + LoadP(ip, MemOperand(ip, CommonFrameConstants::kCallerFPOffset));
|
| + b(&load_context);
|
| + bind(&has_context);
|
| +
|
| // In debug mode, make sure the lexical context is set.
|
| #ifdef DEBUG
|
| cmpi(scratch, Operand::Zero());
|
|
|