A medium-sized code review. Reviewers: Sven Panne,

Description:
remove most Isolate::Current asserts

R=svenpa...@chromium.org
BUG=

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

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

Affected files +4, -27:
  M src/builtins.cc
  M src/compiler.h
  M src/debug.h
  M src/debug.cc
  M src/ic-inl.h
  M src/isolate.cc
  M src/mark-compact.cc
  M src/objects-inl.h
  M src/objects.h
  M src/regexp-macro-assembler.cc
  M src/regexp-stack.cc
  M src/runtime.cc
  M src/stub-cache.cc
  M src/v8.cc


Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index e488178af48479bb541edf0eb59514ec9e1ac925..b7fd83e4bca3db7ad52051c445559854ea42f957 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -132,7 +132,6 @@ BUILTIN_LIST_C(DEF_ARG_TYPE)
   MUST_USE_RESULT static MaybeObject* Builtin_##name(            \
       int args_length, Object** args_object, Isolate* isolate) { \
     name##ArgumentsType args(args_length, args_object);          \
-    ASSERT(isolate == Isolate::Current());                       \
     args.Verify();                                               \
     return Builtin_Impl_##name(args, isolate);                   \
   }                                                              \
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 98b93d301536a52dc05ebfdf2ed5b70deb7f4c01..a140343ffd963164cfb9a79bc9682c06554d1bf1 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -61,7 +61,6 @@ class CompilationInfo {
   virtual ~CompilationInfo();

   Isolate* isolate() {
-    ASSERT(Isolate::Current() == isolate_);
     return isolate_;
   }
   Zone* zone() { return zone_; }
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index d89dc29cb06870f5f76dc875466476b42eff5679..c82a2aa2e38ce693bf093b6295e5491c0b3c0063 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -3422,7 +3422,6 @@ static void StubMessageHandler2(const v8::Debug::Message& message) {

 bool Debugger::StartAgent(const char* name, int port,
                           bool wait_for_connection) {
-  ASSERT(Isolate::Current() == isolate_);
   if (wait_for_connection) {
     // Suspend V8 if it is already running or set V8 to suspend whenever
     // it starts.
@@ -3443,7 +3442,6 @@ bool Debugger::StartAgent(const char* name, int port,


 void Debugger::StopAgent() {
-  ASSERT(Isolate::Current() == isolate_);
   if (agent_ != NULL) {
     agent_->Shutdown();
     agent_->Join();
@@ -3454,7 +3452,6 @@ void Debugger::StopAgent() {


 void Debugger::WaitForAgent() {
-  ASSERT(Isolate::Current() == isolate_);
   if (agent_ != NULL)
     agent_->WaitUntilListening();
 }
@@ -3508,7 +3505,6 @@ EnterDebugger::EnterDebugger(Isolate* isolate)


 EnterDebugger::~EnterDebugger() {
-  ASSERT(Isolate::Current() == isolate_);
   Debug* debug = isolate_->debug();

   // Restore to the previous break state.
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index 0c24b904139a4f8e950cdda343a1f3ea5dca1fb2..85f7583495457eddb33340bbd1d46445fe2c243b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -990,7 +990,6 @@ class DisableBreak BASE_EMBEDDED {
     isolate_->debug()->set_disable_break(disable_break);
   }
   ~DisableBreak() {
-    ASSERT(Isolate::Current() == isolate_);
     isolate_->debug()->set_disable_break(prev_disable_break_);
   }

Index: src/ic-inl.h
diff --git a/src/ic-inl.h b/src/ic-inl.h
index ca02183dbdb6d17a4682a530ad4ea17bfe1d0d79..e6ff2daa62b5feb8b67b2cc4fb64a21f310cedef 100644
--- a/src/ic-inl.h
+++ b/src/ic-inl.h
@@ -43,7 +43,6 @@ Address IC::address() const {
   Address result = Assembler::target_address_from_return_address(pc());

 #ifdef ENABLE_DEBUGGER_SUPPORT
-  ASSERT(Isolate::Current() == isolate());
   Debug* debug = isolate()->debug();
// First check if any break points are active if not just return the address
   // of the call.
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 2c15717c7ac2a12f238eb0c859114a1d02169572..17762b2b0bf9b163cf405531ef97773e53e0495e 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2145,7 +2145,6 @@ void Isolate::InitializeDebugger() {

 bool Isolate::Init(Deserializer* des) {
   ASSERT(state_ != INITIALIZED);
-  ASSERT(Isolate::Current() == this);
   TRACE_ISOLATE(init);

   stress_deopt_count_ = FLAG_deopt_every_n_times;
@@ -2174,8 +2173,7 @@ bool Isolate::Init(Deserializer* des) {
   memory_allocator_ = new MemoryAllocator(this);
   code_range_ = new CodeRange(this);

-  // Safe after setting Heap::isolate_, initializing StackGuard and
-  // ensuring that Isolate::Current() == this.
+  // Safe after setting Heap::isolate_, and initializing StackGuard
   heap_.SetStackLimits();

 #define ASSIGN_ELEMENT(CamelName, hacker_name)                  \
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 7207f8d6378847d7f3da84b7da9ff5a1b142b602..b93460d9a7908efffda7af2468214370c3e4f248 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1408,7 +1408,7 @@ class MarkCompactMarkingVisitor
   INLINE(static void VisitUnmarkedObject(MarkCompactCollector* collector,
                                          HeapObject* obj)) {
 #ifdef DEBUG
-    ASSERT(Isolate::Current()->heap()->Contains(obj));
+    ASSERT(collector->heap()->Contains(obj));
     ASSERT(!HEAP->mark_compact_collector()->IsMarked(obj));
 #endif
     Map* map = obj->map();
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index fc5ed247ee5a86f38aa6a59794ace121fe538da4..ad0512f055b4b78a4d083d1151a0abef35eb842d 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1185,7 +1185,6 @@ Heap* HeapObject::GetHeap() {
   Heap* heap =
       MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap();
   ASSERT(heap != NULL);
-  ASSERT(heap->isolate() == Isolate::Current());
   return heap;
 }

@@ -6177,7 +6176,6 @@ SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)


 Relocatable::Relocatable(Isolate* isolate) {
-  ASSERT(isolate == Isolate::Current());
   isolate_ = isolate;
   prev_ = isolate->relocatable_top();
   isolate->set_relocatable_top(this);
@@ -6185,7 +6183,6 @@ Relocatable::Relocatable(Isolate* isolate) {


 Relocatable::~Relocatable() {
-  ASSERT(isolate_ == Isolate::Current());
   ASSERT_EQ(isolate_->relocatable_top(), this);
   isolate_->set_relocatable_top(prev_);
 }
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index f001feb12a7652d1e329c6d204e2e15fde2ab6fe..2053763a5139b9f19f852d457b9120c4f9e0785b 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1713,9 +1713,7 @@ class HeapObject: public Object {
   // The Heap the object was allocated in. Used also to access Isolate.
   inline Heap* GetHeap();

-  // Convenience method to get current isolate. This method can be
-  // accessed only when its result is the same as
-  // Isolate::Current(), it ASSERTs this. See also comment for GetHeap.
+  // Convenience method to get current isolate.
   inline Isolate* GetIsolate();

   // Converts an address to a HeapObject pointer.
Index: src/regexp-macro-assembler.cc
diff --git a/src/regexp-macro-assembler.cc b/src/regexp-macro-assembler.cc
index fa792768bc3b149f546fd7bc93e28de619838a76..7d027f880faff813e45b5d003ec73e9f72ab606e 100644
--- a/src/regexp-macro-assembler.cc
+++ b/src/regexp-macro-assembler.cc
@@ -163,7 +163,6 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute(
     int* output,
     int output_size,
     Isolate* isolate) {
-  ASSERT(isolate == Isolate::Current());
   // Ensure that the minimum stack has been allocated.
   RegExpStackScope stack_scope(isolate);
   Address stack_base = stack_scope.stack()->stack_base();
@@ -238,7 +237,6 @@ int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16(
     Address byte_offset2,
     size_t byte_length,
     Isolate* isolate) {
-  ASSERT(isolate == Isolate::Current());
   unibrow::Mapping<unibrow::Ecma262Canonicalize>* canonicalize =
       isolate->regexp_macro_assembler_canonicalize();
   // This function is not allowed to cause a garbage collection.
@@ -271,7 +269,6 @@ int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16(
 Address NativeRegExpMacroAssembler::GrowStack(Address stack_pointer,
                                               Address* stack_base,
                                               Isolate* isolate) {
-  ASSERT(isolate == Isolate::Current());
   RegExpStack* regexp_stack = isolate->regexp_stack();
   size_t size = regexp_stack->stack_capacity();
   Address old_stack_base = regexp_stack->stack_base();
Index: src/regexp-stack.cc
diff --git a/src/regexp-stack.cc b/src/regexp-stack.cc
index fc4114af5de202d49507b9be3a1902c43b3d1881..f3af490f1e4dde11fae72cb1f0b13f45bbbbffb0 100644
--- a/src/regexp-stack.cc
+++ b/src/regexp-stack.cc
@@ -39,7 +39,6 @@ RegExpStackScope::RegExpStackScope(Isolate* isolate)


 RegExpStackScope::~RegExpStackScope() {
-  ASSERT(Isolate::Current() == regexp_stack_->isolate_);
   // Reset the buffer if it has grown.
   regexp_stack_->Reset();
 }
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 350b9efbf53ff27fe6d5741de78b4c244ae20230..f51b6878244545df68437498b6039ec0f793664a 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -14602,7 +14602,6 @@ static const Runtime::Function kIntrinsicFunctions[] = {

 MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap,
Object* dictionary) {
-  ASSERT(Isolate::Current()->heap() == heap);
   ASSERT(dictionary != NULL);
   ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0);
   for (int i = 0; i < kNumFunctions; ++i) {
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index c7c6bc3543d33070e2490f550e0321153dfe5320..b312b1e078bceefc82a6ef8428fda5c2744f5678 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -45,9 +45,7 @@ namespace internal {


 StubCache::StubCache(Isolate* isolate)
-    : isolate_(isolate) {
-  ASSERT(isolate == Isolate::Current());
-}
+    : isolate_(isolate) { }


 void StubCache::Initialize() {
Index: src/v8.cc
diff --git a/src/v8.cc b/src/v8.cc
index 19dcddbb9b3209285e6fb8b7500c00c8f984adfa..9dea902309bdc04e687485c69f52861aa12fbd3d 100644
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -168,7 +168,6 @@ uint32_t V8::Random(Context* context) {
 // purposes. So, we keep a different state to prevent informations
 // leaks that could be used in an exploit.
 uint32_t V8::RandomPrivate(Isolate* isolate) {
-  ASSERT(isolate == Isolate::Current());
   return random_base(isolate->private_random_seed());
 }



--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to