From b2e18ed47efb3d6429b2b713a361b2777cc7893e Mon Sep 17 00:00:00 2001 From: "vitalyr@chromium.org" Date: Mon, 21 Mar 2011 16:00:52 +0000 Subject: [PATCH] Clean up Isolate usages in handles.cc. Review URL: http://codereview.chromium.org/6713070 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7291 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/handles.cc | 72 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/src/handles.cc b/src/handles.cc index bcd79b0..97a06d9 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -132,14 +132,14 @@ Address HandleScope::current_limit_address() { Handle AddKeysFromJSArray(Handle content, Handle array) { - CALL_HEAP_FUNCTION(content->GetHeap()->isolate(), + CALL_HEAP_FUNCTION(content->GetIsolate(), content->AddKeysFromJSArray(*array), FixedArray); } Handle UnionOfKeys(Handle first, Handle second) { - CALL_HEAP_FUNCTION(first->GetHeap()->isolate(), + CALL_HEAP_FUNCTION(first->GetIsolate(), first->UnionOfKeys(*second), FixedArray); } @@ -148,7 +148,7 @@ Handle ReinitializeJSGlobalProxy( Handle constructor, Handle global) { CALL_HEAP_FUNCTION( - constructor->GetHeap()->isolate(), + constructor->GetIsolate(), constructor->GetHeap()->ReinitializeJSGlobalProxy(*constructor, *global), JSGlobalProxy); } @@ -174,7 +174,7 @@ void SetExpectedNofProperties(Handle func, int nof) { void SetPrototypeProperty(Handle func, Handle value) { - CALL_HEAP_FUNCTION_VOID(func->GetHeap()->isolate(), + CALL_HEAP_FUNCTION_VOID(func->GetIsolate(), func->SetPrototype(*value)); } @@ -207,7 +207,7 @@ void SetExpectedNofPropertiesFromEstimate(Handle shared, void NormalizeProperties(Handle object, PropertyNormalizationMode mode, int expected_additional_properties) { - CALL_HEAP_FUNCTION_VOID(object->GetHeap()->isolate(), + CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), object->NormalizeProperties( mode, expected_additional_properties)); @@ -215,7 +215,7 @@ void NormalizeProperties(Handle object, void NormalizeElements(Handle object) { - CALL_HEAP_FUNCTION_VOID(object->GetHeap()->isolate(), + CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), object->NormalizeElements()); } @@ -223,7 +223,7 @@ void NormalizeElements(Handle object) { void TransformToFastProperties(Handle object, int unused_property_fields) { CALL_HEAP_FUNCTION_VOID( - object->GetHeap()->isolate(), + object->GetIsolate(), object->TransformToFastProperties(unused_property_fields)); } @@ -250,7 +250,7 @@ Handle FlattenGetString(Handle string) { Handle SetPrototype(Handle function, Handle prototype) { ASSERT(function->should_have_prototype()); - CALL_HEAP_FUNCTION(function->GetHeap()->isolate(), + CALL_HEAP_FUNCTION(function->GetIsolate(), Accessors::FunctionSetPrototype(*function, *prototype, NULL), @@ -263,7 +263,7 @@ Handle SetProperty(Handle object, Handle value, PropertyAttributes attributes, StrictModeFlag strict_mode) { - CALL_HEAP_FUNCTION(object->GetHeap()->isolate(), + CALL_HEAP_FUNCTION(object->GetIsolate(), object->SetProperty(*key, *value, attributes, strict_mode), Object); } @@ -331,10 +331,11 @@ void SetLocalPropertyNoThrow(Handle object, Handle key, Handle value, PropertyAttributes attributes) { - ASSERT(!object->GetIsolate()->has_pending_exception()); + Isolate* isolate = object->GetIsolate(); + ASSERT(!isolate->has_pending_exception()); CHECK(!SetLocalPropertyIgnoreAttributes( object, key, value, attributes).is_null()); - CHECK(!object->GetIsolate()->has_pending_exception()); + CHECK(!isolate->has_pending_exception()); } @@ -411,7 +412,7 @@ Handle GetHiddenProperties(Handle obj, Isolate* isolate = obj->GetIsolate(); Object* holder = obj->BypassGlobalProxy(); if (holder->IsUndefined()) return isolate->factory()->undefined_value(); - obj = Handle(JSObject::cast(holder)); + obj = Handle(JSObject::cast(holder), isolate); if (obj->HasFastProperties()) { // If the object has fast properties, check whether the first slot @@ -423,7 +424,8 @@ Handle GetHiddenProperties(Handle obj, (descriptors->GetKey(0) == isolate->heap()->hidden_symbol()) && descriptors->IsProperty(0)) { ASSERT(descriptors->GetType(0) == FIELD); - return Handle(obj->FastPropertyAt(descriptors->GetFieldIndex(0))); + return Handle(obj->FastPropertyAt(descriptors->GetFieldIndex(0)), + isolate); } } @@ -536,19 +538,19 @@ static void ClearWrapperCache(Persistent handle, void*) { Proxy* proxy = Script::cast(wrapper->value())->wrapper(); ASSERT(proxy->proxy() == reinterpret_cast
(cache.location())); proxy->set_proxy(0); - Isolate::Current()->global_handles()->Destroy(cache.location()); - COUNTERS->script_wrappers()->Decrement(); + Isolate* isolate = Isolate::Current(); + isolate->global_handles()->Destroy(cache.location()); + isolate->counters()->script_wrappers()->Decrement(); } Handle GetScriptWrapper(Handle