OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 using ::v8::Script; | 70 using ::v8::Script; |
71 using ::v8::StackTrace; | 71 using ::v8::StackTrace; |
72 using ::v8::String; | 72 using ::v8::String; |
73 using ::v8::TryCatch; | 73 using ::v8::TryCatch; |
74 using ::v8::Undefined; | 74 using ::v8::Undefined; |
75 using ::v8::UniqueId; | 75 using ::v8::UniqueId; |
76 using ::v8::V8; | 76 using ::v8::V8; |
77 using ::v8::Value; | 77 using ::v8::Value; |
78 | 78 |
79 | 79 |
80 // TODO(bmeurer): Don't run profiled tests when using the simulator. | |
81 // This is a temporary work-around, until the profiler is fixed. | |
82 #if USE_SIMULATOR | |
83 #define THREADED_PROFILED_TEST(Name) \ | |
84 THREADED_TEST(Name) | |
85 #else | |
86 #define THREADED_PROFILED_TEST(Name) \ | 80 #define THREADED_PROFILED_TEST(Name) \ |
87 static void Test##Name(); \ | 81 static void Test##Name(); \ |
88 TEST(Name##WithProfiler) { \ | 82 TEST(Name##WithProfiler) { \ |
89 RunWithProfiler(&Test##Name); \ | 83 RunWithProfiler(&Test##Name); \ |
90 } \ | 84 } \ |
91 THREADED_TEST(Name) | 85 THREADED_TEST(Name) |
92 #endif | |
93 | 86 |
94 | 87 |
95 void RunWithProfiler(void (*test)()) { | 88 void RunWithProfiler(void (*test)()) { |
96 LocalContext env; | 89 LocalContext env; |
97 v8::HandleScope scope(env->GetIsolate()); | 90 v8::HandleScope scope(env->GetIsolate()); |
98 v8::Local<v8::String> profile_name = v8::String::New("my_profile1"); | 91 v8::Local<v8::String> profile_name = v8::String::New("my_profile1"); |
99 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 92 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
100 | 93 |
101 cpu_profiler->StartCpuProfiling(profile_name); | 94 cpu_profiler->StartCpuProfiling(profile_name); |
102 (*test)(); | 95 (*test)(); |
(...skipping 20506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20609 } | 20602 } |
20610 for (int i = 0; i < runs; i++) { | 20603 for (int i = 0; i < runs; i++) { |
20611 Local<String> expected; | 20604 Local<String> expected; |
20612 if (i != 0) { | 20605 if (i != 0) { |
20613 CHECK_EQ(v8_str("escape value"), values[i]); | 20606 CHECK_EQ(v8_str("escape value"), values[i]); |
20614 } else { | 20607 } else { |
20615 CHECK(values[i].IsEmpty()); | 20608 CHECK(values[i].IsEmpty()); |
20616 } | 20609 } |
20617 } | 20610 } |
20618 } | 20611 } |
OLD | NEW |