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

Side by Side Diff: test/cctest/test-cpu-profiler.cc

Issue 119753008: Revert r18451 "Revert r18449 "Reland r18383: More API cleanup." and r18450 "Unbreak build."" since … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-debug.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 TEST(CollectCpuProfile) { 543 TEST(CollectCpuProfile) {
544 LocalContext env; 544 LocalContext env;
545 v8::HandleScope scope(env->GetIsolate()); 545 v8::HandleScope scope(env->GetIsolate());
546 546
547 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), 547 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
548 cpu_profiler_test_source))->Run(); 548 cpu_profiler_test_source))->Run();
549 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 549 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
550 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 550 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
551 551
552 int32_t profiling_interval_ms = 200; 552 int32_t profiling_interval_ms = 200;
553 v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms) }; 553 v8::Handle<v8::Value> args[] = {
554 v8::Integer::New(env->GetIsolate(), profiling_interval_ms)
555 };
554 const v8::CpuProfile* profile = 556 const v8::CpuProfile* profile =
555 RunProfiler(env, function, args, ARRAY_SIZE(args), 200); 557 RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
556 function->Call(env->Global(), ARRAY_SIZE(args), args); 558 function->Call(env->Global(), ARRAY_SIZE(args), args);
557 559
558 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 560 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
559 561
560 ScopedVector<v8::Handle<v8::String> > names(3); 562 ScopedVector<v8::Handle<v8::String> > names(3);
561 names[0] = v8::String::NewFromUtf8( 563 names[0] = v8::String::NewFromUtf8(
562 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 564 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
563 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 565 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 v8::Script::Compile(v8::String::NewFromUtf8( 617 v8::Script::Compile(v8::String::NewFromUtf8(
616 env->GetIsolate(), cpu_profiler_test_source2))->Run(); 618 env->GetIsolate(), cpu_profiler_test_source2))->Run();
617 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 619 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
618 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 620 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
619 621
620 int32_t repeat_count = 100; 622 int32_t repeat_count = 100;
621 #if defined(USE_SIMULATOR) 623 #if defined(USE_SIMULATOR)
622 // Simulators are much slower. 624 // Simulators are much slower.
623 repeat_count = 1; 625 repeat_count = 1;
624 #endif 626 #endif
625 v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; 627 v8::Handle<v8::Value> args[] = {
628 v8::Integer::New(env->GetIsolate(), repeat_count)
629 };
626 const v8::CpuProfile* profile = 630 const v8::CpuProfile* profile =
627 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); 631 RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
628 632
629 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 633 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
630 634
631 ScopedVector<v8::Handle<v8::String> > names(3); 635 ScopedVector<v8::Handle<v8::String> > names(3);
632 names[0] = v8::String::NewFromUtf8( 636 names[0] = v8::String::NewFromUtf8(
633 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 637 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
634 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 638 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
635 ProfileGenerator::kProgramEntryName); 639 ProfileGenerator::kProgramEntryName);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 env->Global()->Set(v8::String::NewFromUtf8(isolate, "instance"), 739 env->Global()->Set(v8::String::NewFromUtf8(isolate, "instance"),
736 instance); 740 instance);
737 741
738 v8::Script::Compile( 742 v8::Script::Compile(
739 v8::String::NewFromUtf8(isolate, native_accessor_test_source)) 743 v8::String::NewFromUtf8(isolate, native_accessor_test_source))
740 ->Run(); 744 ->Run();
741 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 745 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
742 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start"))); 746 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
743 747
744 int32_t repeat_count = 1; 748 int32_t repeat_count = 1;
745 v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; 749 v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
746 const v8::CpuProfile* profile = 750 const v8::CpuProfile* profile =
747 RunProfiler(env, function, args, ARRAY_SIZE(args), 180); 751 RunProfiler(env, function, args, ARRAY_SIZE(args), 180);
748 752
749 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 753 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
750 const v8::CpuProfileNode* startNode = 754 const v8::CpuProfileNode* startNode =
751 GetChild(isolate, root, "start"); 755 GetChild(isolate, root, "start");
752 GetChild(isolate, startNode, "get foo"); 756 GetChild(isolate, startNode, "get foo");
753 GetChild(isolate, startNode, "set foo"); 757 GetChild(isolate, startNode, "set foo");
754 758
755 const_cast<v8::CpuProfile*>(profile)->Delete(); 759 const_cast<v8::CpuProfile*>(profile)->Delete();
(...skipping 28 matching lines...) Expand all
784 v8::String::NewFromUtf8(isolate, native_accessor_test_source)) 788 v8::String::NewFromUtf8(isolate, native_accessor_test_source))
785 ->Run(); 789 ->Run();
786 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 790 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
787 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start"))); 791 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
788 792
789 { 793 {
790 // Make sure accessors ICs are in monomorphic state before starting 794 // Make sure accessors ICs are in monomorphic state before starting
791 // profiling. 795 // profiling.
792 accessors.set_warming_up(true); 796 accessors.set_warming_up(true);
793 int32_t warm_up_iterations = 3; 797 int32_t warm_up_iterations = 3;
794 v8::Handle<v8::Value> args[] = { v8::Integer::New(warm_up_iterations) }; 798 v8::Handle<v8::Value> args[] = {
799 v8::Integer::New(isolate, warm_up_iterations)
800 };
795 function->Call(env->Global(), ARRAY_SIZE(args), args); 801 function->Call(env->Global(), ARRAY_SIZE(args), args);
796 accessors.set_warming_up(false); 802 accessors.set_warming_up(false);
797 } 803 }
798 804
799 int32_t repeat_count = 100; 805 int32_t repeat_count = 100;
800 v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; 806 v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
801 const v8::CpuProfile* profile = 807 const v8::CpuProfile* profile =
802 RunProfiler(env, function, args, ARRAY_SIZE(args), 200); 808 RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
803 809
804 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 810 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
805 const v8::CpuProfileNode* startNode = 811 const v8::CpuProfileNode* startNode =
806 GetChild(isolate, root, "start"); 812 GetChild(isolate, root, "start");
807 GetChild(isolate, startNode, "get foo"); 813 GetChild(isolate, startNode, "get foo");
808 GetChild(isolate, startNode, "set foo"); 814 GetChild(isolate, startNode, "set foo");
809 815
810 const_cast<v8::CpuProfile*>(profile)->Delete(); 816 const_cast<v8::CpuProfile*>(profile)->Delete();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 v8::Local<v8::Object> instance = func->NewInstance(); 850 v8::Local<v8::Object> instance = func->NewInstance();
845 env->Global()->Set(v8::String::NewFromUtf8(isolate, "instance"), 851 env->Global()->Set(v8::String::NewFromUtf8(isolate, "instance"),
846 instance); 852 instance);
847 853
848 v8::Script::Compile(v8::String::NewFromUtf8( 854 v8::Script::Compile(v8::String::NewFromUtf8(
849 isolate, native_method_test_source))->Run(); 855 isolate, native_method_test_source))->Run();
850 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 856 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
851 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start"))); 857 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
852 858
853 int32_t repeat_count = 1; 859 int32_t repeat_count = 1;
854 v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; 860 v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
855 const v8::CpuProfile* profile = 861 const v8::CpuProfile* profile =
856 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); 862 RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
857 863
858 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 864 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
859 const v8::CpuProfileNode* startNode = 865 const v8::CpuProfileNode* startNode =
860 GetChild(isolate, root, "start"); 866 GetChild(isolate, root, "start");
861 GetChild(isolate, startNode, "fooMethod"); 867 GetChild(isolate, startNode, "fooMethod");
862 868
863 const_cast<v8::CpuProfile*>(profile)->Delete(); 869 const_cast<v8::CpuProfile*>(profile)->Delete();
864 } 870 }
(...skipping 28 matching lines...) Expand all
893 899
894 v8::Script::Compile(v8::String::NewFromUtf8( 900 v8::Script::Compile(v8::String::NewFromUtf8(
895 isolate, native_method_test_source))->Run(); 901 isolate, native_method_test_source))->Run();
896 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 902 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
897 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start"))); 903 env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
898 { 904 {
899 // Make sure method ICs are in monomorphic state before starting 905 // Make sure method ICs are in monomorphic state before starting
900 // profiling. 906 // profiling.
901 callbacks.set_warming_up(true); 907 callbacks.set_warming_up(true);
902 int32_t warm_up_iterations = 3; 908 int32_t warm_up_iterations = 3;
903 v8::Handle<v8::Value> args[] = { v8::Integer::New(warm_up_iterations) }; 909 v8::Handle<v8::Value> args[] = {
910 v8::Integer::New(isolate, warm_up_iterations)
911 };
904 function->Call(env->Global(), ARRAY_SIZE(args), args); 912 function->Call(env->Global(), ARRAY_SIZE(args), args);
905 callbacks.set_warming_up(false); 913 callbacks.set_warming_up(false);
906 } 914 }
907 915
908 int32_t repeat_count = 100; 916 int32_t repeat_count = 100;
909 v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; 917 v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
910 const v8::CpuProfile* profile = 918 const v8::CpuProfile* profile =
911 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); 919 RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
912 920
913 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 921 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
914 GetChild(isolate, root, "start"); 922 GetChild(isolate, root, "start");
915 const v8::CpuProfileNode* startNode = 923 const v8::CpuProfileNode* startNode =
916 GetChild(isolate, root, "start"); 924 GetChild(isolate, root, "start");
917 GetChild(isolate, startNode, "fooMethod"); 925 GetChild(isolate, startNode, "fooMethod");
918 926
919 const_cast<v8::CpuProfile*>(profile)->Delete(); 927 const_cast<v8::CpuProfile*>(profile)->Delete();
(...skipping 18 matching lines...) Expand all
938 LocalContext env; 946 LocalContext env;
939 v8::HandleScope scope(env->GetIsolate()); 947 v8::HandleScope scope(env->GetIsolate());
940 948
941 v8::Script::Compile( 949 v8::Script::Compile(
942 v8::String::NewFromUtf8(env->GetIsolate(), bound_function_test_source)) 950 v8::String::NewFromUtf8(env->GetIsolate(), bound_function_test_source))
943 ->Run(); 951 ->Run();
944 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 952 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
945 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 953 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
946 954
947 int32_t duration_ms = 100; 955 int32_t duration_ms = 100;
948 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; 956 v8::Handle<v8::Value> args[] = {
957 v8::Integer::New(env->GetIsolate(), duration_ms)
958 };
949 const v8::CpuProfile* profile = 959 const v8::CpuProfile* profile =
950 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); 960 RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
951 961
952 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 962 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
953 ScopedVector<v8::Handle<v8::String> > names(3); 963 ScopedVector<v8::Handle<v8::String> > names(3);
954 names[0] = v8::String::NewFromUtf8( 964 names[0] = v8::String::NewFromUtf8(
955 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 965 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
956 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 966 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
957 ProfileGenerator::kProgramEntryName); 967 ProfileGenerator::kProgramEntryName);
958 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); 968 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 1007
998 // Collect garbage that might have be generated while installing extensions. 1008 // Collect garbage that might have be generated while installing extensions.
999 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 1009 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
1000 1010
1001 v8::Script::Compile(v8::String::NewFromUtf8( 1011 v8::Script::Compile(v8::String::NewFromUtf8(
1002 env->GetIsolate(), call_function_test_source))->Run(); 1012 env->GetIsolate(), call_function_test_source))->Run();
1003 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 1013 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
1004 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 1014 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
1005 1015
1006 int32_t duration_ms = 100; 1016 int32_t duration_ms = 100;
1007 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; 1017 v8::Handle<v8::Value> args[] = {
1018 v8::Integer::New(env->GetIsolate(), duration_ms)
1019 };
1008 const v8::CpuProfile* profile = 1020 const v8::CpuProfile* profile =
1009 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); 1021 RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
1010 1022
1011 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 1023 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
1012 { 1024 {
1013 ScopedVector<v8::Handle<v8::String> > names(4); 1025 ScopedVector<v8::Handle<v8::String> > names(4);
1014 names[0] = v8::String::NewFromUtf8( 1026 names[0] = v8::String::NewFromUtf8(
1015 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 1027 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
1016 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 1028 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
1017 ProfileGenerator::kProgramEntryName); 1029 ProfileGenerator::kProgramEntryName);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 LocalContext env; 1089 LocalContext env;
1078 v8::HandleScope scope(env->GetIsolate()); 1090 v8::HandleScope scope(env->GetIsolate());
1079 1091
1080 v8::Script::Compile( 1092 v8::Script::Compile(
1081 v8::String::NewFromUtf8(env->GetIsolate(), function_apply_test_source)) 1093 v8::String::NewFromUtf8(env->GetIsolate(), function_apply_test_source))
1082 ->Run(); 1094 ->Run();
1083 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 1095 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
1084 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 1096 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
1085 1097
1086 int32_t duration_ms = 100; 1098 int32_t duration_ms = 100;
1087 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; 1099 v8::Handle<v8::Value> args[] = {
1100 v8::Integer::New(env->GetIsolate(), duration_ms)
1101 };
1088 1102
1089 const v8::CpuProfile* profile = 1103 const v8::CpuProfile* profile =
1090 RunProfiler(env, function, args, ARRAY_SIZE(args), 100); 1104 RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
1091 1105
1092 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 1106 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
1093 { 1107 {
1094 ScopedVector<v8::Handle<v8::String> > names(3); 1108 ScopedVector<v8::Handle<v8::String> > names(3);
1095 names[0] = v8::String::NewFromUtf8( 1109 names[0] = v8::String::NewFromUtf8(
1096 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 1110 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
1097 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 1111 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction")); 1198 func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"));
1185 env->Global()->Set( 1199 env->Global()->Set(
1186 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func); 1200 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func);
1187 1201
1188 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), 1202 v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
1189 js_native_js_test_source))->Run(); 1203 js_native_js_test_source))->Run();
1190 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 1204 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
1191 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 1205 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
1192 1206
1193 int32_t duration_ms = 20; 1207 int32_t duration_ms = 20;
1194 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; 1208 v8::Handle<v8::Value> args[] = {
1209 v8::Integer::New(env->GetIsolate(), duration_ms)
1210 };
1195 const v8::CpuProfile* profile = 1211 const v8::CpuProfile* profile =
1196 RunProfiler(env, function, args, ARRAY_SIZE(args), 10); 1212 RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
1197 1213
1198 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 1214 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
1199 { 1215 {
1200 ScopedVector<v8::Handle<v8::String> > names(3); 1216 ScopedVector<v8::Handle<v8::String> > names(3);
1201 names[0] = v8::String::NewFromUtf8( 1217 names[0] = v8::String::NewFromUtf8(
1202 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 1218 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
1203 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 1219 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
1204 ProfileGenerator::kProgramEntryName); 1220 ProfileGenerator::kProgramEntryName);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 env->Global()->Set( 1284 env->Global()->Set(
1269 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func); 1285 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func);
1270 1286
1271 v8::Script::Compile( 1287 v8::Script::Compile(
1272 v8::String::NewFromUtf8(env->GetIsolate(), 1288 v8::String::NewFromUtf8(env->GetIsolate(),
1273 js_native_js_runtime_js_test_source))->Run(); 1289 js_native_js_runtime_js_test_source))->Run();
1274 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 1290 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
1275 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 1291 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
1276 1292
1277 int32_t duration_ms = 20; 1293 int32_t duration_ms = 20;
1278 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; 1294 v8::Handle<v8::Value> args[] = {
1295 v8::Integer::New(env->GetIsolate(), duration_ms)
1296 };
1279 const v8::CpuProfile* profile = 1297 const v8::CpuProfile* profile =
1280 RunProfiler(env, function, args, ARRAY_SIZE(args), 10); 1298 RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
1281 1299
1282 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 1300 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
1283 ScopedVector<v8::Handle<v8::String> > names(3); 1301 ScopedVector<v8::Handle<v8::String> > names(3);
1284 names[0] = v8::String::NewFromUtf8( 1302 names[0] = v8::String::NewFromUtf8(
1285 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 1303 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
1286 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 1304 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
1287 ProfileGenerator::kProgramEntryName); 1305 ProfileGenerator::kProgramEntryName);
1288 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); 1306 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 env->Global()->Set( 1379 env->Global()->Set(
1362 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2"), func2); 1380 v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2"), func2);
1363 1381
1364 v8::Script::Compile( 1382 v8::Script::Compile(
1365 v8::String::NewFromUtf8(env->GetIsolate(), 1383 v8::String::NewFromUtf8(env->GetIsolate(),
1366 js_native1_js_native2_js_test_source))->Run(); 1384 js_native1_js_native2_js_test_source))->Run();
1367 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( 1385 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
1368 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); 1386 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
1369 1387
1370 int32_t duration_ms = 20; 1388 int32_t duration_ms = 20;
1371 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; 1389 v8::Handle<v8::Value> args[] = {
1390 v8::Integer::New(env->GetIsolate(), duration_ms)
1391 };
1372 const v8::CpuProfile* profile = 1392 const v8::CpuProfile* profile =
1373 RunProfiler(env, function, args, ARRAY_SIZE(args), 10); 1393 RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
1374 1394
1375 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); 1395 const v8::CpuProfileNode* root = profile->GetTopDownRoot();
1376 ScopedVector<v8::Handle<v8::String> > names(3); 1396 ScopedVector<v8::Handle<v8::String> > names(3);
1377 names[0] = v8::String::NewFromUtf8( 1397 names[0] = v8::String::NewFromUtf8(
1378 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName); 1398 env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
1379 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), 1399 names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
1380 ProfileGenerator::kProgramEntryName); 1400 ProfileGenerator::kProgramEntryName);
1381 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start"); 1401 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 inner_profile = NULL; 1568 inner_profile = NULL;
1549 CHECK_EQ(0, iprofiler->GetProfilesCount()); 1569 CHECK_EQ(0, iprofiler->GetProfilesCount());
1550 1570
1551 const v8::CpuProfile* outer_profile = profiler->StopCpuProfiling(outer); 1571 const v8::CpuProfile* outer_profile = profiler->StopCpuProfiling(outer);
1552 CHECK(outer_profile); 1572 CHECK(outer_profile);
1553 CHECK_EQ(1, iprofiler->GetProfilesCount()); 1573 CHECK_EQ(1, iprofiler->GetProfilesCount());
1554 const_cast<v8::CpuProfile*>(outer_profile)->Delete(); 1574 const_cast<v8::CpuProfile*>(outer_profile)->Delete();
1555 outer_profile = NULL; 1575 outer_profile = NULL;
1556 CHECK_EQ(0, iprofiler->GetProfilesCount()); 1576 CHECK_EQ(0, iprofiler->GetProfilesCount());
1557 } 1577 }
OLDNEW
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698