Revision: 15114
Author: [email protected]
Date: Thu Jun 13 04:09:19 2013
Log: Revert "DevTools: CPUProfiler: provide url for scripts that have
sourceURL property."
This reverts commit d95b7bb92ad1a191cf505250830d094b86d61e8f.
This reverts commit ca81c09a367600be79452e1fc53ac63b75e369c4.
record-cpu-profile.html is crashing
TBR= [email protected], [email protected]
BUG=none
Review URL: https://codereview.chromium.org/16940005
http://code.google.com/p/v8/source/detail?r=15114
Modified:
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/handles.cc
/branches/bleeding_edge/src/log.cc
/branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
=======================================
--- /branches/bleeding_edge/src/compiler.cc Wed Jun 12 10:20:37 2013
+++ /branches/bleeding_edge/src/compiler.cc Thu Jun 13 04:09:19 2013
@@ -1181,16 +1181,7 @@
Handle<Code> code = info->code();
if (*code ==
info->isolate()->builtins()->builtin(Builtins::kLazyCompile))
return;
- Handle<String> script_name;
if (script->name()->IsString()) {
- script_name = Handle<String>(String::cast(script->name()));
- } else {
- Handle<Object> name = GetScriptNameOrSourceURL(script);
- if (!name.is_null() && name->IsString()) {
- script_name = Handle<String>::cast(name);
- }
- }
- if (!script_name.is_null()) {
int line_num = GetScriptLineNumber(script, shared->start_position())
+ 1;
USE(line_num);
PROFILE(info->isolate(),
@@ -1198,7 +1189,7 @@
*code,
*shared,
info,
- String::cast(*script_name),
+ String::cast(script->name()),
line_num));
} else {
PROFILE(info->isolate(),
=======================================
--- /branches/bleeding_edge/src/handles.cc Thu Jun 13 02:27:09 2013
+++ /branches/bleeding_edge/src/handles.cc Thu Jun 13 04:09:19 2013
@@ -599,9 +599,6 @@
Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
Isolate* isolate = script->GetIsolate();
- if (!isolate->IsInitialized()) {
- return isolate->factory()->undefined_value();
- }
Handle<String> name_or_source_url_key =
isolate->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("nameOrSourceURL"));
=======================================
--- /branches/bleeding_edge/src/log.cc Thu Jun 13 02:27:09 2013
+++ /branches/bleeding_edge/src/log.cc Thu Jun 13 04:09:19 2013
@@ -1728,18 +1728,10 @@
Handle<String> func_name(shared->DebugName());
if (shared->script()->IsScript()) {
Handle<Script> script(Script::cast(shared->script()));
- Handle<String> script_name;
if (script->name()->IsString()) {
- script_name = Handle<String>(String::cast(script->name()));
- } else {
- Handle<Object> name = GetScriptNameOrSourceURL(script);
- if (!name.is_null() && name->IsString()) {
- script_name = Handle<String>::cast(name);
- }
- }
- if (!script_name.is_null()) {
+ Handle<String> script_name(String::cast(script->name()));
int line_num = GetScriptLineNumber(script, shared->start_position());
- if (line_num > -1) {
+ if (line_num > 0) {
PROFILE(isolate_,
CodeCreateEvent(
Logger::ToNativeByScript(Logger::LAZY_COMPILE_TAG,
*script),
=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Wed Jun 12
07:34:19 2013
+++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Thu Jun 13
04:09:19 2013
@@ -917,89 +917,3 @@
cpu_profiler->DeleteAllCpuProfiles();
}
-
-
-static const char* cpu_profiler_sourceURL_source =
-"function start(timeout) {\n"
-" var start = Date.now();\n"
-" var duration = 0;\n"
-" do {\n"
-" try {\n"
-" duration = Date.now() - start;\n"
-" } catch(e) { }\n"
-" } while (duration < timeout);\n"
-" return duration;\n"
-"}\n"
-"//# sourceURL=cpu_profiler_sourceURL_source.js";
-
-
-TEST(SourceURLSupportForNewFunctions) {
- LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
-
-
v8::Script::Compile(v8::String::New(cpu_profiler_sourceURL_source))->Run();
- v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
- v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
- int32_t profiling_interval_ms = 200;
-#if defined(_WIN32) || defined(_WIN64)
- // 200ms is not enough on Windows. See
- // https://code.google.com/p/v8/issues/detail?id=2628
- profiling_interval_ms = 500;
-#endif
-
- // Cold run.
- v8::Local<v8::String> profile_name = v8::String::New("my_profile");
- cpu_profiler->StartCpuProfiling(profile_name);
- v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms)
};
- function->Call(env->Global(), ARRAY_SIZE(args), args);
- const v8::CpuProfile* profile =
cpu_profiler->StopCpuProfiling(profile_name);
- CHECK_NE(NULL, profile);
-
- // Dump collected profile to have a better diagnostic in case of failure.
- reinterpret_cast<i::CpuProfile*>(
- const_cast<v8::CpuProfile*>(profile))->Print();
- const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
-
- CHECK_EQ(v8::String::New("cpu_profiler_sourceURL_source.js"),
- startNode->GetScriptResourceName());
-
- cpu_profiler->DeleteAllCpuProfiles();
-}
-
-TEST(LogExistingFunctionSourceURLCheck) {
- LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
-
-
v8::Script::Compile(v8::String::New(cpu_profiler_sourceURL_source))->Run();
- v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
- v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
- int32_t profiling_interval_ms = 200;
-
- // Warm up.
- v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms)
};
- function->Call(env->Global(), ARRAY_SIZE(args), args);
-
-#if defined(_WIN32) || defined(_WIN64)
- // 200ms is not enough on Windows. See
- // https://code.google.com/p/v8/issues/detail?id=2628
- profiling_interval_ms = 500;
-#endif
- v8::Local<v8::String> profile_name = v8::String::New("my_profile");
- cpu_profiler->StartCpuProfiling(profile_name);
- function->Call(env->Global(), ARRAY_SIZE(args), args);
- const v8::CpuProfile* profile =
cpu_profiler->StopCpuProfiling(profile_name);
- CHECK_NE(NULL, profile);
-
- // Dump collected profile to have a better diagnostic in case of failure.
- reinterpret_cast<i::CpuProfile*>(
- const_cast<v8::CpuProfile*>(profile))->Print();
- const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
- CHECK_EQ(v8::String::New("cpu_profiler_sourceURL_source.js"),
- startNode->GetScriptResourceName());
-
- cpu_profiler->DeleteAllCpuProfiles();
-}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.