Commit 41c7632a authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

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
parent bb7f8fbe
...@@ -1134,9 +1134,7 @@ Heap* HeapObject::GetHeap() { ...@@ -1134,9 +1134,7 @@ Heap* HeapObject::GetHeap() {
Isolate* HeapObject::GetIsolate() { Isolate* HeapObject::GetIsolate() {
Isolate* i = GetHeap()->isolate(); return GetHeap()->isolate();
ASSERT(i == Isolate::Current());
return i;
} }
...@@ -2815,6 +2813,11 @@ Code* Code::GetCodeFromTargetAddress(Address address) { ...@@ -2815,6 +2813,11 @@ Code* Code::GetCodeFromTargetAddress(Address address) {
} }
Isolate* Map::isolate() {
return heap()->isolate();
}
Heap* Map::heap() { Heap* Map::heap() {
// NOTE: address() helper is not used to save one instruction. // NOTE: address() helper is not used to save one instruction.
Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_; Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_;
...@@ -2850,7 +2853,7 @@ MaybeObject* Map::GetFastElementsMap() { ...@@ -2850,7 +2853,7 @@ MaybeObject* Map::GetFastElementsMap() {
} }
Map* new_map = Map::cast(obj); Map* new_map = Map::cast(obj);
new_map->set_has_fast_elements(true); 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; return new_map;
} }
...@@ -2863,7 +2866,7 @@ MaybeObject* Map::GetSlowElementsMap() { ...@@ -2863,7 +2866,7 @@ MaybeObject* Map::GetSlowElementsMap() {
} }
Map* new_map = Map::cast(obj); Map* new_map = Map::cast(obj);
new_map->set_has_fast_elements(false); 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; return new_map;
} }
...@@ -2878,7 +2881,7 @@ MaybeObject* Map::NewExternalArrayElementsMap() { ...@@ -2878,7 +2881,7 @@ MaybeObject* Map::NewExternalArrayElementsMap() {
Map* new_map = Map::cast(obj); Map* new_map = Map::cast(obj);
new_map->set_has_fast_elements(false); new_map->set_has_fast_elements(false);
new_map->set_has_external_array_elements(true); 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; return new_map;
} }
......
...@@ -1259,7 +1259,7 @@ MaybeObject* JSObject::AddFastProperty(String* name, ...@@ -1259,7 +1259,7 @@ MaybeObject* JSObject::AddFastProperty(String* name,
Isolate* isolate = GetHeap()->isolate(); Isolate* isolate = GetHeap()->isolate();
StringInputBuffer buffer(name); StringInputBuffer buffer(name);
if (!isolate->scanner_constants()->IsIdentifier(&buffer) if (!isolate->scanner_constants()->IsIdentifier(&buffer)
&& name != HEAP->hidden_symbol()) { && name != isolate->heap()->hidden_symbol()) {
Object* obj; Object* obj;
{ MaybeObject* maybe_obj = { MaybeObject* maybe_obj =
NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
...@@ -5211,8 +5211,6 @@ static inline bool CompareStringContentsPartial(Isolate* isolate, ...@@ -5211,8 +5211,6 @@ static inline bool CompareStringContentsPartial(Isolate* isolate,
bool String::SlowEquals(String* other) { bool String::SlowEquals(String* other) {
Heap* heap = GetHeap();
// Fast check: negative check with lengths. // Fast check: negative check with lengths.
int len = length(); int len = length();
if (len != other->length()) return false; if (len != other->length()) return false;
...@@ -5239,7 +5237,7 @@ bool String::SlowEquals(String* other) { ...@@ -5239,7 +5237,7 @@ bool String::SlowEquals(String* other) {
Vector<const char>(str2, len)); Vector<const char>(str2, len));
} }
Isolate* isolate = heap->isolate(); Isolate* isolate = GetIsolate();
if (lhs->IsFlat()) { if (lhs->IsFlat()) {
if (lhs->IsAsciiRepresentation()) { if (lhs->IsAsciiRepresentation()) {
Vector<const char> vec1 = lhs->ToAsciiVector(); Vector<const char> vec1 = lhs->ToAsciiVector();
......
...@@ -3776,7 +3776,8 @@ class Map: public HeapObject { ...@@ -3776,7 +3776,8 @@ class Map: public HeapObject {
inline int visitor_id(); inline int visitor_id();
inline void set_visitor_id(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(); inline Heap* heap();
typedef void (*TraverseCallback)(Map* map, void* data); typedef void (*TraverseCallback)(Map* map, void* data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment