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

Side by Side Diff: src/api.cc

Issue 11411144: Also time other API functions calling into javascript. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 | Annotate | Revision Log
« 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 return Compile(source, &origin, 0, script_data); 1675 return Compile(source, &origin, 0, script_data);
1676 } 1676 }
1677 1677
1678 1678
1679 Local<Value> Script::Run() { 1679 Local<Value> Script::Run() {
1680 i::Isolate* isolate = i::Isolate::Current(); 1680 i::Isolate* isolate = i::Isolate::Current();
1681 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); 1681 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
1682 LOG_API(isolate, "Script::Run"); 1682 LOG_API(isolate, "Script::Run");
1683 ENTER_V8(isolate); 1683 ENTER_V8(isolate);
1684 i::Logger::TimerEventScope timer_scope( 1684 i::Logger::TimerEventScope timer_scope(
1685 isolate->logger(), i::Logger::TimerEventScope::v8_execute); 1685 isolate, i::Logger::TimerEventScope::v8_execute);
1686 i::Object* raw_result = NULL; 1686 i::Object* raw_result = NULL;
1687 { 1687 {
1688 i::HandleScope scope(isolate); 1688 i::HandleScope scope(isolate);
1689 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1689 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1690 i::Handle<i::JSFunction> fun; 1690 i::Handle<i::JSFunction> fun;
1691 if (obj->IsSharedFunctionInfo()) { 1691 if (obj->IsSharedFunctionInfo()) {
1692 i::Handle<i::SharedFunctionInfo> 1692 i::Handle<i::SharedFunctionInfo>
1693 function_info(i::SharedFunctionInfo::cast(*obj), isolate); 1693 function_info(i::SharedFunctionInfo::cast(*obj), isolate);
1694 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo( 1694 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo(
1695 function_info, isolate->global_context()); 1695 function_info, isolate->global_context());
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 3644
3645 3645
3646 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, 3646 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv,
3647 int argc, 3647 int argc,
3648 v8::Handle<v8::Value> argv[]) { 3648 v8::Handle<v8::Value> argv[]) {
3649 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3649 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3650 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()", 3650 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()",
3651 return Local<v8::Value>()); 3651 return Local<v8::Value>());
3652 LOG_API(isolate, "Object::CallAsFunction"); 3652 LOG_API(isolate, "Object::CallAsFunction");
3653 ENTER_V8(isolate); 3653 ENTER_V8(isolate);
3654 i::Logger::TimerEventScope timer_scope(
3655 isolate, i::Logger::TimerEventScope::v8_execute);
3654 i::HandleScope scope(isolate); 3656 i::HandleScope scope(isolate);
3655 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 3657 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3656 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 3658 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
3657 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3659 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3658 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 3660 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
3659 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); 3661 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>();
3660 if (obj->IsJSFunction()) { 3662 if (obj->IsJSFunction()) {
3661 fun = i::Handle<i::JSFunction>::cast(obj); 3663 fun = i::Handle<i::JSFunction>::cast(obj);
3662 } else { 3664 } else {
3663 EXCEPTION_PREAMBLE(isolate); 3665 EXCEPTION_PREAMBLE(isolate);
(...skipping 11 matching lines...) Expand all
3675 } 3677 }
3676 3678
3677 3679
3678 Local<v8::Value> Object::CallAsConstructor(int argc, 3680 Local<v8::Value> Object::CallAsConstructor(int argc,
3679 v8::Handle<v8::Value> argv[]) { 3681 v8::Handle<v8::Value> argv[]) {
3680 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3682 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3681 ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()", 3683 ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()",
3682 return Local<v8::Object>()); 3684 return Local<v8::Object>());
3683 LOG_API(isolate, "Object::CallAsConstructor"); 3685 LOG_API(isolate, "Object::CallAsConstructor");
3684 ENTER_V8(isolate); 3686 ENTER_V8(isolate);
3687 i::Logger::TimerEventScope timer_scope(
3688 isolate, i::Logger::TimerEventScope::v8_execute);
3685 i::HandleScope scope(isolate); 3689 i::HandleScope scope(isolate);
3686 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 3690 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3687 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3691 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3688 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 3692 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
3689 if (obj->IsJSFunction()) { 3693 if (obj->IsJSFunction()) {
3690 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj); 3694 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj);
3691 EXCEPTION_PREAMBLE(isolate); 3695 EXCEPTION_PREAMBLE(isolate);
3692 i::Handle<i::Object> returned = 3696 i::Handle<i::Object> returned =
3693 i::Execution::New(fun, argc, args, &has_pending_exception); 3697 i::Execution::New(fun, argc, args, &has_pending_exception);
3694 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); 3698 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
(...skipping 22 matching lines...) Expand all
3717 } 3721 }
3718 3722
3719 3723
3720 Local<v8::Object> Function::NewInstance(int argc, 3724 Local<v8::Object> Function::NewInstance(int argc,
3721 v8::Handle<v8::Value> argv[]) const { 3725 v8::Handle<v8::Value> argv[]) const {
3722 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3726 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3723 ON_BAILOUT(isolate, "v8::Function::NewInstance()", 3727 ON_BAILOUT(isolate, "v8::Function::NewInstance()",
3724 return Local<v8::Object>()); 3728 return Local<v8::Object>());
3725 LOG_API(isolate, "Function::NewInstance"); 3729 LOG_API(isolate, "Function::NewInstance");
3726 ENTER_V8(isolate); 3730 ENTER_V8(isolate);
3731 i::Logger::TimerEventScope timer_scope(
3732 isolate, i::Logger::TimerEventScope::v8_execute);
3727 HandleScope scope; 3733 HandleScope scope;
3728 i::Handle<i::JSFunction> function = Utils::OpenHandle(this); 3734 i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
3729 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3735 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3730 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 3736 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
3731 EXCEPTION_PREAMBLE(isolate); 3737 EXCEPTION_PREAMBLE(isolate);
3732 i::Handle<i::Object> returned = 3738 i::Handle<i::Object> returned =
3733 i::Execution::New(function, argc, args, &has_pending_exception); 3739 i::Execution::New(function, argc, args, &has_pending_exception);
3734 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); 3740 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
3735 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); 3741 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
3736 } 3742 }
3737 3743
3738 3744
3739 Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc, 3745 Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
3740 v8::Handle<v8::Value> argv[]) { 3746 v8::Handle<v8::Value> argv[]) {
3741 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3747 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3742 ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>()); 3748 ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>());
3743 LOG_API(isolate, "Function::Call"); 3749 LOG_API(isolate, "Function::Call");
3744 ENTER_V8(isolate); 3750 ENTER_V8(isolate);
3751 i::Logger::TimerEventScope timer_scope(
3752 isolate, i::Logger::TimerEventScope::v8_execute);
3745 i::Object* raw_result = NULL; 3753 i::Object* raw_result = NULL;
3746 { 3754 {
3747 i::HandleScope scope(isolate); 3755 i::HandleScope scope(isolate);
3748 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this); 3756 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
3749 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 3757 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
3750 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3758 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3751 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 3759 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
3752 EXCEPTION_PREAMBLE(isolate); 3760 EXCEPTION_PREAMBLE(isolate);
3753 i::Handle<i::Object> returned = 3761 i::Handle<i::Object> returned =
3754 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); 3762 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
(...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after
6665 6673
6666 v->VisitPointers(blocks_.first(), first_block_limit_); 6674 v->VisitPointers(blocks_.first(), first_block_limit_);
6667 6675
6668 for (int i = 1; i < blocks_.length(); i++) { 6676 for (int i = 1; i < blocks_.length(); i++) {
6669 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6677 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6670 } 6678 }
6671 } 6679 }
6672 6680
6673 6681
6674 } } // namespace v8::internal 6682 } } // namespace v8::internal
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