[Interpreter]: Use vector store for array literal computed stores.
Replaces the use of KeyedStoreICGeneric with a vector based KeyedStoreIC for array literal computed stores now that there is a feedback vector slot for these expressions. Removes KeyedStoreICGeneric bytecode since this is no longer necessary. BUG=v8:4280 LOG=N TBR=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/1400353002 Cr-Commit-Position: refs/heads/master@{#31262}
This commit is contained in:
parent
0f51a35061
commit
2ad5655260
@ -315,12 +315,6 @@ void BytecodeGraphBuilder::VisitKeyedStoreICStrict(
|
||||
}
|
||||
|
||||
|
||||
void BytecodeGraphBuilder::VisitKeyedStoreICGeneric(
|
||||
const interpreter::BytecodeArrayIterator& iterator) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
void BytecodeGraphBuilder::VisitPushContext(
|
||||
const interpreter::BytecodeArrayIterator& iterator) {
|
||||
UNIMPLEMENTED();
|
||||
|
@ -343,13 +343,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
|
||||
}
|
||||
|
||||
|
||||
BytecodeArrayBuilder& BytecodeArrayBuilder::GenericStoreKeyedProperty(
|
||||
Register object, Register key) {
|
||||
Output(Bytecode::kKeyedStoreICGeneric, object.ToOperand(), key.ToOperand());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure(
|
||||
PretenureFlag tenured) {
|
||||
DCHECK(FitsInImm8Operand(tenured));
|
||||
|
@ -78,8 +78,6 @@ class BytecodeArrayBuilder {
|
||||
BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key,
|
||||
int feedback_slot,
|
||||
LanguageMode language_mode);
|
||||
BytecodeArrayBuilder& GenericStoreKeyedProperty(Register object,
|
||||
Register key);
|
||||
|
||||
// Create a new closure for the SharedFunctionInfo in the accumulator.
|
||||
BytecodeArrayBuilder& CreateClosure(PretenureFlag tenured);
|
||||
|
@ -712,7 +712,9 @@ void BytecodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
->LoadLiteral(Smi::FromInt(array_index))
|
||||
.StoreAccumulatorInRegister(index);
|
||||
Visit(subexpr);
|
||||
builder()->GenericStoreKeyedProperty(literal, index);
|
||||
FeedbackVectorSlot slot = expr->LiteralFeedbackSlot();
|
||||
builder()->StoreKeyedProperty(literal, index, feedback_index(slot),
|
||||
language_mode());
|
||||
}
|
||||
|
||||
if (!literal_in_accumulator) {
|
||||
|
@ -67,8 +67,6 @@ namespace interpreter {
|
||||
OperandType::kIdx8) \
|
||||
V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \
|
||||
OperandType::kIdx8) \
|
||||
/* TODO(rmcilroy): Remove once literal stores have type feedback slots. */ \
|
||||
V(KeyedStoreICGeneric, OperandType::kReg8, OperandType::kReg8) \
|
||||
\
|
||||
/* Context operations */ \
|
||||
V(PushContext, OperandType::kReg8) \
|
||||
|
@ -347,26 +347,6 @@ void Interpreter::DoKeyedStoreICStrict(
|
||||
}
|
||||
|
||||
|
||||
// KeyedStoreICGeneric <object> <key>
|
||||
//
|
||||
// Calls the generic KeyedStoreIC for <object> and the key <key> with the value
|
||||
// in the accumulator.
|
||||
void Interpreter::DoKeyedStoreICGeneric(
|
||||
compiler::InterpreterAssembler* assembler) {
|
||||
Callable ic =
|
||||
CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, MEGAMORPHIC);
|
||||
Node* code_target = __ HeapConstant(ic.code());
|
||||
Node* object_reg_index = __ BytecodeOperandReg8(0);
|
||||
Node* object = __ LoadRegister(object_reg_index);
|
||||
Node* name_reg_index = __ BytecodeOperandReg8(1);
|
||||
Node* name = __ LoadRegister(name_reg_index);
|
||||
Node* value = __ GetAccumulator();
|
||||
Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value);
|
||||
__ SetAccumulator(result);
|
||||
__ Dispatch();
|
||||
}
|
||||
|
||||
|
||||
// PushContext <context>
|
||||
//
|
||||
// Pushes the accumulator as the current context, and saves it in <context>
|
||||
|
@ -1951,6 +1951,15 @@ TEST(FunctionLiterals) {
|
||||
TEST(ArrayLiterals) {
|
||||
InitializedHandleScope handle_scope;
|
||||
BytecodeGeneratorHelper helper;
|
||||
Zone zone;
|
||||
|
||||
FeedbackVectorSpec feedback_spec(&zone);
|
||||
FeedbackVectorSlot slot1 = feedback_spec.AddKeyedStoreICSlot();
|
||||
FeedbackVectorSlot slot2 = feedback_spec.AddKeyedStoreICSlot();
|
||||
FeedbackVectorSlot slot3 = feedback_spec.AddKeyedStoreICSlot();
|
||||
|
||||
Handle<i::TypeFeedbackVector> vector =
|
||||
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
|
||||
|
||||
int simple_flags =
|
||||
ArrayLiteral::kDisableMementos | ArrayLiteral::kShallowElements;
|
||||
@ -1970,26 +1979,26 @@ TEST(ArrayLiterals) {
|
||||
{"var a = 1; return [ a, a + 1 ];",
|
||||
4 * kPointerSize,
|
||||
1,
|
||||
37,
|
||||
39,
|
||||
{
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(0), //
|
||||
B(LdaConstant), U8(0), //
|
||||
B(CreateArrayLiteral), U8(0), U8(3), //
|
||||
B(Star), R(2), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(1), //
|
||||
B(Ldar), R(0), //
|
||||
B(KeyedStoreICGeneric), R(2), R(1), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(1), //
|
||||
B(Ldar), R(0), //
|
||||
B(Star), R(3), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Add), R(3), //
|
||||
B(KeyedStoreICGeneric), R(2), R(1), //
|
||||
B(Ldar), R(2), //
|
||||
B(Return) //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(0), //
|
||||
B(LdaConstant), U8(0), //
|
||||
B(CreateArrayLiteral), U8(0), U8(3), //
|
||||
B(Star), R(2), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(1), //
|
||||
B(Ldar), R(0), //
|
||||
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(1), //
|
||||
B(Ldar), R(0), //
|
||||
B(Star), R(3), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Add), R(3), //
|
||||
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), //
|
||||
B(Ldar), R(2), //
|
||||
B(Return) //
|
||||
},
|
||||
1,
|
||||
{InstanceType::FIXED_ARRAY_TYPE}},
|
||||
@ -2007,40 +2016,40 @@ TEST(ArrayLiterals) {
|
||||
{"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];",
|
||||
6 * kPointerSize,
|
||||
1,
|
||||
67,
|
||||
71,
|
||||
{
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(0), //
|
||||
B(LdaConstant), U8(0), //
|
||||
B(CreateArrayLiteral), U8(2), U8(deep_elements_flags), //
|
||||
B(Star), R(2), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(1), //
|
||||
B(LdaConstant), U8(1), //
|
||||
B(CreateArrayLiteral), U8(0), U8(simple_flags), //
|
||||
B(Star), R(4), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(3), //
|
||||
B(Ldar), R(0), //
|
||||
B(KeyedStoreICGeneric), R(4), R(3), //
|
||||
B(Ldar), R(4), //
|
||||
B(KeyedStoreICGeneric), R(2), R(1), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(1), //
|
||||
B(LdaConstant), U8(2), //
|
||||
B(CreateArrayLiteral), U8(1), U8(simple_flags), //
|
||||
B(Star), R(4), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(3), //
|
||||
B(Ldar), R(0), //
|
||||
B(Star), R(5), //
|
||||
B(LdaSmi8), U8(2), //
|
||||
B(Add), R(5), //
|
||||
B(KeyedStoreICGeneric), R(4), R(3), //
|
||||
B(Ldar), R(4), //
|
||||
B(KeyedStoreICGeneric), R(2), R(1), //
|
||||
B(Ldar), R(2), //
|
||||
B(Return), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(0), //
|
||||
B(LdaConstant), U8(0), //
|
||||
B(CreateArrayLiteral), U8(2), U8(deep_elements_flags), //
|
||||
B(Star), R(2), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(1), //
|
||||
B(LdaConstant), U8(1), //
|
||||
B(CreateArrayLiteral), U8(0), U8(simple_flags), //
|
||||
B(Star), R(4), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(3), //
|
||||
B(Ldar), R(0), //
|
||||
B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot1)), //
|
||||
B(Ldar), R(4), //
|
||||
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), //
|
||||
B(LdaSmi8), U8(1), //
|
||||
B(Star), R(1), //
|
||||
B(LdaConstant), U8(2), //
|
||||
B(CreateArrayLiteral), U8(1), U8(simple_flags), //
|
||||
B(Star), R(4), //
|
||||
B(LdaZero), //
|
||||
B(Star), R(3), //
|
||||
B(Ldar), R(0), //
|
||||
B(Star), R(5), //
|
||||
B(LdaSmi8), U8(2), //
|
||||
B(Add), R(5), //
|
||||
B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot2)), //
|
||||
B(Ldar), R(4), //
|
||||
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), //
|
||||
B(Ldar), R(2), //
|
||||
B(Return), //
|
||||
},
|
||||
3,
|
||||
{InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE,
|
||||
|
@ -57,8 +57,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
|
||||
.LoadNamedProperty(reg, 0, LanguageMode::STRICT)
|
||||
.LoadKeyedProperty(reg, 0, LanguageMode::STRICT)
|
||||
.StoreNamedProperty(reg, reg, 0, LanguageMode::STRICT)
|
||||
.StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT)
|
||||
.GenericStoreKeyedProperty(reg, reg);
|
||||
.StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT);
|
||||
|
||||
// Emit closure operations.
|
||||
builder.CreateClosure(NOT_TENURED);
|
||||
|
Loading…
Reference in New Issue
Block a user