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

Side by Side Diff: src/api.cc

Issue 2188193002: [api] Remove HistogramTimerScope from high-frequency API-Functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make TimerEventScope inlineable Created 4 years, 4 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/log.h » ('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 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4472 4472
4473 bool v8::Object::IsConstructor() { 4473 bool v8::Object::IsConstructor() {
4474 auto self = Utils::OpenHandle(this); 4474 auto self = Utils::OpenHandle(this);
4475 return self->IsConstructor(); 4475 return self->IsConstructor();
4476 } 4476 }
4477 4477
4478 MaybeLocal<Value> Object::CallAsFunction(Local<Context> context, 4478 MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
4479 Local<Value> recv, int argc, 4479 Local<Value> recv, int argc,
4480 Local<Value> argv[]) { 4480 Local<Value> argv[]) {
4481 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsFunction, Value); 4481 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsFunction, Value);
4482 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
4483 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4482 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4484 TRACE_EVENT0("v8", "V8.Execute"); 4483 TRACE_EVENT0("v8", "V8.Execute");
4485 auto self = Utils::OpenHandle(this); 4484 auto self = Utils::OpenHandle(this);
4486 auto recv_obj = Utils::OpenHandle(*recv); 4485 auto recv_obj = Utils::OpenHandle(*recv);
4487 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4486 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4488 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4487 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4489 Local<Value> result; 4488 Local<Value> result;
4490 has_pending_exception = !ToLocal<Value>( 4489 has_pending_exception = !ToLocal<Value>(
4491 i::Execution::Call(isolate, self, recv_obj, argc, args), &result); 4490 i::Execution::Call(isolate, self, recv_obj, argc, args), &result);
4492 RETURN_ON_FAILED_EXECUTION(Value); 4491 RETURN_ON_FAILED_EXECUTION(Value);
4493 RETURN_ESCAPED(result); 4492 RETURN_ESCAPED(result);
4494 } 4493 }
4495 4494
4496 4495
4497 Local<v8::Value> Object::CallAsFunction(v8::Local<v8::Value> recv, int argc, 4496 Local<v8::Value> Object::CallAsFunction(v8::Local<v8::Value> recv, int argc,
4498 v8::Local<v8::Value> argv[]) { 4497 v8::Local<v8::Value> argv[]) {
4499 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4498 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4500 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv); 4499 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv);
4501 RETURN_TO_LOCAL_UNCHECKED(CallAsFunction(context, recv, argc, argv_cast), 4500 RETURN_TO_LOCAL_UNCHECKED(CallAsFunction(context, recv, argc, argv_cast),
4502 Value); 4501 Value);
4503 } 4502 }
4504 4503
4505 4504
4506 MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc, 4505 MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
4507 Local<Value> argv[]) { 4506 Local<Value> argv[]) {
4508 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsConstructor, 4507 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Object, CallAsConstructor,
4509 Value); 4508 Value);
4510 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
4511 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4509 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4512 TRACE_EVENT0("v8", "V8.Execute"); 4510 TRACE_EVENT0("v8", "V8.Execute");
4513 auto self = Utils::OpenHandle(this); 4511 auto self = Utils::OpenHandle(this);
4514 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4512 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4515 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4513 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4516 Local<Value> result; 4514 Local<Value> result;
4517 has_pending_exception = !ToLocal<Value>( 4515 has_pending_exception = !ToLocal<Value>(
4518 i::Execution::New(isolate, self, self, argc, args), &result); 4516 i::Execution::New(isolate, self, self, argc, args), &result);
4519 RETURN_ON_FAILED_EXECUTION(Value); 4517 RETURN_ON_FAILED_EXECUTION(Value);
4520 RETURN_ESCAPED(result); 4518 RETURN_ESCAPED(result);
(...skipping 30 matching lines...) Expand all
4551 4549
4552 Local<v8::Object> Function::NewInstance() const { 4550 Local<v8::Object> Function::NewInstance() const {
4553 return NewInstance(Isolate::GetCurrent()->GetCurrentContext(), 0, NULL) 4551 return NewInstance(Isolate::GetCurrent()->GetCurrentContext(), 0, NULL)
4554 .FromMaybe(Local<Object>()); 4552 .FromMaybe(Local<Object>());
4555 } 4553 }
4556 4554
4557 4555
4558 MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc, 4556 MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc,
4559 v8::Local<v8::Value> argv[]) const { 4557 v8::Local<v8::Value> argv[]) const {
4560 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, NewInstance, Object); 4558 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, NewInstance, Object);
4561 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
4562 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4559 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4563 TRACE_EVENT0("v8", "V8.Execute"); 4560 TRACE_EVENT0("v8", "V8.Execute");
4564 auto self = Utils::OpenHandle(this); 4561 auto self = Utils::OpenHandle(this);
4565 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4562 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4566 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4563 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4567 Local<Object> result; 4564 Local<Object> result;
4568 has_pending_exception = !ToLocal<Object>( 4565 has_pending_exception = !ToLocal<Object>(
4569 i::Execution::New(isolate, self, self, argc, args), &result); 4566 i::Execution::New(isolate, self, self, argc, args), &result);
4570 RETURN_ON_FAILED_EXECUTION(Object); 4567 RETURN_ON_FAILED_EXECUTION(Object);
4571 RETURN_ESCAPED(result); 4568 RETURN_ESCAPED(result);
4572 } 4569 }
4573 4570
4574 4571
4575 Local<v8::Object> Function::NewInstance(int argc, 4572 Local<v8::Object> Function::NewInstance(int argc,
4576 v8::Local<v8::Value> argv[]) const { 4573 v8::Local<v8::Value> argv[]) const {
4577 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4574 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4578 RETURN_TO_LOCAL_UNCHECKED(NewInstance(context, argc, argv), Object); 4575 RETURN_TO_LOCAL_UNCHECKED(NewInstance(context, argc, argv), Object);
4579 } 4576 }
4580 4577
4581 4578
4582 MaybeLocal<v8::Value> Function::Call(Local<Context> context, 4579 MaybeLocal<v8::Value> Function::Call(Local<Context> context,
4583 v8::Local<v8::Value> recv, int argc, 4580 v8::Local<v8::Value> recv, int argc,
4584 v8::Local<v8::Value> argv[]) { 4581 v8::Local<v8::Value> argv[]) {
4585 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, Call, Value); 4582 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, Function, Call, Value);
4586 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
4587 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4583 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4588 TRACE_EVENT0("v8", "V8.Execute"); 4584 TRACE_EVENT0("v8", "V8.Execute");
4589 auto self = Utils::OpenHandle(this); 4585 auto self = Utils::OpenHandle(this);
4590 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 4586 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
4591 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4587 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4592 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4588 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4593 Local<Value> result; 4589 Local<Value> result;
4594 has_pending_exception = !ToLocal<Value>( 4590 has_pending_exception = !ToLocal<Value>(
4595 i::Execution::Call(isolate, self, recv_obj, argc, args), &result); 4591 i::Execution::Call(isolate, self, recv_obj, argc, args), &result);
4596 RETURN_ON_FAILED_EXECUTION(Value); 4592 RETURN_ON_FAILED_EXECUTION(Value);
(...skipping 4445 matching lines...) Expand 10 before | Expand all | Expand 10 after
9042 Address callback_address = 9038 Address callback_address =
9043 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9039 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9044 VMState<EXTERNAL> state(isolate); 9040 VMState<EXTERNAL> state(isolate);
9045 ExternalCallbackScope call_scope(isolate, callback_address); 9041 ExternalCallbackScope call_scope(isolate, callback_address);
9046 callback(info); 9042 callback(info);
9047 } 9043 }
9048 9044
9049 9045
9050 } // namespace internal 9046 } // namespace internal
9051 } // namespace v8 9047 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698