Also time external callbacks from generated code.
R=jkummerow@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/11411224 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13078 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
18d987e505
commit
432be2c8fd
@ -2222,12 +2222,28 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function,
|
||||
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;
|
||||
|
@ -1056,6 +1056,20 @@ ExternalReference ExternalReference::compute_output_frames_function(
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
return ExternalReference(isolate->keyed_lookup_cache()->keys_address());
|
||||
}
|
||||
|
@ -661,6 +661,10 @@ class ExternalReference BASE_EMBEDDED {
|
||||
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);
|
||||
|
@ -1920,9 +1920,25 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
||||
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.
|
||||
|
13
src/log.cc
13
src/log.cc
@ -727,6 +727,19 @@ void Logger::ExternalSwitch(StateTag old_tag, StateTag new_tag) {
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
@ -280,6 +280,9 @@ class Logger {
|
||||
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)
|
||||
|
@ -720,11 +720,28 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user