From: vitalyr@chromium.org Date: Tue, 22 Mar 2011 19:15:02 +0000 (+0000) Subject: Some Isolate usage cleanups in objects.{h,cc}. X-Git-Tag: upstream/4.7.83~19844 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=41c7632a41a6da779647b8a4c953e9e7869ae626;p=platform%2Fupstream%2Fv8.git Some Isolate usage cleanups in objects.{h,cc}. Review URL: http://codereview.chromium.org/6723001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7312 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/objects-inl.h b/src/objects-inl.h index ca06590..922c054 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -1134,9 +1134,7 @@ Heap* HeapObject::GetHeap() { Isolate* HeapObject::GetIsolate() { - Isolate* i = GetHeap()->isolate(); - ASSERT(i == Isolate::Current()); - return i; + return GetHeap()->isolate(); } @@ -2815,6 +2813,11 @@ Code* Code::GetCodeFromTargetAddress(Address address) { } +Isolate* Map::isolate() { + return heap()->isolate(); +} + + Heap* Map::heap() { // NOTE: address() helper is not used to save one instruction. Heap* heap = Page::FromAddress(reinterpret_cast
(this))->heap_; @@ -2850,7 +2853,7 @@ MaybeObject* Map::GetFastElementsMap() { } Map* new_map = Map::cast(obj); new_map->set_has_fast_elements(true); - COUNTERS->map_slow_to_fast_elements()->Increment(); + isolate()->counters()->map_slow_to_fast_elements()->Increment(); return new_map; } @@ -2863,7 +2866,7 @@ MaybeObject* Map::GetSlowElementsMap() { } Map* new_map = Map::cast(obj); new_map->set_has_fast_elements(false); - COUNTERS->map_fast_to_slow_elements()->Increment(); + isolate()->counters()->map_fast_to_slow_elements()->Increment(); return new_map; } @@ -2878,7 +2881,7 @@ MaybeObject* Map::NewExternalArrayElementsMap() { Map* new_map = Map::cast(obj); new_map->set_has_fast_elements(false); new_map->set_has_external_array_elements(true); - COUNTERS->map_to_external_array_elements()->Increment(); + isolate()->counters()->map_to_external_array_elements()->Increment(); return new_map; } diff --git a/src/objects.cc b/src/objects.cc index da75147..a2b35ef 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1259,7 +1259,7 @@ MaybeObject* JSObject::AddFastProperty(String* name, Isolate* isolate = GetHeap()->isolate(); StringInputBuffer buffer(name); if (!isolate->scanner_constants()->IsIdentifier(&buffer) - && name != HEAP->hidden_symbol()) { + && name != isolate->heap()->hidden_symbol()) { Object* obj; { MaybeObject* maybe_obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); @@ -5211,8 +5211,6 @@ static inline bool CompareStringContentsPartial(Isolate* isolate, bool String::SlowEquals(String* other) { - Heap* heap = GetHeap(); - // Fast check: negative check with lengths. int len = length(); if (len != other->length()) return false; @@ -5239,7 +5237,7 @@ bool String::SlowEquals(String* other) { Vector(str2, len)); } - Isolate* isolate = heap->isolate(); + Isolate* isolate = GetIsolate(); if (lhs->IsFlat()) { if (lhs->IsAsciiRepresentation()) { Vector vec1 = lhs->ToAsciiVector(); diff --git a/src/objects.h b/src/objects.h index a5bac54..e0ea064 100644 --- a/src/objects.h +++ b/src/objects.h @@ -3776,7 +3776,8 @@ class Map: public HeapObject { inline int visitor_id(); inline void set_visitor_id(int visitor_id); - // Returns the heap this map belongs to. + // Returns the isolate/heap this map belongs to. + inline Isolate* isolate(); inline Heap* heap(); typedef void (*TraverseCallback)(Map* map, void* data);