Use stored Isolate pointer instead of Isolate::Current()
authoryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Jul 2013 15:44:30 +0000 (15:44 +0000)
committeryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Jul 2013 15:44:30 +0000 (15:44 +0000)
Fixed a couple of places where stored pointer to the isolate can be used instead of reading from thread local storage.

BUG=None
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/18418003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15457 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/cpu-profiler.cc
src/cpu-profiler.h
src/log.cc

index be64dd7..b3800f5 100644 (file)
@@ -62,10 +62,9 @@ void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) {
 }
 
 
-void ProfilerEventsProcessor::AddCurrentStack() {
+void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) {
   TickSampleEventRecord record(enqueue_order_);
   TickSample* sample = &record.sample;
-  Isolate* isolate = Isolate::Current();
   sample->state = isolate->current_vm_state();
   sample->pc = reinterpret_cast<Address>(sample);  // Not NULL.
   for (StackTraceFrameIterator it(isolate);
@@ -428,7 +427,7 @@ void CpuProfiler::StartProfiling(const char* title, bool record_samples) {
   if (profiles_->StartProfiling(title, next_profile_uid_++, record_samples)) {
     StartProcessorIfNotStarted();
   }
-  processor_->AddCurrentStack();
+  processor_->AddCurrentStack(isolate_);
 }
 
 
index 61d40f0..77fdb06 100644 (file)
@@ -161,7 +161,7 @@ class ProfilerEventsProcessor : public Thread {
   void Enqueue(const CodeEventsContainer& event);
 
   // Puts current stack into tick sample events buffer.
-  void AddCurrentStack();
+  void AddCurrentStack(Isolate* isolate);
 
   // Tick sample events are filled directly in the buffer of the circular
   // queue (because the structure is of fixed width, but usually not all
index 82ce886..7fd6cf4 100644 (file)
@@ -1041,7 +1041,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
   }
 
   if (!FLAG_log_code || !log_->IsEnabled()) return;
-  if (code == Isolate::Current()->builtins()->builtin(
+  if (code == isolate_->builtins()->builtin(
       Builtins::kLazyCompile))
     return;
 
@@ -1698,7 +1698,7 @@ void Logger::LogCompiledFunctions() {
   // During iteration, there can be heap allocation due to
   // GetScriptLineNumber call.
   for (int i = 0; i < compiled_funcs_count; ++i) {
-    if (*code_objects[i] == Isolate::Current()->builtins()->builtin(
+    if (*code_objects[i] == isolate_->builtins()->builtin(
         Builtins::kLazyCompile))
       continue;
     LogExistingFunction(sfis[i], code_objects[i]);
@@ -1778,7 +1778,7 @@ void Logger::SetCodeEventHandler(uint32_t options,
   code_event_handler_ = event_handler;
 
   if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) {
-    HandleScope scope(Isolate::Current());
+    HandleScope scope(isolate_);
     LogCodeObjects();
     LogCompiledFunctions();
   }