Index: src/full-codegen/full-codegen.cc |
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc |
index 1133cab4ac0655c21565b4e0290f323a8b70f698..ae8880ddae7fb0514f457020496cfb0380294c0e 100644 |
--- a/src/full-codegen/full-codegen.cc |
+++ b/src/full-codegen/full-codegen.cc |
@@ -1027,7 +1027,11 @@ void FullCodeGenerator::EmitUnwindAndReturn() { |
} |
void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
+ FeedbackVectorSlot slot, |
bool pretenure) { |
+ // If slot is invalid, then it's a native function literal and we |
+ // can pass the empty array or empty literal array, something like that... |
+ |
// If we're running with the --always-opt or the --prepare-always-opt |
// flag, we need to use the runtime function so that the new function |
// we are creating here gets a chance to have its code optimized and |
@@ -1036,9 +1040,17 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
scope()->is_function_scope()) { |
FastNewClosureStub stub(isolate()); |
__ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); |
+ DCHECK(!slot.IsInvalid()); |
+ __ EmitLoadTypeFeedbackVector( |
+ stub.GetCallInterfaceDescriptor().GetRegisterParameter(1)); |
+ __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(2), |
+ SmiFromSlot(slot)); |
__ CallStub(&stub); |
} else { |
__ Push(info); |
+ __ EmitLoadTypeFeedbackVector(result_register()); |
+ __ Push(result_register()); |
+ __ Push(SmiFromSlot(slot)); |
__ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured |
: Runtime::kNewClosure); |
} |
@@ -1300,7 +1312,7 @@ void FullCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
SetStackOverflow(); |
return; |
} |
- EmitNewClosure(function_info, expr->pretenure()); |
+ EmitNewClosure(function_info, expr->LiteralFeedbackSlot(), expr->pretenure()); |
} |
@@ -1333,7 +1345,7 @@ void FullCodeGenerator::VisitNativeFunctionLiteral( |
Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
Handle<SharedFunctionInfo> shared = |
Compiler::GetSharedFunctionInfoForNative(expr->extension(), expr->name()); |
- EmitNewClosure(shared, false); |
+ EmitNewClosure(shared, expr->LiteralFeedbackSlot(), false); |
} |