OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/profiler.h" | 10 #include "vm/profiler.h" |
11 #include "vm/profiler_service.h" | 11 #include "vm/profiler_service.h" |
12 #include "vm/source_report.h" | 12 #include "vm/source_report.h" |
13 #include "vm/unit_test.h" | 13 #include "vm/unit_test.h" |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 #ifndef PRODUCT | 17 #ifndef PRODUCT |
18 | 18 |
19 DECLARE_FLAG(bool, profile_vm); | 19 DECLARE_FLAG(bool, profile_vm); |
20 DECLARE_FLAG(int, max_profile_depth); | 20 DECLARE_FLAG(int, max_profile_depth); |
21 DECLARE_FLAG(bool, enable_inlining_annotations); | 21 DECLARE_FLAG(bool, enable_inlining_annotations); |
22 DECLARE_FLAG(int, optimization_counter_threshold); | 22 DECLARE_FLAG(int, optimization_counter_threshold); |
23 | 23 |
24 template<typename T> | |
25 class SetFlagScope : public ValueObject { | |
26 public: | |
27 SetFlagScope(T* flag, T value) | |
28 : flag_(flag), | |
29 original_value_(*flag) { | |
30 *flag_ = value; | |
31 } | |
32 | |
33 ~SetFlagScope() { | |
34 *flag_ = original_value_; | |
35 } | |
36 | |
37 private: | |
38 T* flag_; | |
39 T original_value_; | |
40 }; | |
41 | |
42 // Some tests are written assuming native stack trace profiling is disabled. | 24 // Some tests are written assuming native stack trace profiling is disabled. |
43 class DisableNativeProfileScope : public ValueObject { | 25 class DisableNativeProfileScope : public ValueObject { |
44 public: | 26 public: |
45 DisableNativeProfileScope() | 27 DisableNativeProfileScope() |
46 : FLAG_profile_vm_(FLAG_profile_vm) { | 28 : FLAG_profile_vm_(FLAG_profile_vm) { |
47 FLAG_profile_vm = false; | 29 FLAG_profile_vm = false; |
48 } | 30 } |
49 | 31 |
50 ~DisableNativeProfileScope() { | 32 ~DisableNativeProfileScope() { |
51 FLAG_profile_vm = FLAG_profile_vm_; | 33 FLAG_profile_vm = FLAG_profile_vm_; |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); | 2554 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); |
2573 // Verify exclusive ticks in main. | 2555 // Verify exclusive ticks in main. |
2574 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); | 2556 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); |
2575 // Verify inclusive ticks in main. | 2557 // Verify inclusive ticks in main. |
2576 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); | 2558 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); |
2577 } | 2559 } |
2578 | 2560 |
2579 #endif // !PRODUCT | 2561 #endif // !PRODUCT |
2580 | 2562 |
2581 } // namespace dart | 2563 } // namespace dart |
OLD | NEW |