Also time other API functions calling into javascript.
And prevent crash when starting chromium without --single-process. BUG= Review URL: https://chromiumcodereview.appspot.com/11411144 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
3c251ec924
commit
94476cb89a
10
src/api.cc
10
src/api.cc
@ -1682,7 +1682,7 @@ Local<Value> Script::Run() {
|
||||
LOG_API(isolate, "Script::Run");
|
||||
ENTER_V8(isolate);
|
||||
i::Logger::TimerEventScope timer_scope(
|
||||
isolate->logger(), i::Logger::TimerEventScope::v8_execute);
|
||||
isolate, i::Logger::TimerEventScope::v8_execute);
|
||||
i::Object* raw_result = NULL;
|
||||
{
|
||||
i::HandleScope scope(isolate);
|
||||
@ -3651,6 +3651,8 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv,
|
||||
return Local<v8::Value>());
|
||||
LOG_API(isolate, "Object::CallAsFunction");
|
||||
ENTER_V8(isolate);
|
||||
i::Logger::TimerEventScope timer_scope(
|
||||
isolate, i::Logger::TimerEventScope::v8_execute);
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
|
||||
i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
|
||||
@ -3682,6 +3684,8 @@ Local<v8::Value> Object::CallAsConstructor(int argc,
|
||||
return Local<v8::Object>());
|
||||
LOG_API(isolate, "Object::CallAsConstructor");
|
||||
ENTER_V8(isolate);
|
||||
i::Logger::TimerEventScope timer_scope(
|
||||
isolate, i::Logger::TimerEventScope::v8_execute);
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
|
||||
STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
|
||||
@ -3724,6 +3728,8 @@ Local<v8::Object> Function::NewInstance(int argc,
|
||||
return Local<v8::Object>());
|
||||
LOG_API(isolate, "Function::NewInstance");
|
||||
ENTER_V8(isolate);
|
||||
i::Logger::TimerEventScope timer_scope(
|
||||
isolate, i::Logger::TimerEventScope::v8_execute);
|
||||
HandleScope scope;
|
||||
i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
|
||||
STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
|
||||
@ -3742,6 +3748,8 @@ Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
|
||||
ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>());
|
||||
LOG_API(isolate, "Function::Call");
|
||||
ENTER_V8(isolate);
|
||||
i::Logger::TimerEventScope timer_scope(
|
||||
isolate, i::Logger::TimerEventScope::v8_execute);
|
||||
i::Object* raw_result = NULL;
|
||||
{
|
||||
i::HandleScope scope(isolate);
|
||||
|
@ -396,10 +396,9 @@ static bool GenerateCode(CompilationInfo* info) {
|
||||
bool is_optimizing = V8::UseCrankshaft() &&
|
||||
!info->IsCompilingForDebugging() &&
|
||||
info->IsOptimizing();
|
||||
Logger* logger = info->isolate()->logger();
|
||||
if (is_optimizing) {
|
||||
Logger::TimerEventScope timer(
|
||||
logger, Logger::TimerEventScope::v8_recompile_synchronous);
|
||||
info->isolate(), Logger::TimerEventScope::v8_recompile_synchronous);
|
||||
return MakeCrankshaftCode(info);
|
||||
} else {
|
||||
if (info->IsOptimizing()) {
|
||||
@ -408,7 +407,7 @@ static bool GenerateCode(CompilationInfo* info) {
|
||||
info->DisableOptimization();
|
||||
}
|
||||
Logger::TimerEventScope timer(
|
||||
logger, Logger::TimerEventScope::v8_compile_full_code);
|
||||
info->isolate(), Logger::TimerEventScope::v8_compile_full_code);
|
||||
return FullCodeGenerator::MakeCode(info);
|
||||
}
|
||||
}
|
||||
@ -860,7 +859,7 @@ void Compiler::RecompileParallel(Handle<JSFunction> closure) {
|
||||
// Here we prepare compile data for the parallel recompilation thread, but
|
||||
// this still happens synchronously and interrupts execution.
|
||||
Logger::TimerEventScope timer(
|
||||
isolate->logger(), Logger::TimerEventScope::v8_recompile_synchronous);
|
||||
isolate, Logger::TimerEventScope::v8_recompile_synchronous);
|
||||
|
||||
if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
|
||||
if (FLAG_trace_parallel_recompilation) {
|
||||
@ -921,7 +920,7 @@ void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
|
||||
Isolate* isolate = info->isolate();
|
||||
VMState state(isolate, PARALLEL_COMPILER);
|
||||
Logger::TimerEventScope timer(
|
||||
isolate->logger(), Logger::TimerEventScope::v8_recompile_synchronous);
|
||||
isolate, Logger::TimerEventScope::v8_recompile_synchronous);
|
||||
// If crankshaft succeeded, install the optimized code else install
|
||||
// the unoptimized code.
|
||||
OptimizingCompiler::Status status = optimizing_compiler->last_status();
|
||||
|
@ -92,9 +92,8 @@ void HistogramTimer::Stop() {
|
||||
histogram_.AddSample(milliseconds);
|
||||
}
|
||||
if (FLAG_log_timer_events) {
|
||||
stop_time_ = OS::Ticks();
|
||||
Isolate::Current()->logger()->TimerEvent(
|
||||
histogram_.name_, start_time_, stop_time_);
|
||||
LOG(Isolate::Current(),
|
||||
TimerEvent(histogram_.name_, start_time_, OS::Ticks()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ void Log::Initialize() {
|
||||
FLAG_log_suspect = true;
|
||||
FLAG_log_handles = true;
|
||||
FLAG_log_regexp = true;
|
||||
FLAG_log_timer_events = true;
|
||||
}
|
||||
|
||||
// --prof implies --log-code.
|
||||
|
@ -706,6 +706,7 @@ void Logger::SharedLibraryEvent(const wchar_t* library_path,
|
||||
|
||||
|
||||
void Logger::TimerEvent(const char* name, int64_t start, int64_t end) {
|
||||
if (!log_->IsEnabled()) return;
|
||||
ASSERT(FLAG_log_timer_events);
|
||||
LogMessageBuilder msg(this);
|
||||
int since_epoch = static_cast<int>(start - epoch_);
|
||||
@ -715,6 +716,11 @@ void Logger::TimerEvent(const char* name, int64_t start, int64_t end) {
|
||||
}
|
||||
|
||||
|
||||
void Logger::TimerEventScope::LogTimerEvent() {
|
||||
LOG(isolate_, TimerEvent(name_, start_, OS::Ticks()));
|
||||
}
|
||||
|
||||
|
||||
const char* Logger::TimerEventScope::v8_recompile_synchronous =
|
||||
"V8.RecompileSynchronous";
|
||||
const char* Logger::TimerEventScope::v8_recompile_parallel =
|
||||
|
13
src/log.h
13
src/log.h
@ -76,6 +76,7 @@ class Profiler;
|
||||
class Semaphore;
|
||||
class SlidingStateWindow;
|
||||
class Ticker;
|
||||
class Isolate;
|
||||
|
||||
#undef LOG
|
||||
#define LOG(isolate, Call) \
|
||||
@ -278,24 +279,24 @@ class Logger {
|
||||
|
||||
class TimerEventScope {
|
||||
public:
|
||||
TimerEventScope(Logger* logger, const char* name)
|
||||
: logger_(logger), name_(name), start_(0) {
|
||||
TimerEventScope(Isolate* isolate, const char* name)
|
||||
: isolate_(isolate), name_(name), start_(0) {
|
||||
if (FLAG_log_timer_events) start_ = OS::Ticks();
|
||||
}
|
||||
|
||||
~TimerEventScope() {
|
||||
if (FLAG_log_timer_events) {
|
||||
logger_->TimerEvent(name_, start_, OS::Ticks());
|
||||
}
|
||||
if (FLAG_log_timer_events) LogTimerEvent();
|
||||
}
|
||||
|
||||
void LogTimerEvent();
|
||||
|
||||
static const char* v8_recompile_synchronous;
|
||||
static const char* v8_recompile_parallel;
|
||||
static const char* v8_compile_full_code;
|
||||
static const char* v8_execute;
|
||||
|
||||
private:
|
||||
Logger* logger_;
|
||||
Isolate* isolate_;
|
||||
const char* name_;
|
||||
int64_t start_;
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ void OptimizingCompilerThread::Run() {
|
||||
while (true) {
|
||||
input_queue_semaphore_->Wait();
|
||||
Logger::TimerEventScope timer(
|
||||
isolate_->logger(), Logger::TimerEventScope::v8_recompile_parallel);
|
||||
isolate_, Logger::TimerEventScope::v8_recompile_parallel);
|
||||
if (Acquire_Load(&stop_thread_)) {
|
||||
stop_semaphore_->Signal();
|
||||
if (FLAG_trace_parallel_recompilation) {
|
||||
|
Loading…
Reference in New Issue
Block a user