[compiler] Remove context value input from JSLoadContext and JSStoreContext.
JS operators always have an implicit context input, so just use that instead. BUG= Review-Url: https://codereview.chromium.org/2541813002 Cr-Commit-Position: refs/heads/master@{#41392}
This commit is contained in:
parent
ec90ccb5ab
commit
9ef7ab1e2e
@ -305,7 +305,7 @@ Node* AstGraphBuilder::GetFunctionClosureForContext() {
|
||||
// calling eval, not the anonymous closure containing the eval code.
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(0, Context::CLOSURE_INDEX, false);
|
||||
return NewNode(op, current_context());
|
||||
return NewNode(op);
|
||||
} else {
|
||||
DCHECK(closure_scope->is_function_scope());
|
||||
return GetFunctionClosure();
|
||||
@ -945,7 +945,7 @@ void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
|
||||
if (variable->binding_needs_init()) {
|
||||
Node* value = jsgraph()->TheHoleConstant();
|
||||
const Operator* op = javascript()->StoreContext(0, variable->index());
|
||||
NewNode(op, current_context(), value);
|
||||
NewNode(op, value);
|
||||
}
|
||||
break;
|
||||
case VariableLocation::LOOKUP:
|
||||
@ -981,7 +981,7 @@ void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
|
||||
VisitForValue(decl->fun());
|
||||
Node* value = environment()->Pop();
|
||||
const Operator* op = javascript()->StoreContext(0, variable->index());
|
||||
NewNode(op, current_context(), value);
|
||||
NewNode(op, value);
|
||||
break;
|
||||
}
|
||||
case VariableLocation::LOOKUP:
|
||||
@ -2650,7 +2650,8 @@ Node* AstGraphBuilder::BuildLocalActivationContext(Node* context) {
|
||||
Variable* variable = scope->receiver();
|
||||
DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
|
||||
const Operator* op = javascript()->StoreContext(0, variable->index());
|
||||
NewNode(op, local_context, receiver);
|
||||
Node* node = NewNode(op, receiver);
|
||||
NodeProperties::ReplaceContextInput(node, local_context);
|
||||
}
|
||||
|
||||
// Copy parameters into context if necessary.
|
||||
@ -2662,7 +2663,8 @@ Node* AstGraphBuilder::BuildLocalActivationContext(Node* context) {
|
||||
// Context variable (at bottom of the context chain).
|
||||
DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
|
||||
const Operator* op = javascript()->StoreContext(0, variable->index());
|
||||
NewNode(op, local_context, parameter);
|
||||
Node* node = NewNode(op, parameter);
|
||||
NodeProperties::ReplaceContextInput(node, local_context);
|
||||
}
|
||||
|
||||
return local_context;
|
||||
@ -2801,7 +2803,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
|
||||
info()->is_function_context_specializing();
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(depth, variable->index(), immutable);
|
||||
Node* value = NewNode(op, current_context());
|
||||
Node* value = NewNode(op);
|
||||
// TODO(titzer): initialization checks are redundant for already
|
||||
// initialized immutable context loads, but only specialization knows.
|
||||
// Maybe specializer should be a parameter to the graph builder?
|
||||
@ -2918,7 +2920,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(
|
||||
// Perform an initialization check for let declared variables.
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(depth, variable->index(), false);
|
||||
Node* current = NewNode(op, current_context());
|
||||
Node* current = NewNode(op);
|
||||
value = BuildHoleCheckThenThrow(current, variable, value, bailout_id);
|
||||
} else if (mode == CONST && op == Token::INIT) {
|
||||
// Perform an initialization check for const {this} variables.
|
||||
@ -2927,7 +2929,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(
|
||||
if (variable->is_this()) {
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(depth, variable->index(), false);
|
||||
Node* current = NewNode(op, current_context());
|
||||
Node* current = NewNode(op);
|
||||
value = BuildHoleCheckElseThrow(current, variable, value, bailout_id);
|
||||
}
|
||||
} else if (mode == CONST && op != Token::INIT &&
|
||||
@ -2944,14 +2946,14 @@ Node* AstGraphBuilder::BuildVariableAssignment(
|
||||
if (variable->binding_needs_init()) {
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(depth, variable->index(), false);
|
||||
Node* current = NewNode(op, current_context());
|
||||
Node* current = NewNode(op);
|
||||
BuildHoleCheckThenThrow(current, variable, value, bailout_id);
|
||||
}
|
||||
// Assignment to const is exception in all modes.
|
||||
return BuildThrowConstAssignError(bailout_id);
|
||||
}
|
||||
const Operator* op = javascript()->StoreContext(depth, variable->index());
|
||||
return NewNode(op, current_context(), value);
|
||||
return NewNode(op, value);
|
||||
}
|
||||
case VariableLocation::LOOKUP:
|
||||
case VariableLocation::MODULE:
|
||||
@ -3063,8 +3065,10 @@ Node* AstGraphBuilder::BuildLoadGlobalObject() {
|
||||
Node* AstGraphBuilder::BuildLoadNativeContextField(int index) {
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true);
|
||||
Node* native_context = NewNode(op, current_context());
|
||||
return NewNode(javascript()->LoadContext(0, index, true), native_context);
|
||||
Node* native_context = NewNode(op);
|
||||
Node* result = NewNode(javascript()->LoadContext(0, index, true));
|
||||
NodeProperties::ReplaceContextInput(result, native_context);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -3499,8 +3503,7 @@ void AstGraphBuilder::Environment::PrepareForOsrEntry() {
|
||||
Node* osr_context = effect = contexts()->back();
|
||||
int last = static_cast<int>(contexts()->size() - 1);
|
||||
for (int i = last - 1; i >= 0; i--) {
|
||||
osr_context = effect =
|
||||
graph->NewNode(load_op, osr_context, osr_context, effect);
|
||||
osr_context = effect = graph->NewNode(load_op, osr_context, effect);
|
||||
contexts()->at(i) = osr_context;
|
||||
}
|
||||
UpdateEffectDependency(effect);
|
||||
|
@ -517,8 +517,10 @@ Node* BytecodeGraphBuilder::GetFunctionClosure() {
|
||||
Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) {
|
||||
const Operator* op =
|
||||
javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true);
|
||||
Node* native_context = NewNode(op, environment()->Context());
|
||||
return NewNode(javascript()->LoadContext(0, index, true), native_context);
|
||||
Node* native_context = NewNode(op);
|
||||
Node* result = NewNode(javascript()->LoadContext(0, index, true));
|
||||
NodeProperties::ReplaceContextInput(result, native_context);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -777,9 +779,10 @@ void BytecodeGraphBuilder::VisitLdaContextSlot() {
|
||||
const Operator* op = javascript()->LoadContext(
|
||||
bytecode_iterator().GetUnsignedImmediateOperand(2),
|
||||
bytecode_iterator().GetIndexOperand(1), false);
|
||||
Node* node = NewNode(op);
|
||||
Node* context =
|
||||
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
|
||||
Node* node = NewNode(op, context);
|
||||
NodeProperties::ReplaceContextInput(node, context);
|
||||
environment()->BindAccumulator(node);
|
||||
}
|
||||
|
||||
@ -789,8 +792,7 @@ void BytecodeGraphBuilder::VisitLdaCurrentContextSlot() {
|
||||
// changes.
|
||||
const Operator* op = javascript()->LoadContext(
|
||||
0, bytecode_iterator().GetIndexOperand(0), false);
|
||||
Node* context = environment()->Context();
|
||||
Node* node = NewNode(op, context);
|
||||
Node* node = NewNode(op);
|
||||
environment()->BindAccumulator(node);
|
||||
}
|
||||
|
||||
@ -798,18 +800,18 @@ void BytecodeGraphBuilder::VisitStaContextSlot() {
|
||||
const Operator* op = javascript()->StoreContext(
|
||||
bytecode_iterator().GetUnsignedImmediateOperand(2),
|
||||
bytecode_iterator().GetIndexOperand(1));
|
||||
Node* value = environment()->LookupAccumulator();
|
||||
Node* node = NewNode(op, value);
|
||||
Node* context =
|
||||
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
|
||||
Node* value = environment()->LookupAccumulator();
|
||||
NewNode(op, context, value);
|
||||
NodeProperties::ReplaceContextInput(node, context);
|
||||
}
|
||||
|
||||
void BytecodeGraphBuilder::VisitStaCurrentContextSlot() {
|
||||
const Operator* op =
|
||||
javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(0));
|
||||
Node* context = environment()->Context();
|
||||
Node* value = environment()->LookupAccumulator();
|
||||
NewNode(op, context, value);
|
||||
NewNode(op, value);
|
||||
}
|
||||
|
||||
void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
|
||||
@ -841,8 +843,7 @@ BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::CheckContextExtensions(
|
||||
// the same scope as the variable itself has no way of shadowing it.
|
||||
for (uint32_t d = 0; d < depth; d++) {
|
||||
Node* extension_slot =
|
||||
NewNode(javascript()->LoadContext(d, Context::EXTENSION_INDEX, false),
|
||||
environment()->Context());
|
||||
NewNode(javascript()->LoadContext(d, Context::EXTENSION_INDEX, false));
|
||||
|
||||
Node* check_no_extension =
|
||||
NewNode(javascript()->StrictEqual(CompareOperationHint::kAny),
|
||||
@ -888,8 +889,7 @@ void BytecodeGraphBuilder::BuildLdaLookupContextSlot(TypeofMode typeof_mode) {
|
||||
uint32_t slot_index = bytecode_iterator().GetIndexOperand(1);
|
||||
|
||||
const Operator* op = javascript()->LoadContext(depth, slot_index, false);
|
||||
Node* context = environment()->Context();
|
||||
environment()->BindAccumulator(NewNode(op, context));
|
||||
environment()->BindAccumulator(NewNode(op));
|
||||
}
|
||||
|
||||
// Only build the slow path if there were any slow-path checks.
|
||||
@ -1070,9 +1070,8 @@ void BytecodeGraphBuilder::VisitStaKeyedPropertyStrict() {
|
||||
void BytecodeGraphBuilder::VisitLdaModuleVariable() {
|
||||
int32_t cell_index = bytecode_iterator().GetImmediateOperand(0);
|
||||
uint32_t depth = bytecode_iterator().GetUnsignedImmediateOperand(1);
|
||||
Node* module =
|
||||
NewNode(javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false),
|
||||
environment()->Context());
|
||||
Node* module = NewNode(
|
||||
javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false));
|
||||
Node* value = NewNode(javascript()->LoadModule(cell_index), module);
|
||||
environment()->BindAccumulator(value);
|
||||
}
|
||||
@ -1080,9 +1079,8 @@ void BytecodeGraphBuilder::VisitLdaModuleVariable() {
|
||||
void BytecodeGraphBuilder::VisitStaModuleVariable() {
|
||||
int32_t cell_index = bytecode_iterator().GetImmediateOperand(0);
|
||||
uint32_t depth = bytecode_iterator().GetUnsignedImmediateOperand(1);
|
||||
Node* module =
|
||||
NewNode(javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false),
|
||||
environment()->Context());
|
||||
Node* module = NewNode(
|
||||
javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false));
|
||||
Node* value = environment()->LookupAccumulator();
|
||||
NewNode(javascript()->StoreModule(cell_index), module, value);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ MaybeHandle<Context> JSContextSpecialization::GetSpecializationContext(
|
||||
Node* node) {
|
||||
DCHECK(node->opcode() == IrOpcode::kJSLoadContext ||
|
||||
node->opcode() == IrOpcode::kJSStoreContext);
|
||||
Node* const object = NodeProperties::GetValueInput(node, 0);
|
||||
Node* const object = NodeProperties::GetContextInput(node);
|
||||
return NodeProperties::GetSpecializationContext(object, context());
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
|
||||
}
|
||||
const Operator* op = jsgraph_->javascript()->LoadContext(
|
||||
0, access.index(), access.immutable());
|
||||
node->ReplaceInput(0, jsgraph_->Constant(context));
|
||||
NodeProperties::ReplaceContextInput(node, jsgraph_->Constant(context));
|
||||
NodeProperties::ChangeOp(node, op);
|
||||
return Changed(node);
|
||||
}
|
||||
@ -101,7 +101,7 @@ Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
|
||||
context = handle(context->previous(), isolate());
|
||||
}
|
||||
|
||||
node->ReplaceInput(0, jsgraph_->Constant(context));
|
||||
NodeProperties::ReplaceContextInput(node, jsgraph_->Constant(context));
|
||||
NodeProperties::ChangeOp(node, javascript()->StoreContext(0, access.index()));
|
||||
return Changed(node);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) {
|
||||
Node* context = jsgraph()->HeapConstant(result.context);
|
||||
Node* value = effect = graph()->NewNode(
|
||||
javascript()->LoadContext(0, result.index, result.immutable), context,
|
||||
context, effect);
|
||||
effect);
|
||||
ReplaceWithValue(node, value, effect);
|
||||
return Replace(value);
|
||||
}
|
||||
@ -157,7 +157,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
|
||||
if (result.immutable) return NoChange();
|
||||
Node* context = jsgraph()->HeapConstant(result.context);
|
||||
effect = graph()->NewNode(javascript()->StoreContext(0, result.index),
|
||||
context, value, context, effect, control);
|
||||
value, context, effect, control);
|
||||
ReplaceWithValue(node, value, effect, control);
|
||||
return Replace(value);
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index,
|
||||
IrOpcode::kJSLoadContext, // opcode
|
||||
Operator::kNoWrite | Operator::kNoThrow, // flags
|
||||
"JSLoadContext", // name
|
||||
1, 1, 0, 1, 1, 0, // counts
|
||||
0, 1, 0, 1, 1, 0, // counts
|
||||
access); // parameter
|
||||
}
|
||||
|
||||
@ -767,7 +767,7 @@ const Operator* JSOperatorBuilder::StoreContext(size_t depth, size_t index) {
|
||||
IrOpcode::kJSStoreContext, // opcode
|
||||
Operator::kNoRead | Operator::kNoThrow, // flags
|
||||
"JSStoreContext", // name
|
||||
2, 1, 1, 0, 1, 0, // counts
|
||||
1, 1, 1, 0, 1, 0, // counts
|
||||
access); // parameter
|
||||
}
|
||||
|
||||
|
@ -1507,16 +1507,17 @@ Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) {
|
||||
DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
|
||||
ContextAccess const& access = ContextAccessOf(node->op());
|
||||
Node* effect = NodeProperties::GetEffectInput(node);
|
||||
Node* context = NodeProperties::GetContextInput(node);
|
||||
Node* control = graph()->start();
|
||||
for (size_t i = 0; i < access.depth(); ++i) {
|
||||
Node* previous = effect = graph()->NewNode(
|
||||
context = effect = graph()->NewNode(
|
||||
simplified()->LoadField(
|
||||
AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
|
||||
NodeProperties::GetValueInput(node, 0), effect, control);
|
||||
node->ReplaceInput(0, previous);
|
||||
context, effect, control);
|
||||
}
|
||||
node->ReplaceInput(0, context);
|
||||
node->ReplaceInput(1, effect);
|
||||
node->ReplaceInput(2, control);
|
||||
node->AppendInput(jsgraph()->zone(), control);
|
||||
NodeProperties::ChangeOp(
|
||||
node,
|
||||
simplified()->LoadField(AccessBuilder::ForContextSlot(access.index())));
|
||||
@ -1527,15 +1528,17 @@ Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) {
|
||||
DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
|
||||
ContextAccess const& access = ContextAccessOf(node->op());
|
||||
Node* effect = NodeProperties::GetEffectInput(node);
|
||||
Node* context = NodeProperties::GetContextInput(node);
|
||||
Node* control = graph()->start();
|
||||
Node* value = NodeProperties::GetValueInput(node, 0);
|
||||
for (size_t i = 0; i < access.depth(); ++i) {
|
||||
Node* previous = effect = graph()->NewNode(
|
||||
context = effect = graph()->NewNode(
|
||||
simplified()->LoadField(
|
||||
AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)),
|
||||
NodeProperties::GetValueInput(node, 0), effect, control);
|
||||
node->ReplaceInput(0, previous);
|
||||
context, effect, control);
|
||||
}
|
||||
node->RemoveInput(2);
|
||||
node->ReplaceInput(0, context);
|
||||
node->ReplaceInput(1, value);
|
||||
node->ReplaceInput(2, effect);
|
||||
NodeProperties::ChangeOp(
|
||||
node,
|
||||
@ -1648,10 +1651,10 @@ Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) {
|
||||
} else {
|
||||
Node* native_context = effect = graph()->NewNode(
|
||||
javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
||||
context, context, effect);
|
||||
context, effect);
|
||||
receiver = effect = graph()->NewNode(
|
||||
javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true),
|
||||
native_context, native_context, effect);
|
||||
native_context, effect);
|
||||
}
|
||||
ReplaceWithValue(node, receiver, effect, control);
|
||||
return Replace(receiver);
|
||||
@ -1753,10 +1756,10 @@ Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) {
|
||||
} else {
|
||||
Node* native_context = eglobal = graph()->NewNode(
|
||||
javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
||||
context, context, eglobal);
|
||||
context, eglobal);
|
||||
rglobal = eglobal = graph()->NewNode(
|
||||
javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true),
|
||||
native_context, native_context, eglobal);
|
||||
native_context, eglobal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ TEST(ReduceJSLoadContext) {
|
||||
{
|
||||
// Mutable slot, constant context, depth = 0 => do nothing.
|
||||
Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, 0, false),
|
||||
const_context, const_context, start);
|
||||
const_context, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
@ -80,7 +80,7 @@ TEST(ReduceJSLoadContext) {
|
||||
{
|
||||
// Mutable slot, non-constant context, depth = 0 => do nothing.
|
||||
Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, 0, false),
|
||||
param_context, param_context, start);
|
||||
param_context, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
@ -89,10 +89,10 @@ TEST(ReduceJSLoadContext) {
|
||||
// Mutable slot, constant context, depth > 0 => fold-in parent context.
|
||||
Node* load = t.graph()->NewNode(
|
||||
t.javascript()->LoadContext(2, Context::GLOBAL_EVAL_FUN_INDEX, false),
|
||||
deep_const_context, deep_const_context, start);
|
||||
deep_const_context, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(r.Changed());
|
||||
Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
|
||||
Node* new_context_input = NodeProperties::GetContextInput(r.replacement());
|
||||
CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
|
||||
HeapObjectMatcher match(new_context_input);
|
||||
CHECK_EQ(*native, *match.Value());
|
||||
@ -105,7 +105,7 @@ TEST(ReduceJSLoadContext) {
|
||||
{
|
||||
// Immutable slot, constant context, depth = 0 => specialize.
|
||||
Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true),
|
||||
const_context, const_context, start);
|
||||
const_context, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(r.Changed());
|
||||
CHECK(r.replacement() != load);
|
||||
@ -142,27 +142,24 @@ TEST(ReduceJSStoreContext) {
|
||||
|
||||
{
|
||||
// Mutable slot, constant context, depth = 0 => do nothing.
|
||||
Node* load =
|
||||
t.graph()->NewNode(t.javascript()->StoreContext(0, 0), const_context,
|
||||
const_context, const_context, start, start);
|
||||
Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, 0),
|
||||
const_context, const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
|
||||
{
|
||||
// Mutable slot, non-constant context, depth = 0 => do nothing.
|
||||
Node* load =
|
||||
t.graph()->NewNode(t.javascript()->StoreContext(0, 0), param_context,
|
||||
param_context, const_context, start, start);
|
||||
Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, 0),
|
||||
param_context, param_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
|
||||
{
|
||||
// Immutable slot, constant context, depth = 0 => do nothing.
|
||||
Node* load =
|
||||
t.graph()->NewNode(t.javascript()->StoreContext(0, slot), const_context,
|
||||
const_context, const_context, start, start);
|
||||
Node* load = t.graph()->NewNode(t.javascript()->StoreContext(0, slot),
|
||||
const_context, const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(!r.Changed());
|
||||
}
|
||||
@ -171,10 +168,10 @@ TEST(ReduceJSStoreContext) {
|
||||
// Mutable slot, constant context, depth > 0 => fold-in parent context.
|
||||
Node* load = t.graph()->NewNode(
|
||||
t.javascript()->StoreContext(2, Context::GLOBAL_EVAL_FUN_INDEX),
|
||||
deep_const_context, deep_const_context, const_context, start, start);
|
||||
deep_const_context, deep_const_context, start, start);
|
||||
Reduction r = t.spec()->Reduce(load);
|
||||
CHECK(r.Changed());
|
||||
Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
|
||||
Node* new_context_input = NodeProperties::GetContextInput(r.replacement());
|
||||
CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
|
||||
HeapObjectMatcher match(new_context_input);
|
||||
CHECK_EQ(*native, *match.Value());
|
||||
|
@ -523,17 +523,15 @@ TEST_F(JSTypedLoweringTest, JSLoadContext) {
|
||||
static bool kBooleans[] = {false, true};
|
||||
TRACED_FOREACH(size_t, index, kIndices) {
|
||||
TRACED_FOREACH(bool, immutable, kBooleans) {
|
||||
Reduction const r1 = Reduce(
|
||||
graph()->NewNode(javascript()->LoadContext(0, index, immutable),
|
||||
context, context, effect));
|
||||
Reduction const r1 = Reduce(graph()->NewNode(
|
||||
javascript()->LoadContext(0, index, immutable), context, effect));
|
||||
ASSERT_TRUE(r1.Changed());
|
||||
EXPECT_THAT(r1.replacement(),
|
||||
IsLoadField(AccessBuilder::ForContextSlot(index), context,
|
||||
effect, graph()->start()));
|
||||
|
||||
Reduction const r2 = Reduce(
|
||||
graph()->NewNode(javascript()->LoadContext(1, index, immutable),
|
||||
context, context, effect));
|
||||
Reduction const r2 = Reduce(graph()->NewNode(
|
||||
javascript()->LoadContext(1, index, immutable), context, effect));
|
||||
ASSERT_TRUE(r2.Changed());
|
||||
EXPECT_THAT(r2.replacement(),
|
||||
IsLoadField(AccessBuilder::ForContextSlot(index),
|
||||
@ -559,16 +557,16 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) {
|
||||
Node* const value = Parameter(type);
|
||||
|
||||
Reduction const r1 =
|
||||
Reduce(graph()->NewNode(javascript()->StoreContext(0, index), context,
|
||||
value, context, effect, control));
|
||||
Reduce(graph()->NewNode(javascript()->StoreContext(0, index), value,
|
||||
context, effect, control));
|
||||
ASSERT_TRUE(r1.Changed());
|
||||
EXPECT_THAT(r1.replacement(),
|
||||
IsStoreField(AccessBuilder::ForContextSlot(index), context,
|
||||
value, effect, control));
|
||||
|
||||
Reduction const r2 =
|
||||
Reduce(graph()->NewNode(javascript()->StoreContext(1, index), context,
|
||||
value, context, effect, control));
|
||||
Reduce(graph()->NewNode(javascript()->StoreContext(1, index), value,
|
||||
context, effect, control));
|
||||
ASSERT_TRUE(r2.Changed());
|
||||
EXPECT_THAT(r2.replacement(),
|
||||
IsStoreField(AccessBuilder::ForContextSlot(index),
|
||||
|
Loading…
Reference in New Issue
Block a user