Index: src/compiler/js-context-specialization.cc |
diff --git a/src/compiler/js-context-specialization.cc b/src/compiler/js-context-specialization.cc |
index a4f3ff49864fd9815c6e47bf9265c343b09019fa..8bbfe1e9498ddf1750408b620e2ebfbe55b17c60 100644 |
--- a/src/compiler/js-context-specialization.cc |
+++ b/src/compiler/js-context-specialization.cc |
@@ -34,25 +34,7 @@ MaybeHandle<Context> JSContextSpecialization::GetSpecializationContext( |
DCHECK(node->opcode() == IrOpcode::kJSLoadContext || |
node->opcode() == IrOpcode::kJSStoreContext); |
Node* const object = NodeProperties::GetValueInput(node, 0); |
- switch (object->opcode()) { |
- case IrOpcode::kHeapConstant: |
- return Handle<Context>::cast(OpParameter<Handle<HeapObject>>(object)); |
- case IrOpcode::kParameter: { |
- Node* const start = NodeProperties::GetValueInput(object, 0); |
- DCHECK_EQ(IrOpcode::kStart, start->opcode()); |
- int const index = ParameterIndexOf(object->op()); |
- // The context is always the last parameter to a JavaScript function, and |
- // {Parameter} indices start at -1, so value outputs of {Start} look like |
- // this: closure, receiver, param0, ..., paramN, context. |
- if (index == start->op()->ValueOutputCount() - 2) { |
- return context(); |
- } |
- break; |
- } |
- default: |
- break; |
- } |
- return MaybeHandle<Context>(); |
+ return NodeProperties::GetSpecializationContext(object, context()); |
} |