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
This commit is contained in:
vitalyr@chromium.org 2011-03-22 19:15:02 +00:00
parent bb7f8fbec6
commit 41c7632a41
3 changed files with 13 additions and 11 deletions

View File

@ -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<Address>(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;
}

View File

@ -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<const char>(str2, len));
}
Isolate* isolate = heap->isolate();
Isolate* isolate = GetIsolate();
if (lhs->IsFlat()) {
if (lhs->IsAsciiRepresentation()) {
Vector<const char> vec1 = lhs->ToAsciiVector();

View File

@ -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);