| Index: src/compiler/js-native-context-specialization.cc
|
| diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
|
| index a09e2f67591c9efdf7e5fcf35e71b11787f62639..cfe4d9ac26980888fa3fa7f936d33321598535ee 100644
|
| --- a/src/compiler/js-native-context-specialization.cc
|
| +++ b/src/compiler/js-native-context-specialization.cc
|
| @@ -38,6 +38,8 @@ JSNativeContextSpecialization::JSNativeContextSpecialization(
|
|
|
| Reduction JSNativeContextSpecialization::Reduce(Node* node) {
|
| switch (node->opcode()) {
|
| + case IrOpcode::kJSLoadContext:
|
| + return ReduceJSLoadContext(node);
|
| case IrOpcode::kJSLoadNamed:
|
| return ReduceJSLoadNamed(node);
|
| case IrOpcode::kJSStoreNamed:
|
| @@ -52,6 +54,21 @@ Reduction JSNativeContextSpecialization::Reduce(Node* node) {
|
| return NoChange();
|
| }
|
|
|
| +Reduction JSNativeContextSpecialization::ReduceJSLoadContext(Node* node) {
|
| + DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
|
| + ContextAccess const& access = ContextAccessOf(node->op());
|
| + Handle<Context> native_context;
|
| + // Specialize JSLoadContext(NATIVE_CONTEXT_INDEX) to the known native
|
| + // context (if any), so we can constant-fold those fields, which is
|
| + // safe, since the NATIVE_CONTEXT_INDEX slot is always immutable.
|
| + if (access.index() == Context::NATIVE_CONTEXT_INDEX &&
|
| + GetNativeContext(node).ToHandle(&native_context)) {
|
| + Node* value = jsgraph()->HeapConstant(native_context);
|
| + ReplaceWithValue(node, value);
|
| + return Replace(value);
|
| + }
|
| + return NoChange();
|
| +}
|
|
|
| Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
| Node* node, Node* value, MapHandleList const& receiver_maps,
|
|
|