| Index: src/compiler/js-typed-lowering.cc
|
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
|
| index 628e7e07b69b1ae2ec4560e6c41058d2abdd58c5..68c3e308dc7df9c26ab9f92d5883389fce4c67d8 100644
|
| --- a/src/compiler/js-typed-lowering.cc
|
| +++ b/src/compiler/js-typed-lowering.cc
|
| @@ -1189,12 +1189,16 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) {
|
| Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
|
| DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
|
| Node* const input = NodeProperties::GetValueInput(node, 0);
|
| + Node* const closure = NodeProperties::GetValueInput(node, 1);
|
| Type* input_type = NodeProperties::GetBounds(input).upper;
|
| - if (FLAG_turbo_allocate && input_type->Is(Type::Receiver())) {
|
| + // The closure can be NumberConstant(0) if the closure is global code
|
| + // (rather than a function). We exclude that case here.
|
| + // TODO(jarin) Find a better way to check that the closure is a function.
|
| + if (FLAG_turbo_allocate && input_type->Is(Type::Receiver()) &&
|
| + closure->opcode() != IrOpcode::kNumberConstant) {
|
| // JSCreateWithContext(o:receiver, f)
|
| Node* const effect = NodeProperties::GetEffectInput(node);
|
| Node* const control = NodeProperties::GetControlInput(node);
|
| - Node* const closure = NodeProperties::GetValueInput(node, 1);
|
| Node* const context = NodeProperties::GetContextInput(node);
|
| Node* const load = graph()->NewNode(
|
| simplified()->LoadField(
|
|
|