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

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

Issue 19554002: Remove V8_DISABLE_DEPRECATIONS=1 from test-cpu-profiler.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Formatting Created 7 years, 5 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 | « no previous file | no next file » | 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 // 27 //
28 // Tests of profiles generator and utilities. 28 // Tests of profiles generator and utilities.
29 29
30 #define V8_DISABLE_DEPRECATIONS 1
31 #include "v8.h" 30 #include "v8.h"
32 #include "cpu-profiler-inl.h" 31 #include "cpu-profiler-inl.h"
33 #include "cctest.h" 32 #include "cctest.h"
34 #include "platform.h" 33 #include "platform.h"
35 #include "utils.h" 34 #include "utils.h"
36 #include "../include/v8-profiler.h" 35 #include "../include/v8-profiler.h"
37 #undef V8_DISABLE_DEPRECATIONS
38
39 using i::CodeEntry; 36 using i::CodeEntry;
40 using i::CpuProfile; 37 using i::CpuProfile;
41 using i::CpuProfiler; 38 using i::CpuProfiler;
42 using i::CpuProfilesCollection; 39 using i::CpuProfilesCollection;
43 using i::Heap; 40 using i::Heap;
44 using i::ProfileGenerator; 41 using i::ProfileGenerator;
45 using i::ProfileNode; 42 using i::ProfileNode;
46 using i::ProfilerEventsProcessor; 43 using i::ProfilerEventsProcessor;
47 using i::ScopedVector; 44 using i::ScopedVector;
48 using i::Vector; 45 using i::Vector;
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 " }\n" 652 " }\n"
656 "}\n"; 653 "}\n";
657 654
658 655
659 class TestApiCallbacks { 656 class TestApiCallbacks {
660 public: 657 public:
661 explicit TestApiCallbacks(int min_duration_ms) 658 explicit TestApiCallbacks(int min_duration_ms)
662 : min_duration_ms_(min_duration_ms), 659 : min_duration_ms_(min_duration_ms),
663 is_warming_up_(false) {} 660 is_warming_up_(false) {}
664 661
665 static v8::Handle<v8::Value> Getter(v8::Local<v8::String> name, 662 static void Getter(v8::Local<v8::String> name,
666 const v8::AccessorInfo& info) { 663 const v8::PropertyCallbackInfo<v8::Value>& info) {
667 TestApiCallbacks* data = fromInfo(info); 664 TestApiCallbacks* data = fromInfo(info);
668 data->Wait(); 665 data->Wait();
669 return v8::Int32::New(2013);
670 } 666 }
671 667
672 static void Setter(v8::Local<v8::String> name, 668 static void Setter(v8::Local<v8::String> name,
673 v8::Local<v8::Value> value, 669 v8::Local<v8::Value> value,
674 const v8::AccessorInfo& info) { 670 const v8::PropertyCallbackInfo<void>& info) {
675 TestApiCallbacks* data = fromInfo(info); 671 TestApiCallbacks* data = fromInfo(info);
676 data->Wait(); 672 data->Wait();
677 } 673 }
678 674
679 static void Callback(const v8::FunctionCallbackInfo<v8::Value>& info) { 675 static void Callback(const v8::FunctionCallbackInfo<v8::Value>& info) {
680 TestApiCallbacks* data = fromInfo(info); 676 TestApiCallbacks* data = fromInfo(info);
681 data->Wait(); 677 data->Wait();
682 } 678 }
683 679
684 void set_warming_up(bool value) { is_warming_up_ = value; } 680 void set_warming_up(bool value) { is_warming_up_ = value; }
685 681
686 private: 682 private:
687 void Wait() { 683 void Wait() {
688 if (is_warming_up_) return; 684 if (is_warming_up_) return;
689 double start = i::OS::TimeCurrentMillis(); 685 double start = i::OS::TimeCurrentMillis();
690 double duration = 0; 686 double duration = 0;
691 while (duration < min_duration_ms_) { 687 while (duration < min_duration_ms_) {
692 i::OS::Sleep(1); 688 i::OS::Sleep(1);
693 duration = i::OS::TimeCurrentMillis() - start; 689 duration = i::OS::TimeCurrentMillis() - start;
694 } 690 }
695 } 691 }
696 692
697 static TestApiCallbacks* fromInfo(const v8::AccessorInfo& info) { 693 template<typename T>
694 static TestApiCallbacks* fromInfo(const T& info) {
698 void* data = v8::External::Cast(*info.Data())->Value(); 695 void* data = v8::External::Cast(*info.Data())->Value();
699 return reinterpret_cast<TestApiCallbacks*>(data); 696 return reinterpret_cast<TestApiCallbacks*>(data);
700 } 697 }
701
702 static TestApiCallbacks* fromInfo(
703 const v8::FunctionCallbackInfo<v8::Value>& info) {
704 void* data = v8::External::Cast(*info.Data())->Value();
705 return reinterpret_cast<TestApiCallbacks*>(data);
706 }
707 698
708 int min_duration_ms_; 699 int min_duration_ms_;
709 bool is_warming_up_; 700 bool is_warming_up_;
710 }; 701 };
711 702
712 703
713 // Test that native accessors are properly reported in the CPU profile. 704 // Test that native accessors are properly reported in the CPU profile.
714 // This test checks the case when the long-running accessors are called 705 // This test checks the case when the long-running accessors are called
715 // only once and the optimizer doesn't have chance to change the invocation 706 // only once and the optimizer doesn't have chance to change the invocation
716 // code. 707 // code.
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 ScopedVector<v8::Handle<v8::String> > names(1); 1074 ScopedVector<v8::Handle<v8::String> > names(1);
1084 names[0] = v8::String::New("apply"); 1075 names[0] = v8::String::New("apply");
1085 CheckChildrenNames(unresolvedNode, names); 1076 CheckChildrenNames(unresolvedNode, names);
1086 GetChild(unresolvedNode, "apply"); 1077 GetChild(unresolvedNode, "apply");
1087 } 1078 }
1088 } 1079 }
1089 1080
1090 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 1081 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
1091 cpu_profiler->DeleteAllCpuProfiles(); 1082 cpu_profiler->DeleteAllCpuProfiles();
1092 } 1083 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698