Commit ed35983a authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Remove Ldr[Named/Keyed]Property bytecodes and use Star Lookahead instead.

The Ldr[Named/Keyed]Property bytecodes are problematic for the deoptimizer when
inlining accessors in TurboFan. Remove them and replace with a Star lookahead
in the bytecode handlers for Lda[Named/Keyed]Property.

BUG=v8:4280

Review-Url: https://codereview.chromium.org/2485383002
Cr-Commit-Position: refs/heads/master@{#40860}
parent 62688795
......@@ -1043,7 +1043,8 @@ void BytecodeGraphBuilder::VisitStaLookupSlotStrict() {
BuildStaLookupSlot(LanguageMode::STRICT);
}
Node* BytecodeGraphBuilder::BuildNamedLoad() {
void BytecodeGraphBuilder::VisitLdaNamedProperty() {
PrepareEagerCheckpoint();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<Name> name =
......@@ -1052,23 +1053,12 @@ Node* BytecodeGraphBuilder::BuildNamedLoad() {
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
const Operator* op = javascript()->LoadNamed(name, feedback);
return NewNode(op, object, GetFunctionClosure());
}
void BytecodeGraphBuilder::VisitLdaNamedProperty() {
PrepareEagerCheckpoint();
Node* node = BuildNamedLoad();
Node* node = NewNode(op, object, GetFunctionClosure());
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::VisitLdrNamedProperty() {
void BytecodeGraphBuilder::VisitLdaKeyedProperty() {
PrepareEagerCheckpoint();
Node* node = BuildNamedLoad();
environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node,
Environment::kAttachFrameState);
}
Node* BytecodeGraphBuilder::BuildKeyedLoad() {
Node* key = environment()->LookupAccumulator();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
......@@ -1076,22 +1066,10 @@ Node* BytecodeGraphBuilder::BuildKeyedLoad() {
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
const Operator* op = javascript()->LoadProperty(feedback);
return NewNode(op, object, key, GetFunctionClosure());
}
void BytecodeGraphBuilder::VisitLdaKeyedProperty() {
PrepareEagerCheckpoint();
Node* node = BuildKeyedLoad();
Node* node = NewNode(op, object, key, GetFunctionClosure());
environment()->BindAccumulator(node, Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::VisitLdrKeyedProperty() {
PrepareEagerCheckpoint();
Node* node = BuildKeyedLoad();
environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node,
Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) {
PrepareEagerCheckpoint();
Node* value = environment()->LookupAccumulator();
......
......@@ -138,9 +138,7 @@ class BytecodeGraphBuilder {
Node* BuildLoadCurrentContextSlot();
Node* BuildLoadGlobal(uint32_t feedback_slot_index, TypeofMode typeof_mode);
void BuildStoreGlobal(LanguageMode language_mode);
Node* BuildNamedLoad();
void BuildNamedStore(LanguageMode language_mode);
Node* BuildKeyedLoad();
void BuildKeyedStore(LanguageMode language_mode);
void BuildLdaLookupSlot(TypeofMode typeof_mode);
void BuildLdaLookupContextSlot(TypeofMode typeof_mode);
......
......@@ -211,6 +211,8 @@ bool Bytecodes::IsStarLookahead(Bytecode bytecode, OperandScale operand_scale) {
case Bytecode::kLdaNull:
case Bytecode::kLdaTheHole:
case Bytecode::kLdaConstant:
case Bytecode::kLdaNamedProperty:
case Bytecode::kLdaKeyedProperty:
case Bytecode::kAdd:
case Bytecode::kSub:
case Bytecode::kMul:
......
......@@ -87,12 +87,8 @@ namespace interpreter {
/* Property loads (LoadIC) operations */ \
V(LdaNamedProperty, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
V(LdrNamedProperty, AccumulatorUse::kNone, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx, OperandType::kRegOut) \
V(LdaKeyedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(LdrKeyedProperty, AccumulatorUse::kRead, OperandType::kReg, \
OperandType::kIdx, OperandType::kRegOut) \
\
/* Operations on module variables */ \
V(LdaModuleVariable, AccumulatorUse::kWrite, OperandType::kImm, \
......
......@@ -771,9 +771,13 @@ void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
DoStaLookupSlot(LanguageMode::STRICT, assembler);
}
Node* Interpreter::BuildLoadNamedProperty(Callable ic,
InterpreterAssembler* assembler) {
// LdaNamedProperty <object> <name_index> <slot>
//
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
// constant pool entry <name_index>.
void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_);
Node* code_target = __ HeapConstant(ic.code());
Node* register_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(register_index);
......@@ -783,38 +787,21 @@ Node* Interpreter::BuildLoadNamedProperty(Callable ic,
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
return __ CallStub(
Node* result = __ CallStub(
ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object),
Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
}
// LdaNamedProperty <object> <name_index> <slot>
//
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
// constant pool entry <name_index>.
void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_);
Node* result = BuildLoadNamedProperty(ic, assembler);
__ SetAccumulator(result);
__ Dispatch();
}
// LdrNamedProperty <object> <name_index> <slot> <reg>
// KeyedLoadIC <object> <slot>
//
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
// constant pool entry <name_index> and puts the result into register <reg>.
void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_);
Node* result = BuildLoadNamedProperty(ic, assembler);
Node* destination = __ BytecodeOperandReg(3);
__ StoreRegister(result, destination);
__ Dispatch();
}
Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
InterpreterAssembler* assembler) {
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
// in the accumulator.
void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_);
Node* code_target = __ HeapConstant(ic.code());
Node* reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(reg_index);
......@@ -823,35 +810,14 @@ Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
return __ CallStub(
Node* result = __ CallStub(
ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object),
Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
}
// KeyedLoadIC <object> <slot>
//
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
// in the accumulator.
void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) {
Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_);
Node* result = BuildLoadKeyedProperty(ic, assembler);
__ SetAccumulator(result);
__ Dispatch();
}
// LdrKeyedProperty <object> <slot> <reg>
//
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
// in the accumulator and puts the result in register <reg>.
void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_);
Node* result = BuildLoadKeyedProperty(ic, assembler);
Node* destination = __ BytecodeOperandReg(2);
__ StoreRegister(result, destination);
__ Dispatch();
}
void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
......
......@@ -150,14 +150,6 @@ class Interpreter {
compiler::Node* feedback_slot,
InterpreterAssembler* assembler);
// Generates code to load a named property.
compiler::Node* BuildLoadNamedProperty(Callable ic,
InterpreterAssembler* assembler);
// Generates code to load a keyed property.
compiler::Node* BuildLoadKeyedProperty(Callable ic,
InterpreterAssembler* assembler);
// Generates code to prepare the result for ForInPrepare. Cache data
// are placed into the consecutive series of registers starting at
// |output_register|.
......
......@@ -86,12 +86,6 @@ PeepholeActionAndData PeepholeActionTableWriter::LookupActionAndData(
// load so can be elided.
if (current == Bytecode::kStar) {
switch (last) {
case Bytecode::kLdaNamedProperty:
return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
Bytecode::kLdrNamedProperty};
case Bytecode::kLdaKeyedProperty:
return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
Bytecode::kLdrKeyedProperty};
case Bytecode::kLdaGlobal:
return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
Bytecode::kLdrGlobal};
......
......@@ -22,12 +22,13 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 36
bytecode array length: 37
bytecodes: [
B(Mov), R(closure), R(0),
/* 99 E> */ B(StackCheck),
/* 104 S> */ B(LdaConstant), U8(0),
/* 111 E> */ B(LdrKeyedProperty), R(closure), U8(4), R(4),
/* 111 E> */ B(LdaKeyedProperty), R(closure), U8(4),
B(Star), R(4),
B(LdaConstant), U8(1),
B(Star), R(5),
B(Mov), R(this), R(3),
......@@ -62,12 +63,13 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 45
bytecode array length: 47
bytecodes: [
B(Mov), R(closure), R(0),
/* 125 E> */ B(StackCheck),
/* 130 S> */ B(LdaConstant), U8(0),
/* 130 E> */ B(LdrKeyedProperty), R(closure), U8(2), R(2),
/* 130 E> */ B(LdaKeyedProperty), R(closure), U8(2),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(3),
B(LdaSmi), U8(2),
......@@ -75,7 +77,8 @@ bytecodes: [
B(Mov), R(this), R(1),
/* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4),
/* 143 S> */ B(LdaConstant), U8(0),
/* 150 E> */ B(LdrKeyedProperty), R(closure), U8(4), R(2),
/* 150 E> */ B(LdaKeyedProperty), R(closure), U8(4),
B(Star), R(2),
B(LdaConstant), U8(1),
B(Star), R(3),
B(Mov), R(this), R(1),
......
......@@ -14,7 +14,7 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 74
bytecode array length: 75
bytecodes: [
B(LdaTheHole),
B(Star), R(2),
......@@ -31,7 +31,8 @@ bytecodes: [
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(LdrNamedProperty), R(3), U8(1), U8(2), R(4),
B(LdaNamedProperty), R(3), U8(1), U8(2),
B(Star), R(4),
B(LdaConstant), U8(2),
B(ToName), R(6),
B(CreateClosure), U8(3), U8(2),
......@@ -67,7 +68,7 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 74
bytecode array length: 75
bytecodes: [
B(LdaTheHole),
B(Star), R(2),
......@@ -84,7 +85,8 @@ bytecodes: [
B(Star), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4),
B(Star), R(3),
B(LdrNamedProperty), R(3), U8(1), U8(2), R(4),
B(LdaNamedProperty), R(3), U8(1), U8(2),
B(Star), R(4),
B(LdaConstant), U8(2),
B(ToName), R(6),
B(CreateClosure), U8(3), U8(2),
......@@ -122,7 +124,7 @@ snippet: "
"
frame size: 11
parameter count: 1
bytecode array length: 120
bytecode array length: 121
bytecodes: [
B(CreateFunctionContext), U8(2),
B(PushContext), R(3),
......@@ -145,7 +147,8 @@ bytecodes: [
B(Star), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
B(LdrNamedProperty), R(4), U8(3), U8(2), R(5),
B(LdaNamedProperty), R(4), U8(3), U8(2),
B(Star), R(5),
/* 75 E> */ B(LdaCurrentContextSlot), U8(4),
B(ToName), R(7),
B(CreateClosure), U8(4), U8(2),
......@@ -194,7 +197,7 @@ snippet: "
"
frame size: 8
parameter count: 1
bytecode array length: 60
bytecode array length: 61
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(3),
......@@ -215,7 +218,8 @@ bytecodes: [
B(Star), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
B(LdrNamedProperty), R(4), U8(1), U8(2), R(5),
B(LdaNamedProperty), R(4), U8(1), U8(2),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kToFastProperties), R(4), U8(1),
B(Star), R(0),
B(Star), R(1),
......
......@@ -56,12 +56,13 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 25
bytecode array length: 26
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1),
B(Mov), R(1), R(0),
/* 54 S> */ B(LdrNamedProperty), R(0), U8(1), U8(2), R(2),
/* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2),
B(Star), R(2),
B(LdaSmi), U8(2),
B(Mul), R(2), U8(4),
/* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(5),
......@@ -81,14 +82,15 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 28
bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1),
B(Mov), R(1), R(0),
/* 52 S> */ B(LdaSmi), U8(1),
B(Star), R(2),
B(LdrKeyedProperty), R(0), U8(2), R(3),
B(LdaKeyedProperty), R(0), U8(2),
B(Star), R(3),
B(LdaSmi), U8(2),
B(BitwiseXor), R(3), U8(4),
/* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(5),
......
......@@ -80,7 +80,7 @@ snippet: "
"
frame size: 4
parameter count: 2
bytecode array length: 26
bytecode array length: 27
bytecodes: [
B(CreateUnmappedArguments),
B(Star), R(2),
......@@ -91,7 +91,8 @@ bytecodes: [
/* 10 E> */ B(StackCheck),
B(Mov), R(arg0), R(1),
/* 29 S> */ B(LdaZero),
/* 44 E> */ B(LdrKeyedProperty), R(0), U8(2), R(3),
/* 44 E> */ B(LdaKeyedProperty), R(0), U8(2),
B(Star), R(3),
B(LdaZero),
/* 59 E> */ B(LdaKeyedProperty), R(2), U8(4),
B(Add), R(3), U8(6),
......
......@@ -147,40 +147,42 @@ snippet: "
"
frame size: 7
parameter count: 1
bytecode array length: 83
bytecode array length: 85
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1),
B(Mov), R(1), R(0),
/* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9),
B(JumpIfUndefined), U8(68),
B(JumpIfNull), U8(66),
B(JumpIfUndefined), U8(70),
B(JumpIfNull), U8(68),
B(ToObject), R(1),
B(ForInPrepare), R(1), R(2),
B(LdaZero),
B(Star), R(5),
/* 68 S> */ B(ForInContinue), R(5), R(4),
B(JumpIfFalse), U8(53),
B(JumpIfFalse), U8(55),
B(ForInNext), R(1), R(5), R(2), U8(12),
B(JumpIfUndefined), U8(39),
B(JumpIfUndefined), U8(41),
B(Star), R(6),
/* 67 E> */ B(StaNamedPropertySloppy), R(0), U8(2), U8(10),
/* 62 E> */ B(StackCheck),
/* 95 S> */ B(Nop),
/* 100 E> */ B(LdrNamedProperty), R(0), U8(2), U8(4), R(6),
/* 100 E> */ B(LdaNamedProperty), R(0), U8(2), U8(4),
B(Star), R(6),
B(LdaSmi), U8(10),
/* 106 E> */ B(TestEqual), R(6), U8(6),
B(JumpIfFalse), U8(4),
/* 113 S> */ B(Jump), U8(17),
/* 113 S> */ B(Jump), U8(18),
/* 125 S> */ B(Nop),
/* 130 E> */ B(LdrNamedProperty), R(0), U8(2), U8(7), R(6),
/* 130 E> */ B(LdaNamedProperty), R(0), U8(2), U8(7),
B(Star), R(6),
B(LdaSmi), U8(20),
/* 136 E> */ B(TestEqual), R(6), U8(9),
B(JumpIfFalse), U8(4),
/* 143 S> */ B(Jump), U8(9),
B(ForInStep), R(5),
B(Star), R(5),
B(JumpLoop), U8(-53), U8(0),
B(JumpLoop), U8(-55), U8(0),
B(LdaUndefined),
/* 152 S> */ B(Return),
]
......
......@@ -266,7 +266,7 @@ snippet: "
"
frame size: 18
parameter count: 1
bytecode array length: 773
bytecode array length: 775
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(28),
......@@ -320,7 +320,7 @@ bytecodes: [
B(Star), R(6),
B(LdaZero),
B(Star), R(5),
B(JumpConstant), U8(19),
B(JumpConstant), U8(17),
B(Ldar), R(10),
/* 11 E> */ B(Throw),
B(Ldar), R(closure),
......@@ -335,7 +335,8 @@ bytecodes: [
/* 30 S> */ B(CreateArrayLiteral), U8(1), U8(0), U8(9),
B(Star), R(13),
B(LdaConstant), U8(2),
/* 30 E> */ B(LdrKeyedProperty), R(13), U8(4), R(12),
/* 30 E> */ B(LdaKeyedProperty), R(13), U8(4),
B(Star), R(12),
/* 30 E> */ B(CallProperty), R(12), R(13), U8(1), U8(2),
/* 30 E> */ B(StaContextSlot), R(1), U8(7), U8(0),
B(LdaSmi), U8(-2),
......@@ -348,7 +349,8 @@ bytecodes: [
B(Star), R(12),
B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1),
/* 27 S> */ B(LdrContextSlot), R(1), U8(7), U8(0), R(14),
B(LdrNamedProperty), R(14), U8(4), U8(8), R(13),
B(LdaNamedProperty), R(14), U8(4), U8(8),
B(Star), R(13),
/* 27 E> */ B(CallProperty), R(13), R(14), U8(1), U8(6),
/* 27 E> */ B(StaContextSlot), R(1), U8(8), U8(0),
B(Star), R(12),
......@@ -359,7 +361,7 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1),
B(LdrContextSlot), R(1), U8(8), U8(0), R(12),
B(LdaNamedProperty), R(12), U8(5), U8(10),
B(JumpIfToBooleanTrueConstant), U8(9),
B(JumpIfToBooleanTrueConstant), U8(3),
B(LdrContextSlot), R(1), U8(8), U8(0), R(12),
B(LdaNamedProperty), R(12), U8(6), U8(12),
B(StaContextSlot), R(1), U8(10), U8(0),
......@@ -417,11 +419,11 @@ bytecodes: [
B(PopContext), R(2),
B(LdaZero),
B(StaContextSlot), R(1), U8(9), U8(0),
B(Wide), B(JumpLoop), U16(-214), U16(0),
B(Wide), B(JumpLoop), U16(-215), U16(0),
B(Jump), U8(42),
B(Star), R(12),
B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(10), U8(11),
B(CreateCatchContext), R(12), U8(9), U8(10),
B(Star), R(11),
B(PushContext), R(2),
B(LdrContextSlot), R(0), U8(9), U8(0), R(12),
......@@ -444,19 +446,19 @@ bytecodes: [
B(LdrContextSlot), R(1), U8(9), U8(0), R(11),
B(LdaZero),
B(TestEqualStrict), R(11), U8(15),
B(JumpIfTrueConstant), U8(17),
B(JumpIfTrueConstant), U8(15),
B(LdrContextSlot), R(1), U8(7), U8(0), R(11),
B(LdaUndefined),
B(TestEqualStrict), R(11), U8(16),
B(JumpIfTrueConstant), U8(18),
B(JumpIfTrueConstant), U8(16),
B(LdrContextSlot), R(1), U8(7), U8(0), R(11),
B(LdaNamedProperty), R(11), U8(12), U8(17),
B(LdaNamedProperty), R(11), U8(11), U8(17),
B(StaContextSlot), R(1), U8(11), U8(0),
B(LdrContextSlot), R(1), U8(11), U8(0), R(11),
B(LdaNull),
B(TestEqual), R(11), U8(19),
B(JumpIfFalse), U8(4),
B(JumpConstant), U8(16),
B(JumpConstant), U8(8),
B(LdrContextSlot), R(1), U8(9), U8(0), R(11),
B(LdaSmi), U8(1),
B(TestEqualStrict), R(11), U8(20),
......@@ -464,13 +466,13 @@ bytecodes: [
B(LdaContextSlot), R(1), U8(11), U8(0),
B(TypeOf),
B(Star), R(11),
B(LdaConstant), U8(13),
B(LdaConstant), U8(12),
B(TestEqualStrict), R(11), U8(21),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), U16(130),
B(Star), R(11),
B(LdaConstant), U8(14),
B(LdaConstant), U8(13),
B(Star), R(12),
B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2),
B(Throw),
......@@ -481,7 +483,7 @@ bytecodes: [
B(Jump), U8(23),
B(Star), R(12),
B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(10), U8(15),
B(CreateCatchContext), R(12), U8(9), U8(14),
B(Star), R(11),
B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0),
B(Ldar), R(11),
......@@ -571,28 +573,26 @@ constant pool: [
FIXED_ARRAY_TYPE,
FIXED_ARRAY_TYPE,
SYMBOL_TYPE,
Smi [148],
Smi [149],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
FIXED_ARRAY_TYPE,
Smi [128],
Smi [149],
Smi [129],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
FIXED_ARRAY_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE,
Smi [129],
Smi [166],
Smi [155],
Smi [579],
Smi [581],
]
handlers: [
[46, 688, 694],
[143, 428, 434],
[146, 386, 388],
[542, 556, 558],
[46, 690, 696],
[143, 430, 436],
[146, 388, 390],
[544, 558, 560],
]
......@@ -594,7 +594,7 @@ snippet: "
"
frame size: 8
parameter count: 2
bytecode array length: 169
bytecode array length: 170
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(21),
......@@ -660,7 +660,8 @@ bytecodes: [
B(Star), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4),
B(Star), R(2),
B(LdrNamedProperty), R(2), U8(2), U8(2), R(3),
B(LdaNamedProperty), R(2), U8(2), U8(2),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1),
B(StaCurrentContextSlot), U8(6),
/* 16 E> */ B(LdaCurrentContextSlot), U8(6),
......@@ -821,7 +822,7 @@ snippet: "
"
frame size: 8
parameter count: 2
bytecode array length: 159
bytecode array length: 161
bytecodes: [
B(Ldar), R(new_target),
B(JumpIfUndefined), U8(21),
......@@ -880,10 +881,12 @@ bytecodes: [
B(Ldar), R(4),
/* 0 E> */ B(Throw),
/* 27 S> */ B(LdrCurrentContextSlot), U8(6), R(3),
/* 30 E> */ B(LdrNamedProperty), R(3), U8(1), U8(4), R(2),
/* 30 E> */ B(LdaNamedProperty), R(3), U8(1), U8(4),
B(Star), R(2),
/* 33 E> */ B(LdrCurrentContextSlot), U8(6), R(4),
/* 38 E> */ B(LdrCurrentContextSlot), U8(6), R(6),
/* 41 E> */ B(LdrNamedProperty), R(6), U8(2), U8(6), R(5),
/* 41 E> */ B(LdaNamedProperty), R(6), U8(2), U8(6),
B(Star), R(5),
/* 31 E> */ B(CallProperty), R(2), R(3), U8(3), U8(2),
B(LdaUndefined),
/* 45 S> */ B(Return),
......
......@@ -13,11 +13,12 @@ snippet: "
"
frame size: 1
parameter count: 2
bytecode array length: 13
bytecode array length: 14
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 16 S> */ B(Nop),
/* 24 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0),
/* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4),
B(Star), R(0),
/* 25 E> */ B(CallProperty), R(0), R(arg0), U8(1), U8(2),
/* 33 S> */ B(Return),
]
......@@ -34,12 +35,12 @@ snippet: "
"
frame size: 4
parameter count: 4
bytecode array length: 24
bytecode array length: 23
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 22 S> */ B(Nop),
/* 30 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0),
B(Ldar), R(0),
/* 30 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4),
B(Star), R(0),
B(Mov), R(arg0), R(1),
B(Mov), R(arg1), R(2),
B(Mov), R(arg2), R(3),
......@@ -59,11 +60,12 @@ snippet: "
"
frame size: 4
parameter count: 3
bytecode array length: 26
bytecode array length: 27
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 19 S> */ B(Nop),
/* 27 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0),
/* 27 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4),
B(Star), R(0),
B(Ldar), R(arg1),
/* 37 E> */ B(Add), R(arg1), U8(6),
B(Star), R(2),
......@@ -474,7 +476,8 @@ bytecodes: [
/* 1160 S> */ B(Nop),
/* 1161 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256),
/* 1169 S> */ B(Nop),
/* 1177 E> */ B(Wide), B(LdrNamedProperty), R16(arg0), U16(0), U16(260), R16(0),
/* 1177 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(260),
B(Star), R(0),
/* 1178 E> */ B(Wide), B(CallProperty), R16(0), R16(arg0), U16(1), U16(258),
/* 1186 S> */ B(Return),
]
......
......@@ -47,12 +47,13 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 22
bytecode array length: 23
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0),
B(Star), R(1),
/* 47 E> */ B(LdrNamedProperty), R(1), U8(1), U8(4), R(0),
/* 47 E> */ B(LdaNamedProperty), R(1), U8(1), U8(4),
B(Star), R(0),
B(LdaConstant), U8(2),
B(Star), R(2),
/* 48 E> */ B(CallProperty), R(0), R(1), U8(2), U8(2),
......
......@@ -310,11 +310,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit loads which will be transformed to Ldr equivalents by the peephole
// optimizer.
builder.LoadNamedProperty(reg, name, 0)
.StoreAccumulatorInRegister(reg)
.LoadKeyedProperty(reg, 0)
.StoreAccumulatorInRegister(reg)
.LoadContextSlot(reg, 1, 0)
builder.LoadContextSlot(reg, 1, 0)
.StoreAccumulatorInRegister(reg)
.LoadContextSlot(Register::current_context(), 1, 0)
.StoreAccumulatorInRegister(reg)
......@@ -396,8 +392,6 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
if (!FLAG_ignition_peephole) {
// Insert entries for bytecodes only emitted by peephole optimizer.
scorecard[Bytecodes::ToByte(Bytecode::kLdrNamedProperty)] = 1;
scorecard[Bytecodes::ToByte(Bytecode::kLdrKeyedProperty)] = 1;
scorecard[Bytecodes::ToByte(Bytecode::kLdrGlobal)] = 1;
scorecard[Bytecodes::ToByte(Bytecode::kLdrContextSlot)] = 1;
scorecard[Bytecodes::ToByte(Bytecode::kLdrCurrentContextSlot)] = 1;
......
......@@ -321,57 +321,6 @@ TEST_F(BytecodePeepholeOptimizerTest, NopStatementStackCheck) {
// Tests covering BytecodePeepholeOptimizer::UpdateLastAndCurrentBytecodes().
TEST_F(BytecodePeepholeOptimizerTest, MergeLoadICStar) {
const uint32_t operands[] = {
static_cast<uint32_t>(Register(31).ToOperand()), 32, 33,
static_cast<uint32_t>(Register(256).ToOperand())};
const int expected_operand_count = static_cast<int>(arraysize(operands));
BytecodeNode first(Bytecode::kLdaNamedProperty, operands[0], operands[1],
operands[2]);
BytecodeNode second(Bytecode::kStar, operands[3]);
BytecodeNode third(Bytecode::kReturn);
optimizer()->Write(&first);
optimizer()->Write(&second);
CHECK_EQ(write_count(), 1);
CHECK_EQ(last_written().bytecode(), Bytecode::kLdrNamedProperty);
CHECK_EQ(last_written().operand_count(), expected_operand_count);
for (int i = 0; i < expected_operand_count; ++i) {
CHECK_EQ(last_written().operand(i), operands[i]);
}
optimizer()->Write(&third);
CHECK_EQ(write_count(), 2);
CHECK_EQ(last_written().bytecode(), Bytecode::kLdar);
CHECK_EQ(last_written().operand(0), operands[expected_operand_count - 1]);
Flush();
CHECK_EQ(last_written().bytecode(), third.bytecode());
}
TEST_F(BytecodePeepholeOptimizerTest, MergeLdaKeyedPropertyStar) {
const uint32_t operands[] = {static_cast<uint32_t>(Register(31).ToOperand()),
9999997,
static_cast<uint32_t>(Register(1).ToOperand())};
const int expected_operand_count = static_cast<int>(arraysize(operands));
BytecodeNode first(Bytecode::kLdaKeyedProperty, operands[0], operands[1]);
BytecodeNode second(Bytecode::kStar, operands[2]);
BytecodeNode third(Bytecode::kReturn);
optimizer()->Write(&first);
optimizer()->Write(&second);
CHECK_EQ(write_count(), 1);
CHECK_EQ(last_written().bytecode(), Bytecode::kLdrKeyedProperty);
CHECK_EQ(last_written().operand_count(), expected_operand_count);
for (int i = 0; i < expected_operand_count; ++i) {
CHECK_EQ(last_written().operand(i), operands[i]);
}
optimizer()->Write(&third);
CHECK_EQ(write_count(), 2);
CHECK_EQ(last_written().bytecode(), Bytecode::kLdar);
CHECK_EQ(last_written().operand(0), operands[expected_operand_count - 1]);
Flush();
CHECK_EQ(last_written().bytecode(), third.bytecode());
}
TEST_F(BytecodePeepholeOptimizerTest, MergeLdaGlobalStar) {
const uint32_t operands[] = {19191,
static_cast<uint32_t>(Register(1).ToOperand())};
......
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