Commit 626b95e3 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [TypeFeedbackVector] Combine the literals array and the feedback vector.

Port 93f05b64

Original Commit Message:

    They have the same lifetime. It's a match!

    Both structures are native context dependent and dealt with (creation,
    clearing, gathering feedback) at the same time. By treating the spaces used
    for literal boilerplates as feedback vector slots, we no longer have to keep
    track of the materialized literal count elsewhere.

    A follow-on CL removes even more parser infrastructure related to this count.

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

Review-Url: https://codereview.chromium.org/2659413002
Cr-Commit-Position: refs/heads/master@{#42778}
parent 1fc5ca85
......@@ -1033,8 +1033,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bne(&switch_to_different_code_kind);
// Increment invocation count for the function.
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
__ LoadP(r7, FieldMemOperand(r7, LiteralsArray::kFeedbackVectorOffset));
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kFeedbackVectorOffset));
__ LoadP(r8, FieldMemOperand(r7, TypeFeedbackVector::kInvocationCountIndex *
kPointerSize +
TypeFeedbackVector::kHeaderSize));
......@@ -1394,16 +1393,17 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
__ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
__ cmp(temp, native_context);
__ bne(&loop_bottom);
// Literals available?
// Feedback vector available?
__ LoadP(temp,
FieldMemOperand(array_pointer,
SharedFunctionInfo::kOffsetToPreviousLiterals));
__ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
__ JumpIfSmi(temp, &gotta_call_runtime);
// Save the literals in the closure.
__ StoreP(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset), r0);
__ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r7,
// Save the feedback vector in the closure.
__ StoreP(temp, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset),
r0);
__ RecordWriteField(closure, JSFunction::kFeedbackVectorOffset, temp, r7,
kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
......
......@@ -1038,8 +1038,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bne(&switch_to_different_code_kind);
// Increment invocation count for the function.
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
__ LoadP(r6, FieldMemOperand(r6, LiteralsArray::kFeedbackVectorOffset));
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kFeedbackVectorOffset));
__ LoadP(r1, FieldMemOperand(r6, TypeFeedbackVector::kInvocationCountIndex *
kPointerSize +
TypeFeedbackVector::kHeaderSize));
......@@ -1399,16 +1398,17 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
__ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
__ CmpP(temp, native_context);
__ bne(&loop_bottom, Label::kNear);
// Literals available?
// Feedback vector available?
__ LoadP(temp,
FieldMemOperand(array_pointer,
SharedFunctionInfo::kOffsetToPreviousLiterals));
__ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
__ JumpIfSmi(temp, &gotta_call_runtime);
// Save the literals in the closure.
__ StoreP(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset), r0);
__ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r6,
// Save the feedback vector in the closure.
__ StoreP(temp, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset),
r0);
__ RecordWriteField(closure, JSFunction::kFeedbackVectorOffset, temp, r6,
kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
......
......@@ -137,8 +137,7 @@ void FullCodeGenerator::Generate() {
// Increment invocation count for the function.
{
Comment cmnt(masm_, "[ Increment invocation count");
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
__ LoadP(r7, FieldMemOperand(r7, LiteralsArray::kFeedbackVectorOffset));
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kFeedbackVectorOffset));
__ LoadP(r8, FieldMemOperand(r7, TypeFeedbackVector::kInvocationCountIndex *
kPointerSize +
TypeFeedbackVector::kHeaderSize));
......@@ -1187,7 +1186,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Handle<BoilerplateDescription> constant_properties =
expr->GetOrBuildConstantProperties(isolate());
__ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index()));
__ LoadSmiLiteral(r5, SmiFromSlot(expr->literal_slot()));
__ mov(r4, Operand(constant_properties));
int flags = expr->ComputeFlags();
__ LoadSmiLiteral(r3, Smi::FromInt(flags));
......@@ -1327,7 +1326,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
}
__ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index()));
__ LoadSmiLiteral(r5, SmiFromSlot(expr->literal_slot()));
__ mov(r4, Operand(constant_elements));
if (MustCreateArrayLiteralWithRuntime(expr)) {
__ LoadSmiLiteral(r3, Smi::FromInt(expr->ComputeFlags()));
......
......@@ -137,8 +137,7 @@ void FullCodeGenerator::Generate() {
// Increment invocation count for the function.
{
Comment cmnt(masm_, "[ Increment invocation count");
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
__ LoadP(r6, FieldMemOperand(r6, LiteralsArray::kFeedbackVectorOffset));
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kFeedbackVectorOffset));
__ LoadP(r1, FieldMemOperand(r6, TypeFeedbackVector::kInvocationCountIndex *
kPointerSize +
TypeFeedbackVector::kHeaderSize));
......@@ -1150,7 +1149,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Handle<BoilerplateDescription> constant_properties =
expr->GetOrBuildConstantProperties(isolate());
__ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ LoadSmiLiteral(r4, Smi::FromInt(expr->literal_index()));
__ LoadSmiLiteral(r4, SmiFromSlot(expr->literal_slot()));
__ mov(r3, Operand(constant_properties));
int flags = expr->ComputeFlags();
__ LoadSmiLiteral(r2, Smi::FromInt(flags));
......@@ -1289,7 +1288,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
}
__ LoadP(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ LoadSmiLiteral(r4, Smi::FromInt(expr->literal_index()));
__ LoadSmiLiteral(r4, SmiFromSlot(expr->literal_slot()));
__ mov(r3, Operand(constant_elements));
if (MustCreateArrayLiteralWithRuntime(expr)) {
__ LoadSmiLiteral(r2, Smi::FromInt(expr->ComputeFlags()));
......
......@@ -1023,8 +1023,7 @@ void MacroAssembler::Prologue(bool code_pre_aging, Register base,
void MacroAssembler::EmitLoadTypeFeedbackVector(Register vector) {
LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
LoadP(vector, FieldMemOperand(vector, JSFunction::kLiteralsOffset));
LoadP(vector, FieldMemOperand(vector, LiteralsArray::kFeedbackVectorOffset));
LoadP(vector, FieldMemOperand(vector, JSFunction::kFeedbackVectorOffset));
}
......
......@@ -971,8 +971,7 @@ void MacroAssembler::Prologue(bool code_pre_aging, Register base,
void MacroAssembler::EmitLoadTypeFeedbackVector(Register vector) {
LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
LoadP(vector, FieldMemOperand(vector, JSFunction::kLiteralsOffset));
LoadP(vector, FieldMemOperand(vector, LiteralsArray::kFeedbackVectorOffset));
LoadP(vector, FieldMemOperand(vector, JSFunction::kFeedbackVectorOffset));
}
void MacroAssembler::EnterFrame(StackFrame::Type type,
......
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