Revision: 13078
Author: [email protected]
Date: Wed Nov 28 07:11:21 2012
Log: Also time external callbacks from generated code.
[email protected]
BUG=
Review URL: https://chromiumcodereview.appspot.com/11411224
http://code.google.com/p/v8/source/detail?r=13078
Modified:
/branches/bleeding_edge/src/arm/macro-assembler-arm.cc
/branches/bleeding_edge/src/assembler.cc
/branches/bleeding_edge/src/assembler.h
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
/branches/bleeding_edge/src/log.cc
/branches/bleeding_edge/src/log.h
/branches/bleeding_edge/src/x64/macro-assembler-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Thu Nov 15
05:31:27 2012
+++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Wed Nov 28
07:11:21 2012
@@ -2222,12 +2222,28 @@
add(r6, r6, Operand(1));
str(r6, MemOperand(r7, kLevelOffset));
+ if (FLAG_log_timer_events) {
+ FrameScope frame(this, StackFrame::MANUAL);
+ PushSafepointRegisters();
+ PrepareCallCFunction(0, r0);
+
CallCFunction(ExternalReference::log_enter_external_function(isolate()), 0);
+ PopSafepointRegisters();
+ }
+
// Native call returns to the DirectCEntry stub which redirects to the
// return address pushed on stack (could have moved after GC).
// DirectCEntry stub itself is generated early and never moves.
DirectCEntryStub stub;
stub.GenerateCall(this, function);
+ if (FLAG_log_timer_events) {
+ FrameScope frame(this, StackFrame::MANUAL);
+ PushSafepointRegisters();
+ PrepareCallCFunction(0, r0);
+
CallCFunction(ExternalReference::log_leave_external_function(isolate()), 0);
+ PopSafepointRegisters();
+ }
+
Label promote_scheduled_exception;
Label delete_allocated_handles;
Label leave_exit_frame;
=======================================
--- /branches/bleeding_edge/src/assembler.cc Mon Nov 26 05:12:35 2012
+++ /branches/bleeding_edge/src/assembler.cc Wed Nov 28 07:11:21 2012
@@ -1054,6 +1054,20 @@
return ExternalReference(
Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
}
+
+
+ExternalReference ExternalReference::log_enter_external_function(
+ Isolate* isolate) {
+ return ExternalReference(
+ Redirect(isolate, FUNCTION_ADDR(Logger::EnterExternal)));
+}
+
+
+ExternalReference ExternalReference::log_leave_external_function(
+ Isolate* isolate) {
+ return ExternalReference(
+ Redirect(isolate, FUNCTION_ADDR(Logger::LeaveExternal)));
+}
ExternalReference ExternalReference::keyed_lookup_cache_keys(Isolate*
isolate) {
=======================================
--- /branches/bleeding_edge/src/assembler.h Mon Nov 26 05:12:35 2012
+++ /branches/bleeding_edge/src/assembler.h Wed Nov 28 07:11:21 2012
@@ -661,6 +661,10 @@
static ExternalReference new_deoptimizer_function(Isolate* isolate);
static ExternalReference compute_output_frames_function(Isolate*
isolate);
+ // Log support.
+ static ExternalReference log_enter_external_function(Isolate* isolate);
+ static ExternalReference log_leave_external_function(Isolate* isolate);
+
// Static data in the keyed lookup cache.
static ExternalReference keyed_lookup_cache_keys(Isolate* isolate);
static ExternalReference keyed_lookup_cache_field_offsets(Isolate*
isolate);
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Thu Nov 15
05:31:27 2012
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Wed Nov 28
07:11:21 2012
@@ -1920,9 +1920,25 @@
mov(edi, Operand::StaticVariable(limit_address));
add(Operand::StaticVariable(level_address), Immediate(1));
+ if (FLAG_log_timer_events) {
+ FrameScope frame(this, StackFrame::MANUAL);
+ PushSafepointRegisters();
+ PrepareCallCFunction(0, eax);
+
CallCFunction(ExternalReference::log_enter_external_function(isolate()), 0);
+ PopSafepointRegisters();
+ }
+
// Call the api function.
call(function_address, RelocInfo::RUNTIME_ENTRY);
+ if (FLAG_log_timer_events) {
+ FrameScope frame(this, StackFrame::MANUAL);
+ PushSafepointRegisters();
+ PrepareCallCFunction(0, eax);
+
CallCFunction(ExternalReference::log_leave_external_function(isolate()), 0);
+ PopSafepointRegisters();
+ }
+
if (!kReturnHandlesDirectly) {
// PrepareCallApiFunction saved pointer to the output slot into
// callee-save register esi.
=======================================
--- /branches/bleeding_edge/src/log.cc Wed Nov 28 03:01:10 2012
+++ /branches/bleeding_edge/src/log.cc Wed Nov 28 07:11:21 2012
@@ -725,6 +725,19 @@
enter_external_ = 0;
}
}
+
+
+void Logger::EnterExternal() {
+ LOGGER->enter_external_ = OS::Ticks();
+}
+
+
+void Logger::LeaveExternal() {
+ if (enter_external_ == 0) return;
+ Logger* logger = LOGGER;
+ logger->TimerEvent("V8.External", enter_external_, OS::Ticks());
+ logger->enter_external_ = 0;
+}
int64_t Logger::enter_external_ = 0;
=======================================
--- /branches/bleeding_edge/src/log.h Wed Nov 28 03:01:10 2012
+++ /branches/bleeding_edge/src/log.h Wed Nov 28 07:11:21 2012
@@ -280,6 +280,9 @@
void TimerEvent(const char* name, int64_t start, int64_t end);
void ExternalSwitch(StateTag old_tag, StateTag new_tag);
+ static void EnterExternal();
+ static void LeaveExternal();
+
class TimerEventScope {
public:
TimerEventScope(Isolate* isolate, const char* name)
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Thu Nov 15
05:31:27 2012
+++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Wed Nov 28
07:11:21 2012
@@ -720,11 +720,28 @@
movq(prev_next_address_reg, Operand(base_reg, kNextOffset));
movq(prev_limit_reg, Operand(base_reg, kLimitOffset));
addl(Operand(base_reg, kLevelOffset), Immediate(1));
+
+ if (FLAG_log_timer_events) {
+ FrameScope frame(this, StackFrame::MANUAL);
+ PushSafepointRegisters();
+ PrepareCallCFunction(0);
+
CallCFunction(ExternalReference::log_enter_external_function(isolate()), 0);
+ PopSafepointRegisters();
+ }
+
// Call the api function!
movq(rax, reinterpret_cast<int64_t>(function_address),
RelocInfo::RUNTIME_ENTRY);
call(rax);
+ if (FLAG_log_timer_events) {
+ FrameScope frame(this, StackFrame::MANUAL);
+ PushSafepointRegisters();
+ PrepareCallCFunction(0);
+
CallCFunction(ExternalReference::log_leave_external_function(isolate()), 0);
+ PopSafepointRegisters();
+ }
+
#if defined(_WIN64) && !defined(__MINGW64__)
// rax keeps a pointer to v8::Handle, unpack it.
movq(rax, Operand(rax, 0));
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev