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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void RunWithProfiler(void (*test)()) { | 88 void RunWithProfiler(void (*test)()) { |
89 LocalContext env; | 89 LocalContext env; |
90 v8::HandleScope scope(env->GetIsolate()); | 90 v8::HandleScope scope(env->GetIsolate()); |
91 v8::Local<v8::String> profile_name = | 91 v8::Local<v8::String> profile_name = |
92 v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1"); | 92 v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1"); |
93 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 93 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
94 | 94 |
95 cpu_profiler->StartCpuProfiling(profile_name); | 95 cpu_profiler->StartCpuProfiling(profile_name); |
96 (*test)(); | 96 (*test)(); |
97 cpu_profiler->DeleteAllCpuProfiles(); | 97 reinterpret_cast<i::CpuProfiler*>(cpu_profiler)->DeleteAllProfiles(); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 static void ExpectString(const char* code, const char* expected) { | 101 static void ExpectString(const char* code, const char* expected) { |
102 Local<Value> result = CompileRun(code); | 102 Local<Value> result = CompileRun(code); |
103 CHECK(result->IsString()); | 103 CHECK(result->IsString()); |
104 String::Utf8Value utf8(result); | 104 String::Utf8Value utf8(result); |
105 CHECK_EQ(expected, *utf8); | 105 CHECK_EQ(expected, *utf8); |
106 } | 106 } |
107 | 107 |
(...skipping 20842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20950 } | 20950 } |
20951 for (int i = 0; i < runs; i++) { | 20951 for (int i = 0; i < runs; i++) { |
20952 Local<String> expected; | 20952 Local<String> expected; |
20953 if (i != 0) { | 20953 if (i != 0) { |
20954 CHECK_EQ(v8_str("escape value"), values[i]); | 20954 CHECK_EQ(v8_str("escape value"), values[i]); |
20955 } else { | 20955 } else { |
20956 CHECK(values[i].IsEmpty()); | 20956 CHECK(values[i].IsEmpty()); |
20957 } | 20957 } |
20958 } | 20958 } |
20959 } | 20959 } |
OLD | NEW |