From 6b3c070db6e1e2e631f265410f540ec1a6df92ee Mon Sep 17 00:00:00 2001 From: bmeurer Date: Thu, 10 Sep 2015 01:35:55 -0700 Subject: [PATCH] [runtime] Sanitize %NewClosure runtime entries. There are now two runtime entries %NewClosure and %NewClosure_Tenured, with the same signature (one parameter, the SharedFunctionInfo, and the context of the caller). Also remove the HFunctionLiteral special case instruction from Crankshaft, as HCallWithDescriptor with FastNewClosureStub or HCallRuntime with either %NewClosure or %NewClosure_Tenured can easily do that for you. Also remove the redundant context parameter from the JSCreateClosure operator, because every JS operator already takes a context input. CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_nosnap_dbg Review URL: https://codereview.chromium.org/1329293003 Cr-Commit-Position: refs/heads/master@{#30671} --- src/arm/lithium-arm.cc | 7 --- src/arm/lithium-arm.h | 14 ----- src/arm/lithium-codegen-arm.cc | 20 -------- src/arm64/lithium-arm64.cc | 7 --- src/arm64/lithium-arm64.h | 14 ----- src/arm64/lithium-codegen-arm64.cc | 23 --------- src/code-stubs.cc | 3 +- src/compiler/ast-graph-builder.cc | 4 +- src/compiler/js-generic-lowering.cc | 7 +-- src/compiler/js-operator.cc | 2 +- src/compiler/js-typed-lowering.cc | 2 +- src/compiler/linkage.cc | 1 + src/full-codegen/arm/full-codegen-arm.cc | 8 ++- src/full-codegen/arm64/full-codegen-arm64.cc | 8 ++- src/full-codegen/ia32/full-codegen-ia32.cc | 7 +-- src/full-codegen/mips/full-codegen-mips.cc | 8 ++- .../mips64/full-codegen-mips64.cc | 8 ++- src/full-codegen/ppc/full-codegen-ppc.cc | 8 ++- src/full-codegen/x64/full-codegen-x64.cc | 7 +-- src/full-codegen/x87/full-codegen-x87.cc | 7 +-- src/hydrogen-instructions.cc | 1 - src/hydrogen-instructions.h | 51 ------------------- src/hydrogen.cc | 21 +++++++- src/ia32/lithium-codegen-ia32.cc | 20 -------- src/ia32/lithium-ia32.cc | 7 --- src/ia32/lithium-ia32.h | 14 ----- src/mips/lithium-codegen-mips.cc | 20 -------- src/mips/lithium-mips.cc | 7 --- src/mips/lithium-mips.h | 14 ----- src/mips64/lithium-codegen-mips64.cc | 20 -------- src/mips64/lithium-mips64.cc | 7 --- src/mips64/lithium-mips64.h | 14 ----- src/ppc/lithium-codegen-ppc.cc | 20 -------- src/ppc/lithium-ppc.cc | 7 --- src/ppc/lithium-ppc.h | 12 ----- src/runtime/runtime-scopes.cc | 22 ++++---- src/runtime/runtime.h | 4 +- src/x64/lithium-codegen-x64.cc | 20 -------- src/x64/lithium-x64.cc | 7 --- src/x64/lithium-x64.h | 14 ----- src/x87/lithium-codegen-x87.cc | 20 -------- src/x87/lithium-x87.cc | 7 --- src/x87/lithium-x87.h | 14 ----- .../compiler/js-typed-lowering-unittest.cc | 2 +- 44 files changed, 61 insertions(+), 449 deletions(-) diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 83acc4d3f..4ccb02099 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -2493,13 +2493,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), cp); - return MarkAsCall( - DefineFixed(new(zone()) LFunctionLiteral(context), r0), instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index acd5c207e..8954710e5 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -79,7 +79,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2566,19 +2565,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 74f527c4a..3049ddbce 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -5441,26 +5441,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ mov(r2, Operand(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ mov(r2, Operand(instr->hydrogen()->shared_info())); - __ mov(r1, Operand(pretenure ? factory()->true_value() - : factory()->false_value())); - __ Push(cp, r2, r1); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->value()).is(r3)); DCHECK(ToRegister(instr->result()).is(r0)); diff --git a/src/arm64/lithium-arm64.cc b/src/arm64/lithium-arm64.cc index 00db0bd03..e623718a1 100644 --- a/src/arm64/lithium-arm64.cc +++ b/src/arm64/lithium-arm64.cc @@ -1532,13 +1532,6 @@ LInstruction* LChunkBuilder::DoForceRepresentation( } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), cp); - return MarkAsCall( - DefineFixed(new(zone()) LFunctionLiteral(context), x0), instr); -} - - LInstruction* LChunkBuilder::DoGetCachedArrayIndex( HGetCachedArrayIndex* instr) { DCHECK(instr->value()->representation().IsTagged()); diff --git a/src/arm64/lithium-arm64.h b/src/arm64/lithium-arm64.h index 159e60cc5..a77a6da38 100644 --- a/src/arm64/lithium-arm64.h +++ b/src/arm64/lithium-arm64.h @@ -82,7 +82,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -1697,19 +1696,6 @@ class LLoadNamedField final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LLoadFunctionPrototype final : public LTemplateInstruction<1, 1, 1> { public: LLoadFunctionPrototype(LOperand* function, LOperand* temp) { diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index fe16d06d4..e256ed0b0 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -2829,29 +2829,6 @@ void LCodeGen::DoDummyUse(LDummyUse* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - // FunctionLiteral instruction is marked as call, we can trash any register. - DCHECK(instr->IsMarkedAsCall()); - - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ Mov(x2, Operand(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ Mov(x2, Operand(instr->hydrogen()->shared_info())); - __ Mov(x1, Operand(pretenure ? factory()->true_value() - : factory()->false_value())); - __ Push(cp, x2, x1); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { Register map = ToRegister(instr->map()); Register result = ToRegister(instr->result()); diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 113c236e7..e9fddf9bf 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -675,8 +675,7 @@ ElementsTransitionAndStoreStub::GetCallInterfaceDescriptor() const { void FastNewClosureStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { - descriptor->Initialize( - Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry); + descriptor->Initialize(Runtime::FunctionForId(Runtime::kNewClosure)->entry); } diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc index 5c67797b0..e1febbaf4 100644 --- a/src/compiler/ast-graph-builder.cc +++ b/src/compiler/ast-graph-builder.cc @@ -1510,8 +1510,6 @@ void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { - Node* context = current_context(); - // Find or build a shared function info. Handle shared_info = Compiler::GetSharedFunctionInfo(expr, info()->script(), info()); @@ -1520,7 +1518,7 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { // Create node to instantiate a new closure. PretenureFlag pretenure = expr->pretenure() ? TENURED : NOT_TENURED; const Operator* op = javascript()->CreateClosure(shared_info, pretenure); - Node* value = NewNode(op, context); + Node* value = NewNode(op); ast_context()->ProduceValue(value); } diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc index 2a9e6dafa..60b0c2ef0 100644 --- a/src/compiler/js-generic-lowering.cc +++ b/src/compiler/js-generic-lowering.cc @@ -491,9 +491,10 @@ void JSGenericLowering::LowerJSLoadDynamicContext(Node* node) { void JSGenericLowering::LowerJSCreateClosure(Node* node) { CreateClosureParameters p = CreateClosureParametersOf(node->op()); - node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.shared_info())); - node->InsertInput(zone(), 2, jsgraph()->BooleanConstant(p.pretenure())); - ReplaceWithRuntimeCall(node, Runtime::kNewClosure); + node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.shared_info())); + ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) + ? Runtime::kNewClosure_Tenured + : Runtime::kNewClosure); } diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc index d39efce87..c486e0285 100644 --- a/src/compiler/js-operator.cc +++ b/src/compiler/js-operator.cc @@ -711,7 +711,7 @@ const Operator* JSOperatorBuilder::CreateClosure( return new (zone()) Operator1( // -- IrOpcode::kJSCreateClosure, Operator::kNoThrow, // opcode "JSCreateClosure", // name - 1, 1, 1, 1, 1, 0, // counts + 0, 1, 1, 1, 1, 0, // counts parameters); // parameter } diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index 09d5d1680..4df056b76 100644 --- a/src/compiler/js-typed-lowering.cc +++ b/src/compiler/js-typed-lowering.cc @@ -1117,8 +1117,8 @@ Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) { CallDescriptor::kNoFlags); const Operator* new_op = common()->Call(desc); Node* stub_code = jsgraph()->HeapConstant(callable.code()); - node->ReplaceInput(0, jsgraph()->HeapConstant(shared)); node->InsertInput(graph()->zone(), 0, stub_code); + node->InsertInput(graph()->zone(), 1, jsgraph()->HeapConstant(shared)); node->set_op(new_op); return Changed(node); } diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc index 6b3c0778c..93f447fc9 100644 --- a/src/compiler/linkage.cc +++ b/src/compiler/linkage.cc @@ -227,6 +227,7 @@ int Linkage::FrameStateInputCount(Runtime::FunctionId function) { case Runtime::kGetOriginalConstructor: case Runtime::kNewArguments: case Runtime::kNewClosure: + case Runtime::kNewClosure_Tenured: case Runtime::kNewFunctionContext: case Runtime::kPushBlockContext: case Runtime::kPushCatchContext: diff --git a/src/full-codegen/arm/full-codegen-arm.cc b/src/full-codegen/arm/full-codegen-arm.cc index 7020a11e1..b67c63de7 100644 --- a/src/full-codegen/arm/full-codegen-arm.cc +++ b/src/full-codegen/arm/full-codegen-arm.cc @@ -1242,11 +1242,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ mov(r2, Operand(info)); __ CallStub(&stub); } else { - __ mov(r0, Operand(info)); - __ LoadRoot(r1, pretenure ? Heap::kTrueValueRootIndex - : Heap::kFalseValueRootIndex); - __ Push(cp, r0, r1); - __ CallRuntime(Runtime::kNewClosure, 3); + __ Push(info); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(r0); } diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc index 2e7efca9e..63cbf2cab 100644 --- a/src/full-codegen/arm64/full-codegen-arm64.cc +++ b/src/full-codegen/arm64/full-codegen-arm64.cc @@ -1238,11 +1238,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ Mov(x2, Operand(info)); __ CallStub(&stub); } else { - __ Mov(x11, Operand(info)); - __ LoadRoot(x10, pretenure ? Heap::kTrueValueRootIndex - : Heap::kFalseValueRootIndex); - __ Push(cp, x11, x10); - __ CallRuntime(Runtime::kNewClosure, 3); + __ Push(info); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(x0); } diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc index 8af4a7ae5..a7715707f 100644 --- a/src/full-codegen/ia32/full-codegen-ia32.cc +++ b/src/full-codegen/ia32/full-codegen-ia32.cc @@ -1172,12 +1172,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ mov(ebx, Immediate(info)); __ CallStub(&stub); } else { - __ push(esi); __ push(Immediate(info)); - __ push(Immediate(pretenure - ? isolate()->factory()->true_value() - : isolate()->factory()->false_value())); - __ CallRuntime(Runtime::kNewClosure, 3); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(eax); } diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc index 1553c1ab8..9e72de905 100644 --- a/src/full-codegen/mips/full-codegen-mips.cc +++ b/src/full-codegen/mips/full-codegen-mips.cc @@ -1241,11 +1241,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ li(a2, Operand(info)); __ CallStub(&stub); } else { - __ li(a0, Operand(info)); - __ LoadRoot(a1, pretenure ? Heap::kTrueValueRootIndex - : Heap::kFalseValueRootIndex); - __ Push(cp, a0, a1); - __ CallRuntime(Runtime::kNewClosure, 3); + __ Push(info); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(v0); } diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc index 311f293c1..468cce1d2 100644 --- a/src/full-codegen/mips64/full-codegen-mips64.cc +++ b/src/full-codegen/mips64/full-codegen-mips64.cc @@ -1239,11 +1239,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ li(a2, Operand(info)); __ CallStub(&stub); } else { - __ li(a0, Operand(info)); - __ LoadRoot(a1, pretenure ? Heap::kTrueValueRootIndex - : Heap::kFalseValueRootIndex); - __ Push(cp, a0, a1); - __ CallRuntime(Runtime::kNewClosure, 3); + __ Push(info); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(v0); } diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc index 6a2f1480b..6e91b5e18 100644 --- a/src/full-codegen/ppc/full-codegen-ppc.cc +++ b/src/full-codegen/ppc/full-codegen-ppc.cc @@ -1207,11 +1207,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ mov(r5, Operand(info)); __ CallStub(&stub); } else { - __ mov(r3, Operand(info)); - __ LoadRoot( - r4, pretenure ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); - __ Push(cp, r3, r4); - __ CallRuntime(Runtime::kNewClosure, 3); + __ Push(info); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(r3); } diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc index b4b7a8dfe..d5e630e29 100644 --- a/src/full-codegen/x64/full-codegen-x64.cc +++ b/src/full-codegen/x64/full-codegen-x64.cc @@ -1200,12 +1200,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ Move(rbx, info); __ CallStub(&stub); } else { - __ Push(rsi); __ Push(info); - __ Push(pretenure - ? isolate()->factory()->true_value() - : isolate()->factory()->false_value()); - __ CallRuntime(Runtime::kNewClosure, 3); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(rax); } diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index 27ea66e66..f80186370 100644 --- a/src/full-codegen/x87/full-codegen-x87.cc +++ b/src/full-codegen/x87/full-codegen-x87.cc @@ -1165,12 +1165,9 @@ void FullCodeGenerator::EmitNewClosure(Handle info, __ mov(ebx, Immediate(info)); __ CallStub(&stub); } else { - __ push(esi); __ push(Immediate(info)); - __ push(Immediate(pretenure - ? isolate()->factory()->true_value() - : isolate()->factory()->false_value())); - __ CallRuntime(Runtime::kNewClosure, 3); + __ CallRuntime( + pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); } context()->Plug(eax); } diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index e9ca09922..f65b0c262 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -861,7 +861,6 @@ bool HInstruction::CanDeoptimize() { case HValue::kDiv: case HValue::kForInCacheArray: case HValue::kForInPrepareMap: - case HValue::kFunctionLiteral: case HValue::kInvokeFunction: case HValue::kLoadContextSlot: case HValue::kLoadFunctionPrototype: diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 9ff807968..f81d8771a 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -98,7 +98,6 @@ class LChunkBuilder; V(ForceRepresentation) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -7552,56 +7551,6 @@ class HRegExpLiteral final : public HMaterializedLiteral<1> { }; -class HFunctionLiteral final : public HTemplateInstruction<1> { - public: - DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral, - Handle, - bool); - HValue* context() { return OperandAt(0); } - - Representation RequiredInputRepresentation(int index) override { - return Representation::Tagged(); - } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) - - Handle shared_info() const { return shared_info_; } - bool pretenure() const { return PretenureField::decode(bit_field_); } - bool has_no_literals() const { - return HasNoLiteralsField::decode(bit_field_); - } - FunctionKind kind() const { return FunctionKindField::decode(bit_field_); } - LanguageMode language_mode() const { - return LanguageModeField::decode(bit_field_); - } - - private: - HFunctionLiteral(HValue* context, Handle shared, - bool pretenure) - : HTemplateInstruction<1>(HType::JSObject()), - shared_info_(shared), - bit_field_(FunctionKindField::encode(shared->kind()) | - PretenureField::encode(pretenure) | - HasNoLiteralsField::encode(shared->num_literals() == 0) | - LanguageModeField::encode(shared->language_mode())) { - SetOperandAt(0, context); - set_representation(Representation::Tagged()); - SetChangesFlag(kNewSpacePromotion); - } - - bool IsDeletable() const override { return true; } - - class FunctionKindField : public BitField {}; - class PretenureField : public BitField {}; - class HasNoLiteralsField : public BitField {}; - STATIC_ASSERT(LANGUAGE_END == 3); - class LanguageModeField : public BitField {}; - - Handle shared_info_; - uint32_t bit_field_; -}; - - class HTypeof final : public HTemplateInstruction<2> { public: DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 902e50725..337c35b87 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -5473,8 +5473,25 @@ void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { expr, current_info()->script(), top_info()); // We also have a stack overflow if the recursive compilation did. if (HasStackOverflow()) return; - HFunctionLiteral* instr = - New(shared_info, expr->pretenure()); + // Use the fast case closure allocation code that allocates in new + // space for nested functions that don't need literals cloning. + HConstant* shared_info_value = Add(shared_info); + HInstruction* instr; + if (!expr->pretenure() && shared_info->num_literals() == 0) { + FastNewClosureStub stub(isolate(), shared_info->language_mode(), + shared_info->kind()); + FastNewClosureDescriptor descriptor(isolate()); + HValue* values[] = {context(), shared_info_value}; + HConstant* stub_value = Add(stub.GetCode()); + instr = New(stub_value, 0, descriptor, + Vector(values, arraysize(values)), + NORMAL_CALL); + } else { + Add(shared_info_value); + Runtime::FunctionId function_id = + expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; + instr = New(Runtime::FunctionForId(function_id), 1); + } return ast_context()->ReturnInstruction(instr, expr->id()); } diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 24f6f427c..16fe6694a 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -5330,26 +5330,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(esi)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ mov(ebx, Immediate(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ push(esi); - __ push(Immediate(instr->hydrogen()->shared_info())); - __ push(Immediate(pretenure ? factory()->true_value() - : factory()->false_value())); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->context()).is(esi)); DCHECK(ToRegister(instr->value()).is(ebx)); diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 160cd3ecc..884067b77 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -2538,13 +2538,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), esi); - return MarkAsCall( - DefineFixed(new(zone()) LFunctionLiteral(context), eax), instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index 8c7e28c2d..41468fdb8 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -83,7 +83,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2570,19 +2569,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 5e5800473..9d914838f 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -5464,26 +5464,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ li(a2, Operand(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ li(a2, Operand(instr->hydrogen()->shared_info())); - __ li(a1, Operand(pretenure ? factory()->true_value() - : factory()->false_value())); - __ Push(cp, a2, a1); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->value()).is(a3)); DCHECK(ToRegister(instr->result()).is(v0)); diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index 77a8280dd..42ecab4b8 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -2440,13 +2440,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), cp); - return MarkAsCall( - DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index 8c45ab922..ed3332ca6 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -79,7 +79,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2525,19 +2524,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index 4eeb53b53..810414dd7 100644 --- a/src/mips64/lithium-codegen-mips64.cc +++ b/src/mips64/lithium-codegen-mips64.cc @@ -5649,26 +5649,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ li(a2, Operand(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ li(a2, Operand(instr->hydrogen()->shared_info())); - __ li(a1, Operand(pretenure ? factory()->true_value() - : factory()->false_value())); - __ Push(cp, a2, a1); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->value()).is(a3)); DCHECK(ToRegister(instr->result()).is(v0)); diff --git a/src/mips64/lithium-mips64.cc b/src/mips64/lithium-mips64.cc index cd633b278..4f2f16152 100644 --- a/src/mips64/lithium-mips64.cc +++ b/src/mips64/lithium-mips64.cc @@ -2445,13 +2445,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), cp); - return MarkAsCall( - DefineFixed(new(zone()) LFunctionLiteral(context), v0), instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/mips64/lithium-mips64.h b/src/mips64/lithium-mips64.h index 8dae5e9df..01463c9d6 100644 --- a/src/mips64/lithium-mips64.h +++ b/src/mips64/lithium-mips64.h @@ -81,7 +81,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2571,19 +2570,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index 9d237300b..6360252c1 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -5738,26 +5738,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(cp)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ mov(r5, Operand(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ mov(r5, Operand(instr->hydrogen()->shared_info())); - __ mov(r4, Operand(pretenure ? factory()->true_value() - : factory()->false_value())); - __ Push(cp, r5, r4); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->value()).is(r6)); DCHECK(ToRegister(instr->result()).is(r3)); diff --git a/src/ppc/lithium-ppc.cc b/src/ppc/lithium-ppc.cc index 792297b75..767c771fb 100644 --- a/src/ppc/lithium-ppc.cc +++ b/src/ppc/lithium-ppc.cc @@ -2446,13 +2446,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), cp); - return MarkAsCall(DefineFixed(new (zone()) LFunctionLiteral(context), r3), - instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/ppc/lithium-ppc.h b/src/ppc/lithium-ppc.h index 0bc99ceaa..e862a11f6 100644 --- a/src/ppc/lithium-ppc.h +++ b/src/ppc/lithium-ppc.h @@ -79,7 +79,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2460,17 +2459,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { inputs_[0] = context; } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { inputs_[0] = value; } diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc index 6b7db0286..1aa6611fa 100644 --- a/src/runtime/runtime-scopes.cc +++ b/src/runtime/runtime-scopes.cc @@ -556,29 +556,25 @@ RUNTIME_FUNCTION(Runtime_NewStrictArguments) { } -RUNTIME_FUNCTION(Runtime_NewClosureFromStubFailure) { +RUNTIME_FUNCTION(Runtime_NewClosure) { HandleScope scope(isolate); - DCHECK(args.length() == 1); + DCHECK_EQ(1, args.length()); CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); - Handle context(isolate->context()); - PretenureFlag pretenure_flag = NOT_TENURED; + Handle context(isolate->context(), isolate); return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, - pretenure_flag); + NOT_TENURED); } -RUNTIME_FUNCTION(Runtime_NewClosure) { +RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { HandleScope scope(isolate); - DCHECK(args.length() == 3); - CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); - CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 1); - CONVERT_BOOLEAN_ARG_CHECKED(pretenure, 2); - + DCHECK_EQ(1, args.length()); + CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); + Handle context(isolate->context(), isolate); // The caller ensures that we pretenure closures that are assigned // directly to properties. - PretenureFlag pretenure_flag = pretenure ? TENURED : NOT_TENURED; return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, - pretenure_flag); + TENURED); } static Object* FindNameClash(Handle scope_info, diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 8a53bc862..5e47ddf49 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -545,8 +545,8 @@ namespace internal { F(NewArguments, 1, 1) /* TODO(turbofan): Only temporary */ \ F(NewSloppyArguments, 3, 1) \ F(NewStrictArguments, 3, 1) \ - F(NewClosureFromStubFailure, 1, 1) \ - F(NewClosure, 3, 1) \ + F(NewClosure, 1, 1) \ + F(NewClosure_Tenured, 1, 1) \ F(NewScriptContext, 2, 1) \ F(NewFunctionContext, 1, 1) \ F(PushWithContext, 2, 1) \ diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 4557ce13b..7ef838ab1 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -5508,26 +5508,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(rsi)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ Move(rbx, instr->hydrogen()->shared_info()); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ Push(rsi); - __ Push(instr->hydrogen()->shared_info()); - __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : - Heap::kFalseValueRootIndex); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->context()).is(rsi)); DCHECK(ToRegister(instr->value()).is(rbx)); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 0f880c7ad..9df3a7dab 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -2528,13 +2528,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), rsi); - LFunctionLiteral* result = new(zone()) LFunctionLiteral(context); - return MarkAsCall(DefineFixed(result, rax), instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index c46f5ac70..612951651 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -79,7 +79,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2535,19 +2534,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index b3dc919df..111a28127 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -5942,26 +5942,6 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { } -void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { - DCHECK(ToRegister(instr->context()).is(esi)); - // Use the fast case closure allocation code that allocates in new - // space for nested functions that don't need literals cloning. - bool pretenure = instr->hydrogen()->pretenure(); - if (!pretenure && instr->hydrogen()->has_no_literals()) { - FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), - instr->hydrogen()->kind()); - __ mov(ebx, Immediate(instr->hydrogen()->shared_info())); - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); - } else { - __ push(esi); - __ push(Immediate(instr->hydrogen()->shared_info())); - __ push(Immediate(pretenure ? factory()->true_value() - : factory()->false_value())); - CallRuntime(Runtime::kNewClosure, 3, instr); - } -} - - void LCodeGen::DoTypeof(LTypeof* instr) { DCHECK(ToRegister(instr->context()).is(esi)); DCHECK(ToRegister(instr->value()).is(ebx)); diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc index 472d9c588..cb429b2f2 100644 --- a/src/x87/lithium-x87.cc +++ b/src/x87/lithium-x87.cc @@ -2542,13 +2542,6 @@ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { } -LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { - LOperand* context = UseFixed(instr->context(), esi); - return MarkAsCall( - DefineFixed(new(zone()) LFunctionLiteral(context), eax), instr); -} - - LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { DCHECK(argument_count_ == 0); allocator_->MarkAsOsrEntry(); diff --git a/src/x87/lithium-x87.h b/src/x87/lithium-x87.h index 19aa42070..b2ceadb84 100644 --- a/src/x87/lithium-x87.h +++ b/src/x87/lithium-x87.h @@ -84,7 +84,6 @@ class LCodeGen; V(FlooringDivI) \ V(ForInCacheArray) \ V(ForInPrepareMap) \ - V(FunctionLiteral) \ V(GetCachedArrayIndex) \ V(Goto) \ V(HasCachedArrayIndexAndBranch) \ @@ -2584,19 +2583,6 @@ class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { }; -class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> { - public: - explicit LFunctionLiteral(LOperand* context) { - inputs_[0] = context; - } - - LOperand* context() { return inputs_[0]; } - - DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") - DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) -}; - - class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { public: explicit LToFastProperties(LOperand* value) { diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc index 62368553e..68ae6ab34 100644 --- a/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -1038,7 +1038,7 @@ TEST_F(JSTypedLoweringTest, JSCreateClosure) { Handle shared(isolate()->object_function()->shared()); Reduction r = Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED), - context, context, effect, control)); + context, effect, control)); ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsCall(_, IsHeapConstant(CodeFactory::FastNewClosure( -- 2.34.1