| Index: src/compiler/js-typed-lowering.cc
|
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
|
| index 883219d47037d800acff6a80089933324fc9b49a..2e9ca86e30497bcbb4f571e3eaa84151ae688923 100644
|
| --- a/src/compiler/js-typed-lowering.cc
|
| +++ b/src/compiler/js-typed-lowering.cc
|
| @@ -1258,6 +1258,19 @@
|
| }
|
|
|
|
|
| +Reduction JSTypedLowering::ReduceJSLoadNativeContext(Node* node) {
|
| + DCHECK_EQ(IrOpcode::kJSLoadNativeContext, node->opcode());
|
| + Node* const effect = NodeProperties::GetEffectInput(node);
|
| + Node* const control = graph()->start();
|
| + node->ReplaceInput(1, effect);
|
| + node->ReplaceInput(2, control);
|
| + NodeProperties::ChangeOp(
|
| + node,
|
| + simplified()->LoadField(AccessBuilder::ForJSGlobalObjectNativeContext()));
|
| + return Changed(node);
|
| +}
|
| +
|
| +
|
| Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) {
|
| DCHECK_EQ(IrOpcode::kJSConvertReceiver, node->opcode());
|
| ConvertReceiverMode mode = ConvertReceiverModeOf(node->op());
|
| @@ -1278,12 +1291,13 @@
|
| isolate());
|
| receiver = jsgraph()->Constant(global_proxy);
|
| } else {
|
| - Node* native_context = effect = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| + Node* global_object = effect = graph()->NewNode(
|
| + javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true),
|
| context, context, effect);
|
| - receiver = effect = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true),
|
| - native_context, native_context, effect);
|
| + receiver = effect =
|
| + graph()->NewNode(simplified()->LoadField(
|
| + AccessBuilder::ForJSGlobalObjectGlobalProxy()),
|
| + global_object, effect, control);
|
| }
|
| } else if (!receiver_type->Maybe(Type::NullOrUndefined()) ||
|
| mode == ConvertReceiverMode::kNotNullOrUndefined) {
|
| @@ -1332,12 +1346,13 @@
|
| isolate());
|
| rglobal = jsgraph()->Constant(global_proxy);
|
| } else {
|
| - Node* native_context = eglobal = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| + Node* global_object = eglobal = graph()->NewNode(
|
| + javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true),
|
| context, context, eglobal);
|
| rglobal = eglobal = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::GLOBAL_PROXY_INDEX, true),
|
| - native_context, native_context, eglobal);
|
| + simplified()->LoadField(
|
| + AccessBuilder::ForJSGlobalObjectGlobalProxy()),
|
| + global_object, eglobal, if_global);
|
| }
|
| }
|
|
|
| @@ -1495,9 +1510,14 @@
|
| Node* allocate_effect =
|
| elements->op()->EffectOutputCount() > 0 ? elements : effect;
|
| // Load the arguments object map from the current native context.
|
| - Node* const load_native_context = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| - context, context, effect);
|
| + Node* const load_global_object = graph()->NewNode(
|
| + simplified()->LoadField(
|
| + AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
|
| + context, effect, control);
|
| + Node* const load_native_context =
|
| + graph()->NewNode(simplified()->LoadField(
|
| + AccessBuilder::ForJSGlobalObjectNativeContext()),
|
| + load_global_object, effect, control);
|
| Node* const load_arguments_map = graph()->NewNode(
|
| simplified()->LoadField(AccessBuilder::ForContextSlot(
|
| has_aliased_arguments ? Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX
|
| @@ -1535,9 +1555,14 @@
|
| Node* allocate_effect =
|
| elements->op()->EffectOutputCount() > 0 ? elements : effect;
|
| // Load the arguments object map from the current native context.
|
| - Node* const load_native_context = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| - context, context, effect);
|
| + Node* const load_global_object = graph()->NewNode(
|
| + simplified()->LoadField(
|
| + AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
|
| + context, effect, control);
|
| + Node* const load_native_context =
|
| + graph()->NewNode(simplified()->LoadField(
|
| + AccessBuilder::ForJSGlobalObjectNativeContext()),
|
| + load_global_object, effect, control);
|
| Node* const load_arguments_map = graph()->NewNode(
|
| simplified()->LoadField(
|
| AccessBuilder::ForContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX)),
|
| @@ -1592,9 +1617,13 @@
|
| js_array_map = jsgraph()->Constant(
|
| handle(js_array_maps->get(elements_kind), isolate()));
|
| } else {
|
| - Node* native_context = effect = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| + Node* global_object = effect = graph()->NewNode(
|
| + javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true),
|
| context, context, effect);
|
| + Node* native_context = effect =
|
| + graph()->NewNode(simplified()->LoadField(
|
| + AccessBuilder::ForJSGlobalObjectNativeContext()),
|
| + global_object, effect, control);
|
| Node* js_array_maps = effect = graph()->NewNode(
|
| javascript()->LoadContext(0, Context::JS_ARRAY_MAPS_INDEX, true),
|
| native_context, native_context, effect);
|
| @@ -1813,13 +1842,14 @@
|
| // Use inline allocation for function contexts up to a size limit.
|
| if (slot_count < kFunctionContextAllocationLimit) {
|
| // JSCreateFunctionContext[slot_count < limit]](fun)
|
| - Node* effect = NodeProperties::GetEffectInput(node);
|
| - Node* control = NodeProperties::GetControlInput(node);
|
| - Node* context = NodeProperties::GetContextInput(node);
|
| - Node* extension = jsgraph()->ZeroConstant();
|
| - Node* native_context = effect = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| - context, context, effect);
|
| + Node* const effect = NodeProperties::GetEffectInput(node);
|
| + Node* const control = NodeProperties::GetControlInput(node);
|
| + Node* const context = NodeProperties::GetContextInput(node);
|
| + Node* const extension = jsgraph()->ZeroConstant();
|
| + Node* const load = graph()->NewNode(
|
| + simplified()->LoadField(
|
| + AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
|
| + context, effect, control);
|
| AllocationBuilder a(jsgraph(), effect, control);
|
| STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
|
| int context_length = slot_count + Context::MIN_CONTEXT_SLOTS;
|
| @@ -1827,8 +1857,7 @@
|
| a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure);
|
| a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
|
| a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension);
|
| - a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
|
| - native_context);
|
| + a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load);
|
| for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
|
| a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->UndefinedConstant());
|
| }
|
| @@ -1862,17 +1891,17 @@
|
| Node* effect = NodeProperties::GetEffectInput(node);
|
| Node* control = NodeProperties::GetControlInput(node);
|
| Node* context = NodeProperties::GetContextInput(node);
|
| - Node* native_context = effect = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| - context, context, effect);
|
| + Node* global = effect = graph()->NewNode(
|
| + simplified()->LoadField(
|
| + AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
|
| + context, effect, control);
|
| AllocationBuilder a(jsgraph(), effect, control);
|
| STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
|
| a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map());
|
| a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure);
|
| a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
|
| a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object);
|
| - a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
|
| - native_context);
|
| + a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), global);
|
| RelaxControls(node);
|
| a.FinishAndChange(node);
|
| return Changed(node);
|
| @@ -1888,21 +1917,21 @@
|
| // Use inline allocation for block contexts up to a size limit.
|
| if (context_length < kBlockContextAllocationLimit) {
|
| // JSCreateBlockContext[scope[length < limit]](fun)
|
| - Node* effect = NodeProperties::GetEffectInput(node);
|
| - Node* control = NodeProperties::GetControlInput(node);
|
| - Node* context = NodeProperties::GetContextInput(node);
|
| - Node* extension = jsgraph()->Constant(scope_info);
|
| - Node* native_context = effect = graph()->NewNode(
|
| - javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
|
| - context, context, effect);
|
| + Node* const effect = NodeProperties::GetEffectInput(node);
|
| + Node* const control = NodeProperties::GetControlInput(node);
|
| + Node* const context = NodeProperties::GetContextInput(node);
|
| + Node* const extension = jsgraph()->Constant(scope_info);
|
| + Node* const load = graph()->NewNode(
|
| + simplified()->LoadField(
|
| + AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)),
|
| + context, effect, control);
|
| AllocationBuilder a(jsgraph(), effect, control);
|
| STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
|
| a.AllocateArray(context_length, factory()->block_context_map());
|
| a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure);
|
| a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
|
| a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension);
|
| - a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
|
| - native_context);
|
| + a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load);
|
| for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
|
| a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
|
| }
|
| @@ -2392,6 +2421,8 @@
|
| return ReduceJSLoadContext(node);
|
| case IrOpcode::kJSStoreContext:
|
| return ReduceJSStoreContext(node);
|
| + case IrOpcode::kJSLoadNativeContext:
|
| + return ReduceJSLoadNativeContext(node);
|
| case IrOpcode::kJSConvertReceiver:
|
| return ReduceJSConvertReceiver(node);
|
| case IrOpcode::kJSCreate:
|
|
|