Reviewers: loislo, Jakob,

Description:
Use stored Isolate pointer instead of Isolate::Current()

Fixed a couple of places where stored pointer to the isolate can be used instead
of reading from thread local storage.

BUG=None

Please review this at https://codereview.chromium.org/18418003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/cpu-profiler.h
  M src/cpu-profiler.cc
  M src/log.cc


Index: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index be64dd77ac93c041e919799b901aaf2709cb1556..b3800f58771af4383e97e2ceefd15afc67856af7 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -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: src/cpu-profiler.h
diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h
index 61d40f02aa1a67cac39c1c8754564116f8020ddd..77fdb0681ba871a79cb30af671a0b8d200a25bcc 100644
--- a/src/cpu-profiler.h
+++ b/src/cpu-profiler.h
@@ -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: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 82ce886fc9248cd31f49bca7e691b071bad4ff6c..7fd6cf47b715fff7ea87945f30cbb30ccf9fa786 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -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();
   }


--
--
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.


Reply via email to