Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 8932004: Implement target cache for constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 6e2391110b2346903d53b6d365fbe3d405afe3c1..9894c86bdde2770736ba7e1c5ad1af26dc4bb589 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -2321,13 +2321,31 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) {
// constructor invocation.
SetSourcePosition(expr->position());
- // Load function and argument count into edi and eax.
+ // Load function and argument count into edi and eax. Record call targets
+ // in unoptimized code, but not in the snapshot.
+ bool record_call_target = !Serializer::enabled();
+ CallFunctionFlags flags =
+ record_call_target ? RECORD_CALL_TARGET : NO_CALL_FUNCTION_FLAGS;
+ CallConstructStub stub(flags);
__ SafeSet(eax, Immediate(arg_count));
__ mov(edi, Operand(esp, arg_count * kPointerSize));
+ __ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
Vyacheslav Egorov (Chromium) 2012/01/23 10:39:52 RelocInfo::CONSTRUCT_CALL
Michael Starzinger 2012/01/25 11:42:29 Done. Required some changes in the debugger.
+
+ // There is a one element cache in the instruction stream.
+ if (record_call_target) {
Vyacheslav Egorov (Chromium) 2012/01/23 10:39:52 I am curious if you can introduce helper method (e
Michael Starzinger 2012/01/25 11:42:29 Done. No longer needed with new approach.
+#ifdef DEBUG
+ int return_site_offset = masm()->pc_offset();
+#endif
+ Handle<Object> uninitialized =
+ CallConstructStub::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);
+ }
- Handle<Code> construct_builtin =
- isolate()->builtins()->JSConstructCall();
- __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
context()->Plug(eax);
}

Powered by Google App Engine
This is Rietveld 408576698