Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 4f3274436a6585d16fe02a13b3c9fb1deec9d7ad..c843bc5ba51ebde8b23a646bdcb085e94de57c59 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -2130,28 +2130,20 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
SetSourcePosition(expr->position()); |
// Record call targets in unoptimized code, but not in the snapshot. |
- bool record_call_target = !Serializer::enabled(); |
- if (record_call_target) { |
+ if (!Serializer::enabled()) { |
flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
- } |
- CallFunctionStub stub(arg_count, flags); |
- __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
- __ CallStub(&stub, expr->id()); |
- if (record_call_target) { |
- // There is a one element cache in the instruction stream. |
-#ifdef DEBUG |
- int return_site_offset = masm()->pc_offset(); |
-#endif |
Handle<Object> uninitialized = |
- CallFunctionStub::UninitializedSentinel(isolate()); |
+ TypeFeedbackCells::UninitializedSentinel(isolate()); |
Handle<JSGlobalPropertyCell> cell = |
isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
- __ test(eax, Immediate(cell)); |
- // Patching code in the stub assumes the opcode is 1 byte and there is |
- // word for a pointer in the operand. |
- ASSERT(masm()->pc_offset() - return_site_offset >= 1 + kPointerSize); |
+ RecordTypeFeedbackCell(expr->id(), cell); |
+ __ mov(ebx, cell); |
} |
+ CallFunctionStub stub(arg_count, flags); |
+ __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
+ __ CallStub(&stub, expr->id()); |
+ |
RecordJSReturnSite(expr); |
// Restore context register. |
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
@@ -2325,9 +2317,22 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
__ SafeSet(eax, Immediate(arg_count)); |
__ mov(edi, Operand(esp, 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 = |
+ TypeFeedbackCells::UninitializedSentinel(isolate()); |
+ Handle<JSGlobalPropertyCell> cell = |
+ isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
+ RecordTypeFeedbackCell(expr->id(), cell); |
+ __ mov(ebx, cell); |
+ } else { |
+ flags = NO_CALL_FUNCTION_FLAGS; |
+ } |
+ |
+ CallConstructStub stub(flags); |
+ __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
context()->Plug(eax); |
} |