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

Unified Diff: src/arm/code-stubs-arm.cc

Issue 10706002: Implements a new API to set a function entry hook for profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Sketch ARM code stub. Created 8 years, 6 months 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/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index 169a032fb030c242448f4d491174348cc892a5ad..6f95889bfbb65f0c20d3e87a9f9744ab3f4444fd 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -7513,6 +7513,34 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
__ Ret();
}
+
+void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
+ __ stop("foo");
+
+ // Save volatile registers, note that lr is already saved by the caller,
+ // so we need to save an odd number here to keep the stack aligned.
+ __ Push(lr, r1, r0);
danno 2012/07/10 09:37:13 In general, you can't make guarantees about stack
Sigurður Ásgeirsson 2012/07/11 14:50:34 Done.
+
+ // TODO(siggi): Grab a timer somehow into r2/r3.
+
+ // Our return address, lr, points three instructions (12 bytes) into the
+ // function. Grab that for the first argument to the hook.
+ __ sub(r0, lr, Operand(0xC));
danno 2012/07/10 09:37:13 Define constants for this.
Sigurður Ásgeirsson 2012/07/11 14:50:34 Done.
+ // The caller's return address is 12 bytes up on the stack. Grab that
+ // for the second argument to the hook.
+ __ add(r1, sp, Operand(0x0C));
danno 2012/07/10 09:37:13 Is it possible to use an existing constant in fram
Sigurður Ásgeirsson 2012/07/11 14:50:34 This stub is called pre-frame generation, and does
+
+ ApiFunction dispatcher(
+ reinterpret_cast<Address>(V8::GetFunctionEntryHookDispatcher()));
danno 2012/07/10 09:37:13 If you really need the dispatcher for ARM only, th
Sigurður Ásgeirsson 2012/07/11 14:50:34 This is for the simulator. The simulator only forw
+ __ mov(ip, Operand(ExternalReference(&dispatcher,
+ ExternalReference::BUILTIN_CALL,
+ masm->isolate())));
+ __ Call(ip);
+ __ Pop(lr, r1, r0);
+
+ __ Ret();
+}
+
#undef __
} } // namespace v8::internal

Powered by Google App Engine
This is Rietveld 408576698