Commit c1be7098 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: Vector ICs: Hook up vectors in platform builtins to their SharedFunctionInfos.

Port 905e008c

R=mvstanton@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, dstence@us.ibm.com
BUG=v8:4423
LOG=N

Review URL: https://codereview.chromium.org/1350923003

Cr-Commit-Position: refs/heads/master@{#30806}
parent 1777763f
...@@ -1264,6 +1264,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -1264,6 +1264,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
static void Generate_PushAppliedArguments(MacroAssembler* masm, static void Generate_PushAppliedArguments(MacroAssembler* masm,
const int vectorOffset,
const int argumentsOffset, const int argumentsOffset,
const int indexOffset, const int indexOffset,
const int limitOffset) { const int limitOffset) {
...@@ -1280,13 +1281,9 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm, ...@@ -1280,13 +1281,9 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ LoadP(receiver, MemOperand(fp, argumentsOffset)); __ LoadP(receiver, MemOperand(fp, argumentsOffset));
// Use inline caching to speed up access to arguments. // Use inline caching to speed up access to arguments.
Code::Kind kinds[] = {Code::KEYED_LOAD_IC}; int slot_index = TypeFeedbackVector::PushAppliedArgumentsIndex();
FeedbackVectorSpec spec(0, 1, kinds); __ LoadSmiLiteral(slot, Smi::FromInt(slot_index));
Handle<TypeFeedbackVector> feedback_vector = __ LoadP(vector, MemOperand(fp, vectorOffset));
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
__ LoadSmiLiteral(slot, Smi::FromInt(index));
__ Move(vector, feedback_vector);
Handle<Code> ic = Handle<Code> ic =
KeyedLoadICStub(masm->isolate(), LoadICState(kNoExtraICState)).GetCode(); KeyedLoadICStub(masm->isolate(), LoadICState(kNoExtraICState)).GetCode();
__ Call(ic, RelocInfo::CODE_TARGET); __ Call(ic, RelocInfo::CODE_TARGET);
...@@ -1321,6 +1318,14 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { ...@@ -1321,6 +1318,14 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize;
const int kReceiverOffset = kArgumentsOffset + kPointerSize; const int kReceiverOffset = kArgumentsOffset + kPointerSize;
const int kFunctionOffset = kReceiverOffset + kPointerSize; const int kFunctionOffset = kReceiverOffset + kPointerSize;
const int kVectorOffset =
InternalFrameConstants::kCodeOffset - 1 * kPointerSize;
// Push the vector.
__ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r4,
FieldMemOperand(r4, SharedFunctionInfo::kFeedbackVectorOffset));
__ push(r4);
__ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function
__ LoadP(r4, MemOperand(fp, kArgumentsOffset)); // get the args array __ LoadP(r4, MemOperand(fp, kArgumentsOffset)); // get the args array
...@@ -1335,17 +1340,15 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { ...@@ -1335,17 +1340,15 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged);
// Push current limit and index. // Push current limit and index.
const int kIndexOffset = const int kIndexOffset = kVectorOffset - (2 * kPointerSize);
StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); const int kLimitOffset = kVectorOffset - (1 * kPointerSize);
const int kLimitOffset =
StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
__ li(r4, Operand::Zero()); __ li(r4, Operand::Zero());
__ LoadP(r5, MemOperand(fp, kReceiverOffset)); __ LoadP(r5, MemOperand(fp, kReceiverOffset));
__ Push(r3, r4, r5); // limit, initial index and receiver. __ Push(r3, r4, r5); // limit, initial index and receiver.
// Copy all arguments from the array to the stack. // Copy all arguments from the array to the stack.
Generate_PushAppliedArguments(masm, kArgumentsOffset, kIndexOffset, Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset,
kLimitOffset); kIndexOffset, kLimitOffset);
// Call the callable. // Call the callable.
// TODO(bmeurer): This should be a tail call according to ES6. // TODO(bmeurer): This should be a tail call according to ES6.
...@@ -1368,6 +1371,14 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1368,6 +1371,14 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize;
const int kArgumentsOffset = kNewTargetOffset + kPointerSize; const int kArgumentsOffset = kNewTargetOffset + kPointerSize;
const int kFunctionOffset = kArgumentsOffset + kPointerSize; const int kFunctionOffset = kArgumentsOffset + kPointerSize;
static const int kVectorOffset =
InternalFrameConstants::kCodeOffset - 1 * kPointerSize;
// Push the vector.
__ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r4,
FieldMemOperand(r4, SharedFunctionInfo::kFeedbackVectorOffset));
__ push(r4);
// If newTarget is not supplied, set it to constructor // If newTarget is not supplied, set it to constructor
Label validate_arguments; Label validate_arguments;
...@@ -1391,10 +1402,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1391,10 +1402,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged);
// Push current limit and index. // Push current limit and index.
const int kIndexOffset = const int kIndexOffset = kVectorOffset - (2 * kPointerSize);
StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); const int kLimitOffset = kVectorOffset - (1 * kPointerSize);
const int kLimitOffset =
StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
__ li(r4, Operand::Zero()); __ li(r4, Operand::Zero());
__ Push(r3, r4); // limit and initial index. __ Push(r3, r4); // limit and initial index.
// Push the constructor function as callee // Push the constructor function as callee
...@@ -1402,8 +1411,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1402,8 +1411,8 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
__ push(r3); __ push(r3);
// Copy all arguments from the array to the stack. // Copy all arguments from the array to the stack.
Generate_PushAppliedArguments(masm, kArgumentsOffset, kIndexOffset, Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset,
kLimitOffset); kIndexOffset, kLimitOffset);
// Use undefined feedback vector // Use undefined feedback vector
__ LoadRoot(r5, Heap::kUndefinedValueRootIndex); __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment