Skip to content

Commit c1be709

Browse files
mtbrandyCommit bot
authored andcommitted
PPC: Vector ICs: Hook up vectors in platform builtins to their SharedFunctionInfos.
Port 905e008 [email protected], [email protected], [email protected], [email protected], [email protected] BUG=v8:4423 LOG=N Review URL: https://codereview.chromium.org/1350923003 Cr-Commit-Position: refs/heads/master@{#30806}
1 parent 1777763 commit c1be709

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

src/ppc/builtins-ppc.cc

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
12641264

12651265

12661266
static void Generate_PushAppliedArguments(MacroAssembler* masm,
1267+
const int vectorOffset,
12671268
const int argumentsOffset,
12681269
const int indexOffset,
12691270
const int limitOffset) {
@@ -1280,13 +1281,9 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
12801281
__ LoadP(receiver, MemOperand(fp, argumentsOffset));
12811282

12821283
// Use inline caching to speed up access to arguments.
1283-
Code::Kind kinds[] = {Code::KEYED_LOAD_IC};
1284-
FeedbackVectorSpec spec(0, 1, kinds);
1285-
Handle<TypeFeedbackVector> feedback_vector =
1286-
masm->isolate()->factory()->NewTypeFeedbackVector(&spec);
1287-
int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0));
1288-
__ LoadSmiLiteral(slot, Smi::FromInt(index));
1289-
__ Move(vector, feedback_vector);
1284+
int slot_index = TypeFeedbackVector::PushAppliedArgumentsIndex();
1285+
__ LoadSmiLiteral(slot, Smi::FromInt(slot_index));
1286+
__ LoadP(vector, MemOperand(fp, vectorOffset));
12901287
Handle<Code> ic =
12911288
KeyedLoadICStub(masm->isolate(), LoadICState(kNoExtraICState)).GetCode();
12921289
__ Call(ic, RelocInfo::CODE_TARGET);
@@ -1321,6 +1318,14 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
13211318
const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize;
13221319
const int kReceiverOffset = kArgumentsOffset + kPointerSize;
13231320
const int kFunctionOffset = kReceiverOffset + kPointerSize;
1321+
const int kVectorOffset =
1322+
InternalFrameConstants::kCodeOffset - 1 * kPointerSize;
1323+
1324+
// Push the vector.
1325+
__ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1326+
__ LoadP(r4,
1327+
FieldMemOperand(r4, SharedFunctionInfo::kFeedbackVectorOffset));
1328+
__ push(r4);
13241329

13251330
__ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function
13261331
__ LoadP(r4, MemOperand(fp, kArgumentsOffset)); // get the args array
@@ -1335,17 +1340,15 @@ static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) {
13351340
Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged);
13361341

13371342
// Push current limit and index.
1338-
const int kIndexOffset =
1339-
StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1340-
const int kLimitOffset =
1341-
StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1343+
const int kIndexOffset = kVectorOffset - (2 * kPointerSize);
1344+
const int kLimitOffset = kVectorOffset - (1 * kPointerSize);
13421345
__ li(r4, Operand::Zero());
13431346
__ LoadP(r5, MemOperand(fp, kReceiverOffset));
13441347
__ Push(r3, r4, r5); // limit, initial index and receiver.
13451348

13461349
// Copy all arguments from the array to the stack.
1347-
Generate_PushAppliedArguments(masm, kArgumentsOffset, kIndexOffset,
1348-
kLimitOffset);
1350+
Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset,
1351+
kIndexOffset, kLimitOffset);
13491352

13501353
// Call the callable.
13511354
// TODO(bmeurer): This should be a tail call according to ES6.
@@ -1368,6 +1371,14 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
13681371
const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize;
13691372
const int kArgumentsOffset = kNewTargetOffset + kPointerSize;
13701373
const int kFunctionOffset = kArgumentsOffset + kPointerSize;
1374+
static const int kVectorOffset =
1375+
InternalFrameConstants::kCodeOffset - 1 * kPointerSize;
1376+
1377+
// Push the vector.
1378+
__ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1379+
__ LoadP(r4,
1380+
FieldMemOperand(r4, SharedFunctionInfo::kFeedbackVectorOffset));
1381+
__ push(r4);
13711382

13721383
// If newTarget is not supplied, set it to constructor
13731384
Label validate_arguments;
@@ -1391,19 +1402,17 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
13911402
Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged);
13921403

13931404
// Push current limit and index.
1394-
const int kIndexOffset =
1395-
StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1396-
const int kLimitOffset =
1397-
StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1405+
const int kIndexOffset = kVectorOffset - (2 * kPointerSize);
1406+
const int kLimitOffset = kVectorOffset - (1 * kPointerSize);
13981407
__ li(r4, Operand::Zero());
13991408
__ Push(r3, r4); // limit and initial index.
14001409
// Push the constructor function as callee
14011410
__ LoadP(r3, MemOperand(fp, kFunctionOffset));
14021411
__ push(r3);
14031412

14041413
// Copy all arguments from the array to the stack.
1405-
Generate_PushAppliedArguments(masm, kArgumentsOffset, kIndexOffset,
1406-
kLimitOffset);
1414+
Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset,
1415+
kIndexOffset, kLimitOffset);
14071416

14081417
// Use undefined feedback vector
14091418
__ LoadRoot(r5, Heap::kUndefinedValueRootIndex);

0 commit comments

Comments
 (0)