Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / v8 / src / cpu-profiler.cc
index 0911850..68a565c 100644 (file)
@@ -23,7 +23,7 @@ static const int kProfilerStackSize = 64 * KB;
 ProfilerEventsProcessor::ProfilerEventsProcessor(
     ProfileGenerator* generator,
     Sampler* sampler,
-    TimeDelta period)
+    base::TimeDelta period)
     : Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)),
       generator_(generator),
       sampler_(sampler),
@@ -108,7 +108,7 @@ ProfilerEventsProcessor::SampleProcessingResult
 
 void ProfilerEventsProcessor::Run() {
   while (running_) {
-    ElapsedTimer timer;
+    base::ElapsedTimer timer;
     timer.Start();
     // Keep processing existing events until we need to do next sample.
     do {
@@ -222,21 +222,21 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
 }
 
 
-void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
-                                  Code* code,
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
                                   SharedFunctionInfo* shared,
-                                  CompilationInfo* info,
-                                  Name* name) {
+                                  CompilationInfo* info, Name* script_name) {
   if (FilterOutCodeCreateEvent(tag)) return;
   CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
   CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
   rec->start = code->address();
-  rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name));
+  rec->entry = profiles_->NewCodeEntry(
+      tag, profiles_->GetFunctionName(shared->DebugName()),
+      CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name));
   if (info) {
     rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
   }
   if (shared->script()->IsScript()) {
-    ASSERT(Script::cast(shared->script()));
+    DCHECK(Script::cast(shared->script()));
     Script* script = Script::cast(shared->script());
     rec->entry->set_script_id(script->id()->value());
     rec->entry->set_bailout_reason(
@@ -248,43 +248,22 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
 }
 
 
-void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
-                                  Code* code,
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
                                   SharedFunctionInfo* shared,
-                                  CompilationInfo* info,
-                                  Name* source, int line, int column) {
+                                  CompilationInfo* info, Name* script_name,
+                                  int line, int column) {
   if (FilterOutCodeCreateEvent(tag)) return;
   CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
   CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
   rec->start = code->address();
-  // Get line info from the relocation information.
-  ASSERT(Script::cast(shared->script()));
-  JITLineInfoTable line_table;
-  if (line > 0) {
-    for (RelocIterator it(code); !it.done(); it.next()) {
-      RelocInfo::Mode mode = it.rinfo()->rmode();
-      if (RelocInfo::IsPosition(mode)) {
-        int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address());
-        int position = static_cast<int>(it.rinfo()->data());
-        int lineno =
-          Script::cast(shared->script())->GetLineNumber(position) + 1;
-        if (position >= 0 && lineno > 0) {
-          line_table.SetPosition(pc_offset, lineno);
-        }
-      }
-    }
-  }
   rec->entry = profiles_->NewCodeEntry(
-      tag,
-      profiles_->GetFunctionName(shared->DebugName()),
-      CodeEntry::kEmptyNamePrefix,
-      profiles_->GetName(source),
-      line,
-      column,
-      line_table.entries()->length() ? &line_table : NULL);
+      tag, profiles_->GetFunctionName(shared->DebugName()),
+      CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line,
+      column);
   if (info) {
     rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
   }
+  DCHECK(Script::cast(shared->script()));
   Script* script = Script::cast(shared->script());
   rec->entry->set_script_id(script->id()->value());
   rec->size = code->ExecutableSize();
@@ -390,7 +369,7 @@ void CpuProfiler::SetterCallbackEvent(Name* name, Address entry_point) {
 
 CpuProfiler::CpuProfiler(Isolate* isolate)
     : isolate_(isolate),
-      sampling_interval_(TimeDelta::FromMicroseconds(
+      sampling_interval_(base::TimeDelta::FromMicroseconds(
           FLAG_cpu_profiler_sampling_interval)),
       profiles_(new CpuProfilesCollection(isolate->heap())),
       generator_(NULL),
@@ -404,7 +383,7 @@ CpuProfiler::CpuProfiler(Isolate* isolate,
                          ProfileGenerator* test_generator,
                          ProfilerEventsProcessor* test_processor)
     : isolate_(isolate),
-      sampling_interval_(TimeDelta::FromMicroseconds(
+      sampling_interval_(base::TimeDelta::FromMicroseconds(
           FLAG_cpu_profiler_sampling_interval)),
       profiles_(test_profiles),
       generator_(test_generator),
@@ -414,13 +393,13 @@ CpuProfiler::CpuProfiler(Isolate* isolate,
 
 
 CpuProfiler::~CpuProfiler() {
-  ASSERT(!is_profiling_);
+  DCHECK(!is_profiling_);
   delete profiles_;
 }
 
 
-void CpuProfiler::set_sampling_interval(TimeDelta value) {
-  ASSERT(!is_profiling_);
+void CpuProfiler::set_sampling_interval(base::TimeDelta value) {
+  DCHECK(!is_profiling_);
   sampling_interval_ = value;
 }
 
@@ -458,7 +437,7 @@ void CpuProfiler::StartProcessorIfNotStarted() {
       generator_, sampler, sampling_interval_);
   is_profiling_ = true;
   // Enumerate stuff we already have in the heap.
-  ASSERT(isolate_->heap()->HasBeenSetUp());
+  DCHECK(isolate_->heap()->HasBeenSetUp());
   if (!FLAG_prof_browser_mode) {
     logger->LogCodeObjects();
   }
@@ -514,7 +493,7 @@ void CpuProfiler::StopProcessor() {
 
 void CpuProfiler::LogBuiltins() {
   Builtins* builtins = isolate_->builtins();
-  ASSERT(builtins->is_initialized());
+  DCHECK(builtins->is_initialized());
   for (int i = 0; i < Builtins::builtin_count; i++) {
     CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN);
     ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;