From 626b95e37e58d10e9f504a645163c173b938fd21 Mon Sep 17 00:00:00 2001 From: bjaideep Date: Mon, 30 Jan 2017 07:25:54 -0800 Subject: [PATCH] PPC/s390: [TypeFeedbackVector] Combine the literals array and the feedback vector. Port 93f05b64ae1c1f8e010467331de1bf02d800dede 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} --- src/builtins/ppc/builtins-ppc.cc | 12 ++++++------ src/builtins/s390/builtins-s390.cc | 12 ++++++------ src/full-codegen/ppc/full-codegen-ppc.cc | 7 +++---- src/full-codegen/s390/full-codegen-s390.cc | 7 +++---- src/ppc/macro-assembler-ppc.cc | 3 +-- src/s390/macro-assembler-s390.cc | 3 +-- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc index 2e6c66936d..4265ad6e2f 100644 --- a/src/builtins/ppc/builtins-ppc.cc +++ b/src/builtins/ppc/builtins-ppc.cc @@ -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); diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc index 3106ef443b..42a8674d94 100644 --- a/src/builtins/s390/builtins-s390.cc +++ b/src/builtins/s390/builtins-s390.cc @@ -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); diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc index 7ff659fae6..4f4ff44089 100644 --- a/src/full-codegen/ppc/full-codegen-ppc.cc +++ b/src/full-codegen/ppc/full-codegen-ppc.cc @@ -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 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())); diff --git a/src/full-codegen/s390/full-codegen-s390.cc b/src/full-codegen/s390/full-codegen-s390.cc index 6910828dce..407d7d776e 100644 --- a/src/full-codegen/s390/full-codegen-s390.cc +++ b/src/full-codegen/s390/full-codegen-s390.cc @@ -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 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())); diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc index b8fa232e92..46add34394 100644 --- a/src/ppc/macro-assembler-ppc.cc +++ b/src/ppc/macro-assembler-ppc.cc @@ -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)); } diff --git a/src/s390/macro-assembler-s390.cc b/src/s390/macro-assembler-s390.cc index dfc11a0771..67245f5ab0 100644 --- a/src/s390/macro-assembler-s390.cc +++ b/src/s390/macro-assembler-s390.cc @@ -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,