| Index: src/compiler/js-create-lowering.cc
|
| diff --git a/src/compiler/js-create-lowering.cc b/src/compiler/js-create-lowering.cc
|
| index 23ae27b36818c3ddde5c28c551e9f55b5ad478d2..3371f9884dfe19b2f89c1ed942756eac43211298 100644
|
| --- a/src/compiler/js-create-lowering.cc
|
| +++ b/src/compiler/js-create-lowering.cc
|
| @@ -215,6 +215,8 @@ Reduction JSCreateLowering::Reduce(Node* node) {
|
| return ReduceJSCreateLiteral(node);
|
| case IrOpcode::kJSCreateFunctionContext:
|
| return ReduceJSCreateFunctionContext(node);
|
| + case IrOpcode::kJSCreateEvalContext:
|
| + return ReduceJSCreateEvalContext(node);
|
| case IrOpcode::kJSCreateWithContext:
|
| return ReduceJSCreateWithContext(node);
|
| case IrOpcode::kJSCreateCatchContext:
|
| @@ -783,6 +785,38 @@ Reduction JSCreateLowering::ReduceJSCreateFunctionContext(Node* node) {
|
| return NoChange();
|
| }
|
|
|
| +Reduction JSCreateLowering::ReduceJSCreateEvalContext(Node* node) {
|
| + DCHECK_EQ(IrOpcode::kJSCreateEvalContext, node->opcode());
|
| + int slot_count = OpParameter<int>(node->op());
|
| + Node* const closure = NodeProperties::GetValueInput(node, 0);
|
| +
|
| + // 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()->TheHoleConstant();
|
| + AllocationBuilder a(jsgraph(), effect, control);
|
| + STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
|
| + int context_length = slot_count + Context::MIN_CONTEXT_SLOTS;
|
| + a.AllocateArray(context_length, factory()->eval_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),
|
| + jsgraph()->HeapConstant(native_context()));
|
| + for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
|
| + a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->UndefinedConstant());
|
| + }
|
| + RelaxControls(node);
|
| + a.FinishAndChange(node);
|
| + return Changed(node);
|
| + }
|
| +
|
| + return NoChange();
|
| +}
|
| +
|
| Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) {
|
| DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
|
| Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node);
|
|
|