From a23caf9f71d47d50da696ac523444e2c22779c85 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Wed, 20 Mar 2013 13:12:33 +0000 Subject: [PATCH] Explicitly pass the isolate to create handles in ic.cc Review URL: https://chromiumcodereview.appspot.com/12704015 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14007 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ic.cc | 48 +++++++++++++++++++++++++++--------------------- tools/grokdump.py | 2 +- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/ic.cc b/src/ic.cc index 2c3a488..c1d11bb 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -160,7 +160,7 @@ Address IC::OriginalCodeAddress() const { // Find the function on the stack and both the active code for the // function and the original code. JSFunction* function = JSFunction::cast(frame->function()); - Handle shared(function->shared()); + Handle shared(function->shared(), isolate()); Code* code = shared->code(); ASSERT(Debug::HasDebugInfo(shared)); Code* original_code = Debug::GetDebugInfo(shared)->original_code(); @@ -435,7 +435,7 @@ static void LookupForRead(Handle object, return; } - Handle holder(lookup->holder()); + Handle holder(lookup->holder(), lookup->isolate()); if (HasInterceptorGetter(*holder)) { return; } @@ -446,7 +446,7 @@ static void LookupForRead(Handle object, return; } - Handle proto(holder->GetPrototype(), name->GetIsolate()); + Handle proto(holder->GetPrototype(), lookup->isolate()); if (proto->IsNull()) { ASSERT(!lookup->IsFound()); return; @@ -636,7 +636,7 @@ Handle CallICBase::ComputeMonomorphicStub(LookupResult* lookup, Handle object, Handle name) { int argc = target()->arguments_count(); - Handle holder(lookup->holder()); + Handle holder(lookup->holder(), isolate()); switch (lookup->type()) { case FIELD: { PropertyIndex index = lookup->GetFieldIndex(); @@ -647,7 +647,7 @@ Handle CallICBase::ComputeMonomorphicStub(LookupResult* lookup, // Get the constant function and compute the code stub for this // call; used for rewriting to monomorphic state and making sure // that the code stub is in the stub cache. - Handle function(lookup->GetConstantFunction()); + Handle function(lookup->GetConstantFunction(), isolate()); return isolate()->stub_cache()->ComputeCallConstant( argc, kind_, extra_state, name, object, holder, function); } @@ -658,7 +658,8 @@ Handle CallICBase::ComputeMonomorphicStub(LookupResult* lookup, if (holder->IsGlobalObject()) { Handle global = Handle::cast(holder); - Handle cell(global->GetPropertyCell(lookup)); + Handle cell( + global->GetPropertyCell(lookup), isolate()); if (!cell->value()->IsJSFunction()) return Handle::null(); Handle function(JSFunction::cast(cell->value())); return isolate()->stub_cache()->ComputeCallGlobal( @@ -746,7 +747,8 @@ void CallICBase::UpdateCaches(LookupResult* lookup, // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. Handle cache_object = object->IsJSObject() ? Handle::cast(object) - : Handle(JSObject::cast(object->GetPrototype(isolate()))); + : Handle(JSObject::cast(object->GetPrototype(isolate())), + isolate()); // Update the stub cache. UpdateMegamorphicCache(cache_object->map(), *name, *code); break; @@ -1196,7 +1198,8 @@ Handle LoadIC::ComputeLoadHandler(LookupResult* lookup, case NORMAL: if (holder->IsGlobalObject()) { Handle global = Handle::cast(holder); - Handle cell(global->GetPropertyCell(lookup)); + Handle cell( + global->GetPropertyCell(lookup), isolate()); return isolate()->stub_cache()->ComputeLoadGlobal( name, receiver, global, cell, lookup->IsDontDelete()); } @@ -1272,7 +1275,7 @@ Handle KeyedLoadIC::LoadElementStub(Handle receiver) { return generic_stub(); } - Handle receiver_map(receiver->map()); + Handle receiver_map(receiver->map(), isolate()); MapHandleList target_receiver_maps; if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { // Optimistically assume that ICs that haven't reached the MONOMORPHIC state @@ -1283,7 +1286,8 @@ Handle KeyedLoadIC::LoadElementStub(Handle receiver) { if (target() == *string_stub()) { target_receiver_maps.Add(isolate()->factory()->string_map()); } else { - GetReceiverMapsForStub(Handle(target()), &target_receiver_maps); + GetReceiverMapsForStub(Handle(target(), isolate()), + &target_receiver_maps); if (target_receiver_maps.length() == 0) { return isolate()->stub_cache()->ComputeKeyedLoadElement(receiver_map); } @@ -1380,13 +1384,13 @@ Handle KeyedLoadIC::ComputeLoadHandler(LookupResult* lookup, if (!lookup->IsProperty()) return Handle::null(); // Compute a monomorphic stub. - Handle holder(lookup->holder()); + Handle holder(lookup->holder(), isolate()); switch (lookup->type()) { case FIELD: return isolate()->stub_cache()->ComputeKeyedLoadField( name, receiver, holder, lookup->GetFieldIndex()); case CONSTANT_FUNCTION: { - Handle constant(lookup->GetConstantFunction()); + Handle constant(lookup->GetConstantFunction(), isolate()); return isolate()->stub_cache()->ComputeKeyedLoadConstant( name, receiver, holder, constant); } @@ -1579,7 +1583,8 @@ Handle StoreIC::ComputeStoreMonomorphic(LookupResult* lookup, // from the property cell. So the property must be directly on the // global object. Handle global = Handle::cast(receiver); - Handle cell(global->GetPropertyCell(lookup)); + Handle cell( + global->GetPropertyCell(lookup), isolate()); return isolate()->stub_cache()->ComputeStoreGlobal( name, global, cell, strict_mode); } @@ -1596,8 +1601,8 @@ Handle StoreIC::ComputeStoreMonomorphic(LookupResult* lookup, return isolate()->stub_cache()->ComputeStoreCallback( name, receiver, holder, info, strict_mode); } else if (callback->IsAccessorPair()) { - Handle setter(Handle::cast(callback)->setter(), - isolate()); + Handle setter( + Handle::cast(callback)->setter(), isolate()); if (!setter->IsJSFunction()) break; if (holder->IsGlobalObject()) break; if (!holder->HasFastProperties()) break; @@ -1618,7 +1623,7 @@ Handle StoreIC::ComputeStoreMonomorphic(LookupResult* lookup, case CONSTANT_FUNCTION: break; case TRANSITION: { - Handle transition(lookup->GetTransitionTarget()); + Handle transition(lookup->GetTransitionTarget(), isolate()); int descriptor = transition->LastAdded(); DescriptorArray* target_descriptors = transition->instance_descriptors(); @@ -1663,7 +1668,7 @@ Handle KeyedStoreIC::StoreElementStub(Handle receiver, } State ic_state = target()->ic_state(); - Handle receiver_map(receiver->map()); + Handle receiver_map(receiver->map(), isolate()); if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { // Optimistically assume that ICs that haven't reached the MONOMORPHIC state // yet will do so and stay there. @@ -1799,7 +1804,7 @@ Handle KeyedStoreIC::ComputeTransitionedMap( case STORE_NO_TRANSITION_HANDLE_COW: case STANDARD_STORE: case STORE_AND_GROW_NO_TRANSITION: - return Handle(receiver->map()); + return Handle(receiver->map(), isolate()); } return Handle::null(); } @@ -1962,7 +1967,7 @@ Handle KeyedStoreIC::ComputeStoreMonomorphic(LookupResult* lookup, name, receiver, lookup->GetFieldIndex().field_index(), Handle::null(), strict_mode); case TRANSITION: { - Handle transition(lookup->GetTransitionTarget()); + Handle transition(lookup->GetTransitionTarget(), isolate()); int descriptor = transition->LastAdded(); DescriptorArray* target_descriptors = transition->instance_descriptors(); @@ -2041,7 +2046,7 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_Miss) { if (raw_function->is_compiled()) return raw_function; - Handle function(raw_function); + Handle function(raw_function, isolate); JSFunction::CompileLazy(function, CLEAR_EXCEPTION); return *function; } @@ -2701,7 +2706,8 @@ void CompareIC::UpdateCaches(Handle x, Handle y) { HasInlinedSmiCode(address()), x, y); ICCompareStub stub(op_, new_left, new_right, state); if (state == KNOWN_OBJECT) { - stub.set_known_map(Handle(Handle::cast(x)->map())); + stub.set_known_map( + Handle(Handle::cast(x)->map(), isolate())); } set_target(*stub.GetCode(isolate())); diff --git a/tools/grokdump.py b/tools/grokdump.py index b19da1e..f3ae8a2 100755 --- a/tools/grokdump.py +++ b/tools/grokdump.py @@ -1933,7 +1933,7 @@ class InspectionShell(cmd.Cmd): Print a descriptor array in a readable format. """ start = int(address, 16) - if ((start & 1) == 1): start = start + 1 + if ((start & 1) == 1): start = start - 1 DescriptorArray(FixedArray(self.heap, None, start)).Print(Printer()) def do_do_map(self, address): -- 2.7.4