Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index eeef0e94e84ba17d6c0063b76eb9cf15b0b637be..33c62496b1ab35cdb3b7f8761bcb0b8b2b32604a 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -2271,9 +2271,21 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
__ Set(rax, arg_count); |
__ movq(rdi, Operand(rsp, arg_count * kPointerSize)); |
- Handle<Code> construct_builtin = |
- isolate()->builtins()->JSConstructCall(); |
- __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
+ // Record call targets in unoptimized code, but not in the snapshot. |
+ CallFunctionFlags flags; |
+ if (!Serializer::enabled()) { |
+ flags = RECORD_CALL_TARGET; |
+ Handle<Object> uninitialized = CacheCells::UninitializedSentinel(isolate()); |
+ Handle<JSGlobalPropertyCell> cell = |
+ isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
+ RecordCacheCell(expr->id(), cell); |
+ __ Move(rbx, cell); |
+ } else { |
+ flags = NO_CALL_FUNCTION_FLAGS; |
+ } |
+ |
+ CallConstructStub stub(flags); |
+ __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
context()->Plug(rax); |
} |