diff options
Diffstat (limited to 'deps/v8/src/ppc/code-stubs-ppc.cc')
-rw-r--r-- | deps/v8/src/ppc/code-stubs-ppc.cc | 214 |
1 files changed, 55 insertions, 159 deletions
diff --git a/deps/v8/src/ppc/code-stubs-ppc.cc b/deps/v8/src/ppc/code-stubs-ppc.cc index 290159a3e7..92501a4a23 100644 --- a/deps/v8/src/ppc/code-stubs-ppc.cc +++ b/deps/v8/src/ppc/code-stubs-ppc.cc @@ -1034,15 +1034,22 @@ void CEntryStub::Generate(MacroAssembler* masm) { // fp: frame pointer (restored after C call) // sp: stack pointer (restored as callee's sp after C call) // cp: current context (C callee-saved) - + // + // If argv_in_register(): + // r5: pointer to the first argument ProfileEntryHookStub::MaybeCallEntryHook(masm); __ mr(r15, r4); - // Compute the argv pointer. - __ ShiftLeftImm(r4, r3, Operand(kPointerSizeLog2)); - __ add(r4, r4, sp); - __ subi(r4, r4, Operand(kPointerSize)); + if (argv_in_register()) { + // Move argv into the correct register. + __ mr(r4, r5); + } else { + // Compute the argv pointer. + __ ShiftLeftImm(r4, r3, Operand(kPointerSizeLog2)); + __ add(r4, r4, sp); + __ subi(r4, r4, Operand(kPointerSize)); + } // Enter the exit frame that transitions from JavaScript to C++. FrameScope scope(masm, StackFrame::MANUAL); @@ -1141,8 +1148,15 @@ void CEntryStub::Generate(MacroAssembler* masm) { // r3:r4: result // sp: stack pointer // fp: frame pointer - // r14: still holds argc (callee-saved). - __ LeaveExitFrame(save_doubles(), r14, true); + Register argc; + if (argv_in_register()) { + // We don't want to pop arguments so set argc to no_reg. + argc = no_reg; + } else { + // r14: still holds argc (callee-saved). + argc = r14; + } + __ LeaveExitFrame(save_doubles(), argc, true); __ blr(); // Handling of exception. @@ -1416,13 +1430,7 @@ void InstanceOfStub::Generate(MacroAssembler* masm) { FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); __ lwz(scratch, FieldMemOperand(shared_info, SharedFunctionInfo::kCompilerHintsOffset)); - __ TestBit(scratch, -#if V8_TARGET_ARCH_PPC64 - SharedFunctionInfo::kBoundFunction, -#else - SharedFunctionInfo::kBoundFunction + kSmiTagSize, -#endif - r0); + __ TestBit(scratch, SharedFunctionInfo::kBoundBit, r0); __ bne(&slow_case, cr0); // Get the "prototype" (or initial map) of the {function}. @@ -1697,7 +1705,7 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { __ LoadP(r7, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); - __ LoadP(r7, FieldMemOperand(r7, GlobalObject::kNativeContextOffset)); + __ LoadP(r7, FieldMemOperand(r7, JSGlobalObject::kNativeContextOffset)); __ cmpi(r9, Operand::Zero()); if (CpuFeatures::IsSupported(ISELECT)) { __ LoadP(r11, MemOperand(r7, kNormalOffset)); @@ -1914,7 +1922,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { // Get the arguments boilerplate from the current native context. __ LoadP(r7, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); - __ LoadP(r7, FieldMemOperand(r7, GlobalObject::kNativeContextOffset)); + __ LoadP(r7, FieldMemOperand(r7, JSGlobalObject::kNativeContextOffset)); __ LoadP( r7, MemOperand(r7, Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX))); @@ -2521,110 +2529,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { } -static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { - // Do not transform the receiver for strict mode functions and natives. - __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); - __ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); - __ TestBit(r7, -#if V8_TARGET_ARCH_PPC64 - SharedFunctionInfo::kStrictModeFunction, -#else - SharedFunctionInfo::kStrictModeFunction + kSmiTagSize, -#endif - r0); - __ bne(cont, cr0); - - // Do not transform the receiver for native. - __ TestBit(r7, -#if V8_TARGET_ARCH_PPC64 - SharedFunctionInfo::kNative, -#else - SharedFunctionInfo::kNative + kSmiTagSize, -#endif - r0); - __ bne(cont, cr0); -} - - -static void EmitSlowCase(MacroAssembler* masm, int argc) { - __ mov(r3, Operand(argc)); - __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); -} - - -static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { - // Wrap the receiver and patch it back onto the stack. - { - FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); - __ push(r4); - __ mr(r3, r6); - ToObjectStub stub(masm->isolate()); - __ CallStub(&stub); - __ pop(r4); - } - __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); - __ b(cont); -} - - -static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, - bool needs_checks, bool call_as_method) { - // r4 : the function to call - Label slow, wrap, cont; - - if (needs_checks) { - // Check that the function is really a JavaScript function. - // r4: pushed function (to be verified) - __ JumpIfSmi(r4, &slow); - - // Goto slow case if we do not have a function. - __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); - __ bne(&slow); - } - - // Fast-case: Invoke the function now. - // r4: pushed function - ParameterCount actual(argc); - - if (call_as_method) { - if (needs_checks) { - EmitContinueIfStrictOrNative(masm, &cont); - } - - // Compute the receiver in sloppy mode. - __ LoadP(r6, MemOperand(sp, argc * kPointerSize), r0); - - if (needs_checks) { - __ JumpIfSmi(r6, &wrap); - __ CompareObjectType(r6, r7, r7, FIRST_SPEC_OBJECT_TYPE); - __ blt(&wrap); - } else { - __ b(&wrap); - } - - __ bind(&cont); - } - - __ InvokeFunction(r4, actual, JUMP_FUNCTION, NullCallWrapper()); - - if (needs_checks) { - // Slow-case: Non-function called. - __ bind(&slow); - EmitSlowCase(masm, argc); - } - - if (call_as_method) { - __ bind(&wrap); - EmitWrapCase(masm, argc, &cont); - } -} - - -void CallFunctionStub::Generate(MacroAssembler* masm) { - CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); -} - - void CallConstructStub::Generate(MacroAssembler* masm) { // r3 : number of arguments // r4 : the function to call @@ -2715,9 +2619,7 @@ void CallICStub::Generate(MacroAssembler* masm) { FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); const int generic_offset = FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); - Label extra_checks_or_miss, slow_start; - Label slow, wrap, cont; - Label have_js_function; + Label extra_checks_or_miss, call; int argc = arg_count(); ParameterCount actual(argc); @@ -2754,34 +2656,15 @@ void CallICStub::Generate(MacroAssembler* masm) { __ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0); __ StoreP(r6, FieldMemOperand(r9, count_offset), r0); - __ bind(&have_js_function); - if (CallAsMethod()) { - EmitContinueIfStrictOrNative(masm, &cont); - // Compute the receiver in sloppy mode. - __ LoadP(r6, MemOperand(sp, argc * kPointerSize), r0); - - __ JumpIfSmi(r6, &wrap); - __ CompareObjectType(r6, r7, r7, FIRST_SPEC_OBJECT_TYPE); - __ blt(&wrap); - - __ bind(&cont); - } - - __ InvokeFunction(r4, actual, JUMP_FUNCTION, NullCallWrapper()); - - __ bind(&slow); - EmitSlowCase(masm, argc); - - if (CallAsMethod()) { - __ bind(&wrap); - EmitWrapCase(masm, argc, &cont); - } + __ bind(&call); + __ mov(r3, Operand(argc)); + __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); __ bind(&extra_checks_or_miss); Label uninitialized, miss, not_allocation_site; __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); - __ beq(&slow_start); + __ beq(&call); // Verify that r7 contains an AllocationSite __ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset)); @@ -2816,7 +2699,7 @@ void CallICStub::Generate(MacroAssembler* masm) { __ LoadP(r7, FieldMemOperand(r5, generic_offset)); __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); __ StoreP(r7, FieldMemOperand(r5, generic_offset), r0); - __ b(&slow_start); + __ b(&call); __ bind(&uninitialized); @@ -2854,23 +2737,14 @@ void CallICStub::Generate(MacroAssembler* masm) { __ Pop(r4); } - __ b(&have_js_function); + __ b(&call); // We are here because tracing is on or we encountered a MISS case we can't // handle here. __ bind(&miss); GenerateMiss(masm); - // the slow case - __ bind(&slow_start); - // Check that the function is really a JavaScript function. - // r4: pushed function (to be verified) - __ JumpIfSmi(r4, &slow); - - // Goto slow case if we do not have a function. - __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); - __ bne(&slow); - __ b(&have_js_function); + __ b(&call); } @@ -3011,7 +2885,7 @@ void StringCharFromCodeGenerator::GenerateSlow( __ bind(&slow_case_); call_helper.BeforeCall(masm); __ push(code_); - __ CallRuntime(Runtime::kCharFromCode, 1); + __ CallRuntime(Runtime::kStringCharFromCode, 1); __ Move(result_, r3); call_helper.AfterCall(masm); __ b(&exit_); @@ -3320,6 +3194,28 @@ void ToNumberStub::Generate(MacroAssembler* masm) { } +void ToLengthStub::Generate(MacroAssembler* masm) { + // The ToLength stub takes one argument in r3. + Label not_smi; + __ JumpIfNotSmi(r3, ¬_smi); + STATIC_ASSERT(kSmiTag == 0); + __ cmpi(r3, Operand::Zero()); + if (CpuFeatures::IsSupported(ISELECT)) { + __ isel(lt, r3, r0, r3); + } else { + Label positive; + __ bgt(&positive); + __ li(r3, Operand::Zero()); + __ bind(&positive); + } + __ Ret(); + __ bind(¬_smi); + + __ push(r3); // Push argument. + __ TailCallRuntime(Runtime::kToLength, 1, 1); +} + + void ToStringStub::Generate(MacroAssembler* masm) { // The ToString stub takes one argument in r3. Label is_number; |