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

Unified Diff: test/cctest/test-profile-generator.cc

Issue 1371363006: Continuing removing deprecated function from cctest (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a bug in test-serialize.cc. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-platform-win32.cc ('k') | test/cctest/test-random-number-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-profile-generator.cc
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
index 78a8204556b2460c3c5c9caaa9552eb3cf7b00a8..b918eb5a3b9e7af98dbc52c9627988115090946d 100644
--- a/test/cctest/test-profile-generator.cc
+++ b/test/cctest/test-profile-generator.cc
@@ -27,6 +27,9 @@
//
// Tests of profiles generator and utilities.
+// TODO(mythria): Remove this define after this flag is turned on globally
+#define V8_IMMINENT_DEPRECATION_WARNINGS
+
#include "src/v8.h"
#include "include/v8-profiler.h"
@@ -577,15 +580,16 @@ TEST(ProfileNodeScriptId) {
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler);
CHECK_EQ(0, iprofiler->GetProfilesCount());
- v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::NewFromUtf8(
- env->GetIsolate(), "function a() { startProfiling(); }\n"));
- script_a->Run();
- v8::Handle<v8::Script> script_b =
- v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
- "function b() { a(); }\n"
- "b();\n"
- "stopProfiling();\n"));
- script_b->Run();
+ v8::Local<v8::Script> script_a =
+ v8_compile(v8_str("function a() { startProfiling(); }\n"));
+ script_a->Run(v8::Isolate::GetCurrent()->GetCurrentContext())
+ .ToLocalChecked();
+ v8::Local<v8::Script> script_b =
+ v8_compile(v8_str("function b() { a(); }\n"
+ "b();\n"
+ "stopProfiling();\n"));
+ script_b->Run(v8::Isolate::GetCurrent()->GetCurrentContext())
+ .ToLocalChecked();
CHECK_EQ(1, iprofiler->GetProfilesCount());
const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
const v8::CpuProfileNode* current = profile->GetTopDownRoot();
@@ -632,9 +636,13 @@ static const char* line_number_test_source_profile_time_functions =
int GetFunctionLineNumber(LocalContext* env, const char* name) {
CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler();
CodeMap* code_map = profiler->generator()->code_map();
- i::Handle<i::JSFunction> func = v8::Utils::OpenHandle(
- *v8::Local<v8::Function>::Cast(
- (*(*env))->Global()->Get(v8_str(name))));
+ i::Handle<i::JSFunction> func =
+ v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
+ (*(*env))
+ ->Global()
+ ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
+ v8_str(name))
+ .ToLocalChecked()));
CodeEntry* func_entry = code_map->FindEntry(func->code()->address());
if (!func_entry)
FATAL(name);
@@ -679,20 +687,19 @@ TEST(BailoutReason) {
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler);
CHECK_EQ(0, iprofiler->GetProfilesCount());
- v8::Handle<v8::Script> script =
- v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
- "function Debugger() {\n"
- " debugger;\n"
- " startProfiling();\n"
- "}\n"
- "function TryFinally() {\n"
- " try {\n"
- " Debugger();\n"
- " } finally { };\n"
- "}\n"
- "TryFinally();\n"
- "stopProfiling();"));
- script->Run();
+ v8::Local<v8::Script> script =
+ v8_compile(v8_str("function Debugger() {\n"
+ " debugger;\n"
+ " startProfiling();\n"
+ "}\n"
+ "function TryFinally() {\n"
+ " try {\n"
+ " Debugger();\n"
+ " } finally { };\n"
+ "}\n"
+ "TryFinally();\n"
+ "stopProfiling();"));
+ script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked();
CHECK_EQ(1, iprofiler->GetProfilesCount());
const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
CHECK(profile);
« no previous file with comments | « test/cctest/test-platform-win32.cc ('k') | test/cctest/test-random-number-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698