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 |
80 #define THREADED_PROFILED_TEST(Name) \ | 86 #define THREADED_PROFILED_TEST(Name) \ |
81 static void Test##Name(); \ | 87 static void Test##Name(); \ |
82 TEST(Name##WithProfiler) { \ | 88 TEST(Name##WithProfiler) { \ |
83 RunWithProfiler(&Test##Name); \ | 89 RunWithProfiler(&Test##Name); \ |
84 } \ | 90 } \ |
85 THREADED_TEST(Name) | 91 THREADED_TEST(Name) |
| 92 #endif |
| 93 |
86 | 94 |
87 void RunWithProfiler(void (*test)()) { | 95 void RunWithProfiler(void (*test)()) { |
88 LocalContext env; | 96 LocalContext env; |
89 v8::HandleScope scope(env->GetIsolate()); | 97 v8::HandleScope scope(env->GetIsolate()); |
90 v8::Local<v8::String> profile_name = v8::String::New("my_profile1"); | 98 v8::Local<v8::String> profile_name = v8::String::New("my_profile1"); |
91 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 99 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
92 | 100 |
93 cpu_profiler->StartCpuProfiling(profile_name); | 101 cpu_profiler->StartCpuProfiling(profile_name); |
94 (*test)(); | 102 (*test)(); |
95 cpu_profiler->DeleteAllCpuProfiles(); | 103 cpu_profiler->DeleteAllCpuProfiles(); |
(...skipping 20493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20589 Local<Object> data2 = v8::Object::New(); | 20597 Local<Object> data2 = v8::Object::New(); |
20590 function_new_expected_env = data2; | 20598 function_new_expected_env = data2; |
20591 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); | 20599 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); |
20592 CHECK(!func2->IsNull()); | 20600 CHECK(!func2->IsNull()); |
20593 CHECK_NE(func, func2); | 20601 CHECK_NE(func, func2); |
20594 env->Global()->Set(v8_str("func2"), func2); | 20602 env->Global()->Set(v8_str("func2"), func2); |
20595 Local<Value> result2 = CompileRun("func2();"); | 20603 Local<Value> result2 = CompileRun("func2();"); |
20596 CHECK_EQ(v8::Integer::New(17, isolate), result2); | 20604 CHECK_EQ(v8::Integer::New(17, isolate), result2); |
20597 } | 20605 } |
20598 | 20606 |
OLD | NEW |