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

Side by Side Diff: src/api.cc

Issue 1707563002: Split the TRACE_EVENTs from the LOG/HistogramTimers/TimerEvents functionality. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "src/property.h" 51 #include "src/property.h"
52 #include "src/property-descriptor.h" 52 #include "src/property-descriptor.h"
53 #include "src/property-details.h" 53 #include "src/property-details.h"
54 #include "src/prototype.h" 54 #include "src/prototype.h"
55 #include "src/runtime/runtime.h" 55 #include "src/runtime/runtime.h"
56 #include "src/runtime-profiler.h" 56 #include "src/runtime-profiler.h"
57 #include "src/simulator.h" 57 #include "src/simulator.h"
58 #include "src/snapshot/natives.h" 58 #include "src/snapshot/natives.h"
59 #include "src/snapshot/snapshot.h" 59 #include "src/snapshot/snapshot.h"
60 #include "src/startup-data-util.h" 60 #include "src/startup-data-util.h"
61 #include "src/tracing/trace-event.h"
61 #include "src/unicode-inl.h" 62 #include "src/unicode-inl.h"
62 #include "src/v8.h" 63 #include "src/v8.h"
63 #include "src/v8threads.h" 64 #include "src/v8threads.h"
64 #include "src/version.h" 65 #include "src/version.h"
65 #include "src/vm-state-inl.h" 66 #include "src/vm-state-inl.h"
66 67
67 68
68 namespace v8 { 69 namespace v8 {
69 70
70 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) 71 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 } else { 1703 } else {
1703 return Local<String>(); 1704 return Local<String>();
1704 } 1705 }
1705 } 1706 }
1706 1707
1707 1708
1708 MaybeLocal<Value> Script::Run(Local<Context> context) { 1709 MaybeLocal<Value> Script::Run(Local<Context> context) {
1709 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Script::Run()", Value) 1710 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Script::Run()", Value)
1710 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); 1711 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy());
1711 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 1712 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
1713 TRACE_EVENT0("v8", "V8.Execute");
1712 auto fun = i::Handle<i::JSFunction>::cast(Utils::OpenHandle(this)); 1714 auto fun = i::Handle<i::JSFunction>::cast(Utils::OpenHandle(this));
1713 i::Handle<i::Object> receiver(isolate->global_proxy(), isolate); 1715 i::Handle<i::Object> receiver(isolate->global_proxy(), isolate);
1714 Local<Value> result; 1716 Local<Value> result;
1715 has_pending_exception = 1717 has_pending_exception =
1716 !ToLocal<Value>(i::Execution::Call(isolate, fun, receiver, 0, NULL), 1718 !ToLocal<Value>(i::Execution::Call(isolate, fun, receiver, 0, NULL),
1717 &result); 1719 &result);
1718 RETURN_ON_FAILED_EXECUTION(Value); 1720 RETURN_ON_FAILED_EXECUTION(Value);
1719 RETURN_ESCAPED(result); 1721 RETURN_ESCAPED(result);
1720 } 1722 }
1721 1723
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 DCHECK(source->cached_data); 1757 DCHECK(source->cached_data);
1756 // ScriptData takes care of pointer-aligning the data. 1758 // ScriptData takes care of pointer-aligning the data.
1757 script_data = new i::ScriptData(source->cached_data->data, 1759 script_data = new i::ScriptData(source->cached_data->data,
1758 source->cached_data->length); 1760 source->cached_data->length);
1759 } 1761 }
1760 1762
1761 i::Handle<i::String> str = Utils::OpenHandle(*(source->source_string)); 1763 i::Handle<i::String> str = Utils::OpenHandle(*(source->source_string));
1762 i::Handle<i::SharedFunctionInfo> result; 1764 i::Handle<i::SharedFunctionInfo> result;
1763 { 1765 {
1764 i::HistogramTimerScope total(isolate->counters()->compile_script(), true); 1766 i::HistogramTimerScope total(isolate->counters()->compile_script(), true);
1767 TRACE_EVENT0("v8", "V8.CompileScript");
1765 i::Handle<i::Object> name_obj; 1768 i::Handle<i::Object> name_obj;
1766 i::Handle<i::Object> source_map_url; 1769 i::Handle<i::Object> source_map_url;
1767 int line_offset = 0; 1770 int line_offset = 0;
1768 int column_offset = 0; 1771 int column_offset = 0;
1769 if (!source->resource_name.IsEmpty()) { 1772 if (!source->resource_name.IsEmpty()) {
1770 name_obj = Utils::OpenHandle(*(source->resource_name)); 1773 name_obj = Utils::OpenHandle(*(source->resource_name));
1771 } 1774 }
1772 if (!source->resource_line_offset.IsEmpty()) { 1775 if (!source->resource_line_offset.IsEmpty()) {
1773 line_offset = static_cast<int>(source->resource_line_offset->Value()); 1776 line_offset = static_cast<int>(source->resource_line_offset->Value());
1774 } 1777 }
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
4274 return self->IsCallable(); 4277 return self->IsCallable();
4275 } 4278 }
4276 4279
4277 4280
4278 MaybeLocal<Value> Object::CallAsFunction(Local<Context> context, 4281 MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
4279 Local<Value> recv, int argc, 4282 Local<Value> recv, int argc,
4280 Local<Value> argv[]) { 4283 Local<Value> argv[]) {
4281 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Object::CallAsFunction()", 4284 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Object::CallAsFunction()",
4282 Value); 4285 Value);
4283 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4286 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4287 TRACE_EVENT0("v8", "V8.Execute");
4284 auto self = Utils::OpenHandle(this); 4288 auto self = Utils::OpenHandle(this);
4285 auto recv_obj = Utils::OpenHandle(*recv); 4289 auto recv_obj = Utils::OpenHandle(*recv);
4286 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4290 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4287 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4291 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4288 Local<Value> result; 4292 Local<Value> result;
4289 has_pending_exception = !ToLocal<Value>( 4293 has_pending_exception = !ToLocal<Value>(
4290 i::Execution::Call(isolate, self, recv_obj, argc, args), &result); 4294 i::Execution::Call(isolate, self, recv_obj, argc, args), &result);
4291 RETURN_ON_FAILED_EXECUTION(Value); 4295 RETURN_ON_FAILED_EXECUTION(Value);
4292 RETURN_ESCAPED(result); 4296 RETURN_ESCAPED(result);
4293 } 4297 }
4294 4298
4295 4299
4296 Local<v8::Value> Object::CallAsFunction(v8::Local<v8::Value> recv, int argc, 4300 Local<v8::Value> Object::CallAsFunction(v8::Local<v8::Value> recv, int argc,
4297 v8::Local<v8::Value> argv[]) { 4301 v8::Local<v8::Value> argv[]) {
4298 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4302 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4299 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv); 4303 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv);
4300 RETURN_TO_LOCAL_UNCHECKED(CallAsFunction(context, recv, argc, argv_cast), 4304 RETURN_TO_LOCAL_UNCHECKED(CallAsFunction(context, recv, argc, argv_cast),
4301 Value); 4305 Value);
4302 } 4306 }
4303 4307
4304 4308
4305 MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc, 4309 MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
4306 Local<Value> argv[]) { 4310 Local<Value> argv[]) {
4307 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, 4311 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context,
4308 "v8::Object::CallAsConstructor()", Value); 4312 "v8::Object::CallAsConstructor()", Value);
4309 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4313 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4314 TRACE_EVENT0("v8", "V8.Execute");
4310 auto self = Utils::OpenHandle(this); 4315 auto self = Utils::OpenHandle(this);
4311 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4316 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4312 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4317 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4313 Local<Value> result; 4318 Local<Value> result;
4314 has_pending_exception = !ToLocal<Value>( 4319 has_pending_exception = !ToLocal<Value>(
4315 i::Execution::New(isolate, self, self, argc, args), &result); 4320 i::Execution::New(isolate, self, self, argc, args), &result);
4316 RETURN_ON_FAILED_EXECUTION(Value); 4321 RETURN_ON_FAILED_EXECUTION(Value);
4317 RETURN_ESCAPED(result); 4322 RETURN_ESCAPED(result);
4318 } 4323 }
4319 4324
(...skipping 29 matching lines...) Expand all
4349 return NewInstance(Isolate::GetCurrent()->GetCurrentContext(), 0, NULL) 4354 return NewInstance(Isolate::GetCurrent()->GetCurrentContext(), 0, NULL)
4350 .FromMaybe(Local<Object>()); 4355 .FromMaybe(Local<Object>());
4351 } 4356 }
4352 4357
4353 4358
4354 MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc, 4359 MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc,
4355 v8::Local<v8::Value> argv[]) const { 4360 v8::Local<v8::Value> argv[]) const {
4356 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::NewInstance()", 4361 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::NewInstance()",
4357 Object); 4362 Object);
4358 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4363 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4364 TRACE_EVENT0("v8", "V8.Execute");
4359 auto self = Utils::OpenHandle(this); 4365 auto self = Utils::OpenHandle(this);
4360 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4366 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4361 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4367 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4362 Local<Object> result; 4368 Local<Object> result;
4363 has_pending_exception = !ToLocal<Object>( 4369 has_pending_exception = !ToLocal<Object>(
4364 i::Execution::New(isolate, self, self, argc, args), &result); 4370 i::Execution::New(isolate, self, self, argc, args), &result);
4365 RETURN_ON_FAILED_EXECUTION(Object); 4371 RETURN_ON_FAILED_EXECUTION(Object);
4366 RETURN_ESCAPED(result); 4372 RETURN_ESCAPED(result);
4367 } 4373 }
4368 4374
4369 4375
4370 Local<v8::Object> Function::NewInstance(int argc, 4376 Local<v8::Object> Function::NewInstance(int argc,
4371 v8::Local<v8::Value> argv[]) const { 4377 v8::Local<v8::Value> argv[]) const {
4372 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4378 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4373 RETURN_TO_LOCAL_UNCHECKED(NewInstance(context, argc, argv), Object); 4379 RETURN_TO_LOCAL_UNCHECKED(NewInstance(context, argc, argv), Object);
4374 } 4380 }
4375 4381
4376 4382
4377 MaybeLocal<v8::Value> Function::Call(Local<Context> context, 4383 MaybeLocal<v8::Value> Function::Call(Local<Context> context,
4378 v8::Local<v8::Value> recv, int argc, 4384 v8::Local<v8::Value> recv, int argc,
4379 v8::Local<v8::Value> argv[]) { 4385 v8::Local<v8::Value> argv[]) {
4380 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::Call()", Value); 4386 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::Call()", Value);
4381 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4387 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4388 TRACE_EVENT0("v8", "V8.Execute");
4382 auto self = Utils::OpenHandle(this); 4389 auto self = Utils::OpenHandle(this);
4383 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 4390 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
4384 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4391 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4385 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4392 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4386 Local<Value> result; 4393 Local<Value> result;
4387 has_pending_exception = !ToLocal<Value>( 4394 has_pending_exception = !ToLocal<Value>(
4388 i::Execution::Call(isolate, self, recv_obj, argc, args), &result); 4395 i::Execution::Call(isolate, self, recv_obj, argc, args), &result);
4389 RETURN_ON_FAILED_EXECUTION(Value); 4396 RETURN_ON_FAILED_EXECUTION(Value);
4390 RETURN_ESCAPED(result); 4397 RETURN_ESCAPED(result);
4391 } 4398 }
(...skipping 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after
7469 if (!i::FLAG_use_idle_notification) return true; 7476 if (!i::FLAG_use_idle_notification) return true;
7470 return isolate->heap()->IdleNotification(deadline_in_seconds); 7477 return isolate->heap()->IdleNotification(deadline_in_seconds);
7471 } 7478 }
7472 7479
7473 7480
7474 void Isolate::LowMemoryNotification() { 7481 void Isolate::LowMemoryNotification() {
7475 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7482 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7476 { 7483 {
7477 i::HistogramTimerScope idle_notification_scope( 7484 i::HistogramTimerScope idle_notification_scope(
7478 isolate->counters()->gc_low_memory_notification()); 7485 isolate->counters()->gc_low_memory_notification());
7486 TRACE_EVENT0("v8", "V8.GCLowMemoryNotification");
7479 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); 7487 isolate->heap()->CollectAllAvailableGarbage("low memory notification");
7480 } 7488 }
7481 } 7489 }
7482 7490
7483 7491
7484 int Isolate::ContextDisposedNotification(bool dependant_context) { 7492 int Isolate::ContextDisposedNotification(bool dependant_context) {
7485 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7493 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7486 return isolate->heap()->NotifyContextDisposed(dependant_context); 7494 return isolate->heap()->NotifyContextDisposed(dependant_context);
7487 } 7495 }
7488 7496
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
8554 Address callback_address = 8562 Address callback_address =
8555 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8563 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8556 VMState<EXTERNAL> state(isolate); 8564 VMState<EXTERNAL> state(isolate);
8557 ExternalCallbackScope call_scope(isolate, callback_address); 8565 ExternalCallbackScope call_scope(isolate, callback_address);
8558 callback(info); 8566 callback(info);
8559 } 8567 }
8560 8568
8561 8569
8562 } // namespace internal 8570 } // namespace internal
8563 } // namespace v8 8571 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698