Commit 1c0c5fda authored by leszeks's avatar leszeks Committed by Commit bot

[Interpreter] Move context chain search loop to handler

Moves the context chain search loop out of generated bytecode, and into
the (Lda|Ldr|Sda)ContextSlot handler, by passing the context depth in as
an additional operand. This should decrease the bytecode size and
increase performance for deep context chain searches, at the cost of
slightly increasing bytecode size for shallow context access.

Review-Url: https://codereview.chromium.org/2336643002
Cr-Commit-Position: refs/heads/master@{#39378}
parent 2ab3fcf4
......@@ -835,14 +835,12 @@ void BytecodeGraphBuilder::VisitStaGlobalStrict() {
}
Node* BytecodeGraphBuilder::BuildLoadContextSlot() {
// TODO(mythria): LoadContextSlots are unrolled by the required depth when
// generating bytecode. Hence the value of depth is always 0. Update this
// code, when the implementation changes.
// TODO(mythria): immutable flag is also set to false. This information is not
// available in bytecode array. update this code when the implementation
// changes.
const Operator* op = javascript()->LoadContext(
0, bytecode_iterator().GetIndexOperand(1), false);
const Operator* op =
javascript()->LoadContext(bytecode_iterator().GetIndexOperand(2),
bytecode_iterator().GetIndexOperand(1), false);
Node* context =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
return NewNode(op, context);
......@@ -855,15 +853,13 @@ void BytecodeGraphBuilder::VisitLdaContextSlot() {
void BytecodeGraphBuilder::VisitLdrContextSlot() {
Node* node = BuildLoadContextSlot();
environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node);
environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node);
}
void BytecodeGraphBuilder::VisitStaContextSlot() {
// TODO(mythria): LoadContextSlots are unrolled by the required depth when
// generating bytecode. Hence the value of depth is always 0. Update this
// code, when the implementation changes.
const Operator* op =
javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(1));
javascript()->StoreContext(bytecode_iterator().GetIndexOperand(2),
bytecode_iterator().GetIndexOperand(1));
Node* context =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Node* value = environment()->LookupAccumulator();
......
......@@ -270,16 +270,18 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
}
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
int slot_index) {
int slot_index,
int depth) {
Output(Bytecode::kLdaContextSlot, RegisterOperand(context),
UnsignedOperand(slot_index));
UnsignedOperand(slot_index), UnsignedOperand(depth));
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context,
int slot_index) {
int slot_index,
int depth) {
Output(Bytecode::kStaContextSlot, RegisterOperand(context),
UnsignedOperand(slot_index));
UnsignedOperand(slot_index), UnsignedOperand(depth));
return *this;
}
......
......@@ -94,11 +94,15 @@ class BytecodeArrayBuilder final : public ZoneObject {
int feedback_slot,
LanguageMode language_mode);
// Load the object at |slot_index| in |context| into the accumulator.
BytecodeArrayBuilder& LoadContextSlot(Register context, int slot_index);
// Stores the object in the accumulator into |slot_index| of |context|.
BytecodeArrayBuilder& StoreContextSlot(Register context, int slot_index);
// Load the object at |slot_index| at |depth| in the context chain starting
// with |context| into the accumulator.
BytecodeArrayBuilder& LoadContextSlot(Register context, int slot_index,
int depth);
// Stores the object in the accumulator into |slot_index| at |depth| in the
// context chain starting with |context|.
BytecodeArrayBuilder& StoreContextSlot(Register context, int slot_index,
int depth);
// Register-accumulator transfers.
BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg);
......
......@@ -922,8 +922,9 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) {
break;
case VariableLocation::CONTEXT:
if (variable->binding_needs_init()) {
DCHECK_EQ(0, execution_context()->ContextChainDepth(variable->scope()));
builder()->LoadTheHole().StoreContextSlot(execution_context()->reg(),
variable->index());
variable->index(), 0);
}
break;
case VariableLocation::LOOKUP: {
......@@ -963,8 +964,8 @@ void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) {
case VariableLocation::CONTEXT: {
DCHECK_EQ(0, execution_context()->ContextChainDepth(variable->scope()));
VisitForAccumulatorValue(decl->fun());
builder()->StoreContextSlot(execution_context()->reg(),
variable->index());
builder()->StoreContextSlot(execution_context()->reg(), variable->index(),
0);
break;
}
case VariableLocation::LOOKUP: {
......@@ -1957,24 +1958,12 @@ void BytecodeGenerator::VisitVariableLoad(Variable* variable,
Register context_reg;
if (context) {
context_reg = context->reg();
depth = 0;
} else {
context_reg = register_allocator()->NewRegister();
// Walk the context chain to find the context at the given depth.
// TODO(rmcilroy): Perform this work in a bytecode handler once we have
// a generic mechanism for performing jumps in interpreter.cc.
// TODO(mythria): Also update bytecode graph builder with correct depth
// when this changes.
builder()
->LoadAccumulatorWithRegister(execution_context()->reg())
.StoreAccumulatorInRegister(context_reg);
for (int i = 0; i < depth; ++i) {
builder()
->LoadContextSlot(context_reg, Context::PREVIOUS_INDEX)
.StoreAccumulatorInRegister(context_reg);
}
context_reg = execution_context()->reg();
}
builder()->LoadContextSlot(context_reg, variable->index());
builder()->LoadContextSlot(context_reg, variable->index(), depth);
BuildHoleCheckForVariableLoad(variable);
break;
}
......@@ -2152,24 +2141,9 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
if (context) {
context_reg = context->reg();
depth = 0;
} else {
Register value_temp = register_allocator()->NewRegister();
context_reg = register_allocator()->NewRegister();
// Walk the context chain to find the context at the given depth.
// TODO(rmcilroy): Perform this work in a bytecode handler once we have
// a generic mechanism for performing jumps in interpreter.cc.
// TODO(mythria): Also update bytecode graph builder with correct depth
// when this changes.
builder()
->StoreAccumulatorInRegister(value_temp)
.LoadAccumulatorWithRegister(execution_context()->reg())
.StoreAccumulatorInRegister(context_reg);
for (int i = 0; i < depth; ++i) {
builder()
->LoadContextSlot(context_reg, Context::PREVIOUS_INDEX)
.StoreAccumulatorInRegister(context_reg);
}
builder()->LoadAccumulatorWithRegister(value_temp);
context_reg = execution_context()->reg();
}
if (hole_check_required) {
......@@ -2177,14 +2151,14 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
Register value_temp = register_allocator()->NewRegister();
builder()
->StoreAccumulatorInRegister(value_temp)
.LoadContextSlot(context_reg, variable->index());
.LoadContextSlot(context_reg, variable->index(), depth);
BuildHoleCheckForVariableAssignment(variable, op);
builder()->LoadAccumulatorWithRegister(value_temp);
}
if (mode != CONST || op == Token::INIT) {
builder()->StoreContextSlot(context_reg, variable->index());
builder()->StoreContextSlot(context_reg, variable->index(), depth);
} else if (variable->throw_on_const_assignment(language_mode())) {
builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(), 0);
}
......@@ -2875,9 +2849,9 @@ void BytecodeGenerator::VisitDelete(UnaryOperation* expr) {
Register global_object = register_allocator()->NewRegister();
builder()
->LoadContextSlot(execution_context()->reg(),
Context::NATIVE_CONTEXT_INDEX)
Context::NATIVE_CONTEXT_INDEX, 0)
.StoreAccumulatorInRegister(native_context)
.LoadContextSlot(native_context, Context::EXTENSION_INDEX)
.LoadContextSlot(native_context, Context::EXTENSION_INDEX, 0)
.StoreAccumulatorInRegister(global_object)
.LoadLiteral(variable->name())
.Delete(global_object, language_mode());
......@@ -3223,7 +3197,7 @@ void BytecodeGenerator::BuildLocalActivationContextInitialization() {
// Context variable (at bottom of the context chain).
DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
builder()->LoadAccumulatorWithRegister(receiver).StoreContextSlot(
execution_context()->reg(), variable->index());
execution_context()->reg(), variable->index(), 0);
}
// Copy parameters into context if necessary.
......@@ -3237,8 +3211,8 @@ void BytecodeGenerator::BuildLocalActivationContextInitialization() {
Register parameter(builder()->Parameter(i + 1));
// Context variable (at bottom of the context chain).
DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
builder()->LoadAccumulatorWithRegister(parameter)
.StoreContextSlot(execution_context()->reg(), variable->index());
builder()->LoadAccumulatorWithRegister(parameter).StoreContextSlot(
execution_context()->reg(), variable->index(), 0);
}
}
......@@ -3359,15 +3333,15 @@ void BytecodeGenerator::VisitFunctionClosureForContext() {
Register native_context = register_allocator()->NewRegister();
builder()
->LoadContextSlot(execution_context()->reg(),
Context::NATIVE_CONTEXT_INDEX)
Context::NATIVE_CONTEXT_INDEX, 0)
.StoreAccumulatorInRegister(native_context)
.LoadContextSlot(native_context, Context::CLOSURE_INDEX);
.LoadContextSlot(native_context, Context::CLOSURE_INDEX, 0);
} else if (closure_scope->is_eval_scope()) {
// Contexts created by a call to eval have the same closure as the
// context calling eval, not the anonymous closure containing the eval
// code. Fetch it from the context.
builder()->LoadContextSlot(execution_context()->reg(),
Context::CLOSURE_INDEX);
Context::CLOSURE_INDEX, 0);
} else {
DCHECK(closure_scope->is_function_scope() ||
closure_scope->is_module_scope());
......
......@@ -106,11 +106,11 @@ namespace interpreter {
V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \
V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \
V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx) \
OperandType::kIdx, OperandType::kIdx) \
V(LdrContextSlot, AccumulatorUse::kNone, OperandType::kReg, \
OperandType::kIdx, OperandType::kRegOut) \
OperandType::kIdx, OperandType::kIdx, OperandType::kRegOut) \
V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \
OperandType::kIdx) \
OperandType::kIdx, OperandType::kIdx) \
\
/* Load-Store lookup slots */ \
V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \
......
......@@ -84,6 +84,36 @@ void InterpreterAssembler::SetContext(Node* value) {
StoreRegister(value, Register::current_context());
}
Node* InterpreterAssembler::GetContextAtDepth(Node* context, Node* depth) {
Variable cur_context(this, MachineRepresentation::kTaggedPointer);
cur_context.Bind(context);
Variable cur_depth(this, MachineRepresentation::kWord32);
cur_depth.Bind(depth);
Label context_found(this);
Variable* context_search_loop_variables[2] = {&cur_depth, &cur_context};
Label context_search(this, 2, context_search_loop_variables);
// Fast path if the depth is 0.
BranchIfWord32Equal(depth, Int32Constant(0), &context_found, &context_search);
// Loop until the depth is 0.
Bind(&context_search);
{
cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
cur_context.Bind(
LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
BranchIfWord32Equal(cur_depth.value(), Int32Constant(0), &context_found,
&context_search);
}
Bind(&context_found);
return cur_context.value();
}
Node* InterpreterAssembler::BytecodeOffset() {
return bytecode_offset_.value();
}
......
......@@ -53,6 +53,10 @@ class InterpreterAssembler : public CodeStubAssembler {
compiler::Node* GetContext();
void SetContext(compiler::Node* value);
// Context at |depth| in the context chain starting at |context|
compiler::Node* GetContextAtDepth(compiler::Node* context,
compiler::Node* depth);
// Number of registers.
compiler::Node* RegisterCount();
......
......@@ -520,37 +520,44 @@ compiler::Node* Interpreter::BuildLoadContextSlot(
Node* reg_index = __ BytecodeOperandReg(0);
Node* context = __ LoadRegister(reg_index);
Node* slot_index = __ BytecodeOperandIdx(1);
return __ LoadContextSlot(context, slot_index);
Node* depth = __ BytecodeOperandIdx(2);
Node* slot_context = __ GetContextAtDepth(context, depth);
return __ LoadContextSlot(slot_context, slot_index);
}
// LdaContextSlot <context> <slot_index>
// LdaContextSlot <context> <slot_index> <depth>
//
// Load the object in |slot_index| of |context| into the accumulator.
// Load the object in |slot_index| of the context at |depth| in the context
// chain starting at |context| into the accumulator.
void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) {
Node* result = BuildLoadContextSlot(assembler);
__ SetAccumulator(result);
__ Dispatch();
}
// LdrContextSlot <context> <slot_index> <reg>
// LdrContextSlot <context> <slot_index> <depth> <reg>
//
// Load the object in <slot_index> of <context> into register <reg>.
// Load the object in |slot_index| of the context at |depth| in the context
// chain of |context| into register |reg|.
void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) {
Node* result = BuildLoadContextSlot(assembler);
Node* destination = __ BytecodeOperandReg(2);
Node* destination = __ BytecodeOperandReg(3);
__ StoreRegister(result, destination);
__ Dispatch();
}
// StaContextSlot <context> <slot_index>
// StaContextSlot <context> <slot_index> <depth>
//
// Stores the object in the accumulator into |slot_index| of |context|.
// Stores the object in the accumulator into |slot_index| of the context at
// |depth| in the context chain starting at |context|.
void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) {
Node* value = __ GetAccumulator();
Node* reg_index = __ BytecodeOperandReg(0);
Node* context = __ LoadRegister(reg_index);
Node* slot_index = __ BytecodeOperandIdx(1);
__ StoreContextSlot(context, slot_index, value);
Node* depth = __ BytecodeOperandIdx(2);
Node* slot_context = __ GetContextAtDepth(context, depth);
__ StoreContextSlot(slot_context, slot_index, value);
__ Dispatch();
}
......
......@@ -678,25 +678,25 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 97
bytecode array length: 103
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
B(Star), R(1),
/* 52 S> */ B(Ldar), R(1),
B(JumpIfToBooleanFalse), U8(89),
B(JumpIfToBooleanFalse), U8(95),
/* 45 E> */ B(StackCheck),
B(Ldar), R(closure),
B(CreateBlockContext), U8(0),
B(PushContext), R(3),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(1), U8(2),
B(Star), R(0),
/* 73 S> */ B(LdaSmi), U8(1),
/* 73 E> */ B(StaContextSlot), R(context), U8(4),
/* 73 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(Mov), R(0), R(2),
/* 106 S> */ B(LdaContextSlot), R(context), U8(4),
/* 106 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(4),
......@@ -704,23 +704,23 @@ bytecodes: [
B(JumpIfToBooleanFalse), U8(8),
/* 113 S> */ B(PopContext), R(3),
B(PopContext), R(3),
B(Jump), U8(41),
/* 126 S> */ B(LdaContextSlot), R(context), U8(4),
B(Jump), U8(44),
/* 126 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1),
B(Inc), U8(1),
B(Star), R(4),
/* 127 E> */ B(LdaContextSlot), R(context), U8(4),
/* 127 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(PopContext), R(3),
B(Jump), U8(-89),
B(Jump), U8(-95),
B(LdaUndefined),
/* 137 S> */ B(Return),
]
......
......@@ -102,18 +102,18 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 32
bytecode array length: 34
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Ldar), R(closure),
B(CreateBlockContext), U8(0),
B(PushContext), R(2),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(1), U8(2),
B(Star), R(0),
/* 53 S> */ B(LdaSmi), U8(10),
/* 53 E> */ B(StaContextSlot), R(context), U8(4),
/* 53 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(Mov), R(0), R(1),
B(Ldar), R(0),
/* 88 S> */ B(Jump), U8(2),
......@@ -143,52 +143,52 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 107
bytecode array length: 116
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(2),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(Ldar), R(closure),
B(CreateBlockContext), U8(0),
B(PushContext), R(3),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(1), U8(2),
B(Star), R(0),
/* 76 S> */ B(LdaSmi), U8(2),
/* 76 E> */ B(StaContextSlot), R(context), U8(4),
/* 76 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(Mov), R(0), R(1),
/* 118 S> */ B(LdaContextSlot), R(context), U8(4),
/* 118 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1),
B(JumpIfToBooleanFalse), U8(6),
/* 125 S> */ B(PopContext), R(3),
B(Jump), U8(27),
B(Jump), U8(29),
/* 142 S> */ B(LdaSmi), U8(3),
B(Star), R(4),
/* 144 E> */ B(LdaContextSlot), R(context), U8(4),
/* 144 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(PopContext), R(3),
/* 155 S> */ B(LdaSmi), U8(4),
B(Star), R(4),
/* 157 E> */ B(LdaContextSlot), R(context), U8(4),
/* 157 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(3),
B(Star), R(5),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1),
B(Ldar), R(4),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 162 S> */ B(Return),
]
......
......@@ -12,16 +12,16 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 86
bytecode array length: 89
bytecodes: [
B(CreateFunctionContext), U8(3),
B(PushContext), R(0),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(StaContextSlot), R(context), U8(6),
B(StaContextSlot), R(context), U8(6), U8(0),
B(Ldar), R(new_target),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(CreateClosure), U8(0), U8(2),
/* 36 E> */ B(StaLookupSlotSloppy), U8(1),
......
......@@ -123,7 +123,7 @@ snippet: "
"
frame size: 11
parameter count: 1
bytecode array length: 124
bytecode array length: 128
bytecodes: [
B(CreateFunctionContext), U8(2),
B(PushContext), R(3),
......@@ -131,9 +131,9 @@ bytecodes: [
B(Star), R(2),
/* 30 E> */ B(StackCheck),
/* 43 S> */ B(LdaConstant), U8(0),
/* 43 E> */ B(StaContextSlot), R(context), U8(4),
/* 43 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 57 S> */ B(LdaConstant), U8(1),
/* 57 E> */ B(StaContextSlot), R(context), U8(5),
/* 57 E> */ B(StaContextSlot), R(context), U8(5), U8(0),
B(LdaTheHole),
B(Star), R(0),
/* 62 S> */ B(LdaTheHole),
......@@ -147,7 +147,7 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
B(LdrNamedProperty), R(4), U8(3), U8(1), R(5),
/* 75 E> */ B(LdaContextSlot), R(context), U8(4),
/* 75 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(ToName), R(7),
B(CreateClosure), U8(4), U8(2),
B(Star), R(8),
......@@ -157,7 +157,7 @@ bytecodes: [
B(Star), R(10),
B(Mov), R(5), R(6),
B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(6), U8(5),
/* 106 E> */ B(LdaContextSlot), R(context), U8(5),
/* 106 E> */ B(LdaContextSlot), R(context), U8(5), U8(0),
B(ToName), R(7),
B(LdaConstant), U8(3),
B(TestEqualStrict), R(7), U8(0),
......@@ -195,7 +195,7 @@ snippet: "
"
frame size: 8
parameter count: 1
bytecode array length: 73
bytecode array length: 74
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(3),
......@@ -203,7 +203,7 @@ bytecodes: [
B(Star), R(2),
/* 30 E> */ B(StackCheck),
/* 46 S> */ B(LdaZero),
/* 46 E> */ B(StaContextSlot), R(context), U8(4),
/* 46 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaTheHole),
B(Star), R(0),
/* 49 S> */ B(LdaTheHole),
......
......@@ -108,17 +108,17 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 26
bytecode array length: 29
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 45 S> */ B(CreateClosure), U8(0), U8(2),
/* 75 S> */ B(LdrContextSlot), R(context), U8(4), R(1),
/* 75 S> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(1),
B(BitwiseOrSmi), U8(24), R(1), U8(1),
/* 77 E> */ B(StaContextSlot), R(context), U8(4),
/* 77 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 84 S> */ B(Return),
]
......
......@@ -12,17 +12,17 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 21
bytecode array length: 23
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), U8(10),
/* 44 E> */ B(StaContextSlot), R(context), U8(4),
/* 44 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 74 S> */ B(Return),
]
......@@ -38,18 +38,18 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 34
bytecode array length: 37
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), U8(10),
/* 44 E> */ B(StaContextSlot), R(context), U8(4),
/* 74 S> */ B(LdaContextSlot), R(context), U8(4),
/* 44 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 74 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(2),
......@@ -69,24 +69,24 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 42
bytecode array length: 45
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 47 S> */ B(LdaSmi), U8(20),
B(Star), R(2),
/* 47 E> */ B(LdaContextSlot), R(context), U8(4),
/* 47 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
/* 47 E> */ B(StaContextSlot), R(context), U8(4),
/* 47 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 80 S> */ B(Return),
]
......@@ -103,20 +103,20 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 44
bytecode array length: 47
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), U8(10),
/* 44 E> */ B(StaContextSlot), R(context), U8(4),
/* 44 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 48 S> */ B(LdaSmi), U8(20),
B(Star), R(2),
/* 50 E> */ B(LdaContextSlot), R(context), U8(4),
/* 50 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(3),
......
......@@ -14,12 +14,12 @@ snippet: "
"
frame size: 1
parameter count: 2
bytecode array length: 14
bytecode array length: 15
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(0),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
/* 10 E> */ B(StackCheck),
/* 19 S> */ B(CreateClosure), U8(0), U8(2),
/* 52 S> */ B(Return),
......@@ -37,16 +37,16 @@ snippet: "
"
frame size: 2
parameter count: 2
bytecode array length: 19
bytecode array length: 21
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
/* 10 E> */ B(StackCheck),
/* 27 S> */ B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 53 S> */ B(LdaContextSlot), R(context), U8(4),
/* 53 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
/* 66 S> */ B(Return),
]
constant pool: [
......@@ -62,14 +62,14 @@ snippet: "
"
frame size: 1
parameter count: 5
bytecode array length: 19
bytecode array length: 21
bytecodes: [
B(CreateFunctionContext), U8(2),
B(PushContext), R(0),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
B(Ldar), R(arg2),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
/* 10 E> */ B(StackCheck),
/* 29 S> */ B(CreateClosure), U8(0), U8(2),
/* 61 S> */ B(Return),
......@@ -87,13 +87,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 14
bytecode array length: 15
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(0),
/* 10 E> */ B(StackCheck),
/* 26 S> */ B(Ldar), R(this),
/* 26 E> */ B(StaContextSlot), R(context), U8(4),
/* 26 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 32 S> */ B(CreateClosure), U8(0), U8(2),
/* 65 S> */ B(Return),
]
......
......@@ -198,18 +198,18 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 24
bytecode array length: 27
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 53 S> */ B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 78 S> */ B(LdaContextSlot), R(context), U8(4),
/* 78 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(Inc), U8(1),
/* 87 E> */ B(StaContextSlot), R(context), U8(4),
/* 87 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 90 S> */ B(Return),
]
constant pool: [
......@@ -224,19 +224,19 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 28
bytecode array length: 31
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 53 S> */ B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 78 S> */ B(LdaContextSlot), R(context), U8(4),
/* 78 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(ToNumber), R(2),
B(Dec), U8(1),
/* 86 E> */ B(StaContextSlot), R(context), U8(4),
/* 86 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(Ldar), R(2),
/* 90 S> */ B(Return),
]
......
......@@ -75,12 +75,12 @@ snippet: "
"
frame size: 2
parameter count: 2
bytecode array length: 18
bytecode array length: 19
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(Star), R(0),
/* 10 E> */ B(StackCheck),
......@@ -100,16 +100,16 @@ snippet: "
"
frame size: 2
parameter count: 4
bytecode array length: 25
bytecode array length: 28
bytecodes: [
B(CreateFunctionContext), U8(3),
B(PushContext), R(1),
B(Ldar), R(arg0),
B(StaContextSlot), R(context), U8(6),
B(StaContextSlot), R(context), U8(6), U8(0),
B(Ldar), R(arg1),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
B(Ldar), R(arg2),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(Star), R(0),
/* 10 E> */ B(StackCheck),
......
......@@ -99,16 +99,16 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 27
bytecode array length: 29
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(0),
/* 30 E> */ B(StackCheck),
/* 56 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1),
B(Ldar), R(1),
/* 56 E> */ B(StaContextSlot), R(context), U8(4),
/* 56 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 64 S> */ B(CreateClosure), U8(1), U8(2),
/* 93 S> */ B(LdrContextSlot), R(context), U8(4), R(1),
/* 93 S> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(1),
B(LdaSmi), U8(1),
B(DeletePropertyStrict), R(1),
/* 113 S> */ B(Return),
......
......@@ -12,16 +12,16 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 66
bytecode array length: 69
bytecodes: [
B(CreateFunctionContext), U8(3),
B(PushContext), R(0),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(StaContextSlot), R(context), U8(6),
B(StaContextSlot), R(context), U8(6), U8(0),
B(Ldar), R(new_target),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaConstant), U8(0),
B(Star), R(3),
......
......@@ -12,7 +12,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 277
bytecode array length: 278
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
......@@ -43,7 +43,7 @@ bytecodes: [
B(LdaZero),
B(Star), R(4),
B(Jump), U8(-49),
B(Jump), U8(36),
B(Jump), U8(37),
B(Star), R(13),
B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(5), U8(6),
......@@ -54,7 +54,7 @@ bytecodes: [
B(JumpIfFalse), U8(6),
B(LdaSmi), U8(1),
B(Star), R(4),
B(LdrContextSlot), R(context), U8(4), R(13),
B(LdrContextSlot), R(context), U8(4), U8(0), R(13),
B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1),
B(PopContext), R(8),
B(LdaSmi), U8(-1),
......@@ -138,9 +138,9 @@ constant pool: [
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 116, 122],
[7, 117, 123],
[10, 80, 82],
[199, 209, 211],
[200, 210, 212],
]
---
......@@ -150,7 +150,7 @@ snippet: "
"
frame size: 16
parameter count: 1
bytecode array length: 289
bytecode array length: 290
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
......@@ -181,8 +181,8 @@ bytecodes: [
/* 73 S> */ B(LdaZero),
B(Star), R(10),
B(Mov), R(1), R(11),
B(Jump), U8(50),
B(Jump), U8(36),
B(Jump), U8(51),
B(Jump), U8(37),
B(Star), R(14),
B(Ldar), R(closure),
B(CreateCatchContext), R(14), U8(5), U8(6),
......@@ -193,7 +193,7 @@ bytecodes: [
B(JumpIfFalse), U8(6),
B(LdaSmi), U8(1),
B(Star), R(5),
B(LdrContextSlot), R(context), U8(4), R(14),
B(LdrContextSlot), R(context), U8(4), U8(0), R(14),
B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1),
B(PopContext), R(9),
B(LdaSmi), U8(-1),
......@@ -282,9 +282,9 @@ constant pool: [
FIXED_ARRAY_TYPE,
]
handlers: [
[11, 117, 123],
[11, 118, 124],
[14, 81, 83],
[201, 211, 213],
[202, 212, 214],
]
---
......@@ -296,7 +296,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 295
bytecode array length: 296
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
......@@ -335,7 +335,7 @@ bytecodes: [
B(LdaZero),
B(Star), R(4),
B(Jump), U8(-67),
B(Jump), U8(36),
B(Jump), U8(37),
B(Star), R(13),
B(Ldar), R(closure),
B(CreateCatchContext), R(13), U8(5), U8(6),
......@@ -346,7 +346,7 @@ bytecodes: [
B(JumpIfFalse), U8(6),
B(LdaSmi), U8(1),
B(Star), R(4),
B(LdrContextSlot), R(context), U8(4), R(13),
B(LdrContextSlot), R(context), U8(4), U8(0), R(13),
B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1),
B(PopContext), R(8),
B(LdaSmi), U8(-1),
......@@ -430,9 +430,9 @@ constant pool: [
FIXED_ARRAY_TYPE,
]
handlers: [
[7, 134, 140],
[7, 135, 141],
[10, 98, 100],
[217, 227, 229],
[218, 228, 230],
]
---
......@@ -442,7 +442,7 @@ snippet: "
"
frame size: 14
parameter count: 1
bytecode array length: 302
bytecode array length: 303
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8),
......@@ -476,8 +476,8 @@ bytecodes: [
/* 96 E> */ B(LdrNamedProperty), R(0), U8(6), U8(15), R(9),
B(LdaZero),
B(Star), R(8),
B(Jump), U8(50),
B(Jump), U8(36),
B(Jump), U8(51),
B(Jump), U8(37),
B(Star), R(12),
B(Ldar), R(closure),
B(CreateCatchContext), R(12), U8(7), U8(8),
......@@ -488,7 +488,7 @@ bytecodes: [
B(JumpIfFalse), U8(6),
B(LdaSmi), U8(1),
B(Star), R(3),
B(LdrContextSlot), R(context), U8(4), R(12),
B(LdrContextSlot), R(context), U8(4), U8(0), R(12),
B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1),
B(PopContext), R(7),
B(LdaSmi), U8(-1),
......@@ -579,8 +579,8 @@ constant pool: [
FIXED_ARRAY_TYPE,
]
handlers: [
[15, 130, 136],
[15, 131, 137],
[18, 94, 96],
[214, 224, 226],
[215, 225, 227],
]
......@@ -65,11 +65,11 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 14
bytecode array length: 16
bytecodes: [
/* 32 E> */ B(StackCheck),
/* 39 S> */ B(LdrContextSlot), R(context), U8(3), R(0),
B(LdrContextSlot), R(0), U8(2), R(1),
/* 39 S> */ B(LdrContextSlot), R(context), U8(3), U8(0), R(0),
B(LdrContextSlot), R(0), U8(2), U8(0), R(1),
B(LdaConstant), U8(0),
B(DeletePropertySloppy), R(1),
/* 56 S> */ B(Return),
......@@ -90,11 +90,11 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 14
bytecode array length: 16
bytecodes: [
/* 18 E> */ B(StackCheck),
/* 25 S> */ B(LdrContextSlot), R(context), U8(3), R(0),
B(LdrContextSlot), R(0), U8(2), R(1),
/* 25 S> */ B(LdrContextSlot), R(context), U8(3), U8(0), R(0),
B(LdrContextSlot), R(0), U8(2), U8(0), R(1),
B(LdaConstant), U8(0),
B(DeletePropertySloppy), R(1),
/* 42 S> */ B(Return),
......
......@@ -12,17 +12,17 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 21
bytecode array length: 23
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 72 S> */ B(Return),
]
......@@ -38,18 +38,18 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 34
bytecode array length: 37
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 72 S> */ B(LdaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 72 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(2),
......@@ -69,25 +69,25 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 42
bytecode array length: 46
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(LdaSmi), U8(20),
B(Star), R(2),
/* 45 E> */ B(LdaContextSlot), R(context), U8(4),
/* 45 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1),
B(Ldar), R(2),
B(StaContextSlot), R(context), U8(4),
/* 45 E> */ B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
/* 45 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 78 S> */ B(Return),
]
......@@ -104,26 +104,26 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 44
bytecode array length: 48
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
B(LdaTheHole),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
/* 42 E> */ B(StaContextSlot), R(context), U8(4),
/* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0),
/* 46 S> */ B(LdaSmi), U8(20),
B(Star), R(2),
/* 48 E> */ B(LdaContextSlot), R(context), U8(4),
/* 48 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(1),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1),
B(Ldar), R(2),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(LdaUndefined),
/* 80 S> */ B(Return),
]
......
......@@ -12,16 +12,16 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 68
bytecode array length: 71
bytecodes: [
B(CreateFunctionContext), U8(3),
B(PushContext), R(0),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(StaContextSlot), R(context), U8(6),
B(StaContextSlot), R(context), U8(6), U8(0),
B(Ldar), R(new_target),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaConstant), U8(0),
B(Star), R(3),
......@@ -57,16 +57,16 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 69
bytecode array length: 72
bytecodes: [
B(CreateFunctionContext), U8(3),
B(PushContext), R(0),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(StaContextSlot), R(context), U8(6),
B(StaContextSlot), R(context), U8(6), U8(0),
B(Ldar), R(new_target),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaConstant), U8(0),
B(Star), R(3),
......@@ -103,16 +103,16 @@ snippet: "
"
frame size: 10
parameter count: 1
bytecode array length: 70
bytecode array length: 73
bytecodes: [
B(CreateFunctionContext), U8(3),
B(PushContext), R(0),
B(Ldar), R(this),
B(StaContextSlot), R(context), U8(4),
B(StaContextSlot), R(context), U8(4), U8(0),
B(CreateMappedArguments),
B(StaContextSlot), R(context), U8(6),
B(StaContextSlot), R(context), U8(6), U8(0),
B(Ldar), R(new_target),
B(StaContextSlot), R(context), U8(5),
B(StaContextSlot), R(context), U8(5), U8(0),
/* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaSmi), U8(20),
/* 36 E> */ B(StaLookupSlotSloppy), U8(0),
......
......@@ -19,15 +19,14 @@ snippet: "
var f = new Outer().getInnerFunc();
f();
"
frame size: 2
frame size: 1
parameter count: 1
bytecode array length: 16
bytecode array length: 14
bytecodes: [
/* 97 E> */ B(StackCheck),
/* 102 S> */ B(LdrContextSlot), R(context), U8(1), R(0),
B(LdrContextSlot), R(0), U8(4), R(1),
/* 120 E> */ B(LdaContextSlot), R(context), U8(4),
B(Mul), R(1), U8(1),
/* 102 S> */ B(LdrContextSlot), R(context), U8(4), U8(1), R(0),
/* 120 E> */ B(LdaContextSlot), R(context), U8(4), U8(0),
B(Mul), R(0), U8(1),
/* 130 S> */ B(Return),
]
constant pool: [
......@@ -47,15 +46,13 @@ snippet: "
var f = new Outer().getInnerFunc();
f();
"
frame size: 2
frame size: 0
parameter count: 1
bytecode array length: 16
bytecode array length: 11
bytecodes: [
/* 97 E> */ B(StackCheck),
/* 102 S> */ B(LdrContextSlot), R(context), U8(4), R(0),
/* 111 E> */ B(LdrContextSlot), R(context), U8(1), R(1),
B(Ldar), R(0),
B(StaContextSlot), R(1), U8(4),
/* 102 S> */ B(LdaContextSlot), R(context), U8(4), U8(0),
/* 111 E> */ B(StaContextSlot), R(context), U8(4), U8(1),
B(LdaUndefined),
/* 123 S> */ B(Return),
]
......
......@@ -83,8 +83,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit context operations.
builder.PushContext(reg)
.PopContext(reg)
.LoadContextSlot(reg, 1)
.StoreContextSlot(reg, 1);
.LoadContextSlot(reg, 1, 0)
.StoreContextSlot(reg, 1, 0);
// Emit load / store property operations.
builder.LoadNamedProperty(reg, name, 0)
......@@ -309,7 +309,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT);
// Emit wide context operations.
builder.LoadContextSlot(reg, 1024).StoreContextSlot(reg, 1024);
builder.LoadContextSlot(reg, 1024, 0).StoreContextSlot(reg, 1024, 0);
// Emit wide load / store lookup slots.
builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF)
......@@ -323,7 +323,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.StoreAccumulatorInRegister(reg)
.LoadKeyedProperty(reg, 0)
.StoreAccumulatorInRegister(reg)
.LoadContextSlot(reg, 1)
.LoadContextSlot(reg, 1, 0)
.StoreAccumulatorInRegister(reg)
.LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF)
.StoreAccumulatorInRegister(reg)
......
......@@ -398,11 +398,13 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaGlobalStar) {
TEST_F(BytecodePeepholeOptimizerTest, MergeLdaContextSlotStar) {
const uint32_t operands[] = {
static_cast<uint32_t>(Register(200000).ToOperand()), 55005500,
static_cast<uint32_t>(Register(0).ToOperand()),
static_cast<uint32_t>(Register(1).ToOperand())};
const int expected_operand_count = static_cast<int>(arraysize(operands));
BytecodeNode first(Bytecode::kLdaContextSlot, operands[0], operands[1]);
BytecodeNode second(Bytecode::kStar, operands[2]);
BytecodeNode first(Bytecode::kLdaContextSlot, operands[0], operands[1],
operands[2]);
BytecodeNode second(Bytecode::kStar, operands[3]);
BytecodeNode third(Bytecode::kReturn);
optimizer()->Write(&first);
optimizer()->Write(&second);
......
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