From 74c0cdbf762ff42f3d39c21329e468c451d7c564 Mon Sep 17 00:00:00 2001 From: verwaest Date: Mon, 23 Feb 2015 10:25:38 -0800 Subject: [PATCH] Prototype objects never share their map, and hence cannot be in deprecated state. Review URL: https://codereview.chromium.org/955433002 Cr-Commit-Position: refs/heads/master@{#26802} --- src/ic/handler-compiler.cc | 2 +- src/objects.cc | 34 ++++++++++------------------------ src/objects.h | 7 ++----- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index 4fd61b4f41..15dc941503 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -74,7 +74,7 @@ Handle PropertyHandlerCompiler::GetCode(Code::Kind kind, Handle name) { Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder()); Handle code = GetCodeWithFlags(flags, name); - PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, *name)); + PROFILE(isolate(), CodeCreateEvent(Logger::HANDLER_TAG, *code, *name)); #ifdef DEBUG code->VerifyEmbeddedObjects(); #endif diff --git a/src/objects.cc b/src/objects.cc index ea4b6644c1..7a3490286a 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -2931,30 +2931,7 @@ Handle Map::GeneralizeAllFieldRepresentations( // static -MaybeHandle Map::TryUpdate(Handle map) { - Handle proto_map(map); - while (proto_map->prototype()->IsJSObject()) { - Handle holder(JSObject::cast(proto_map->prototype())); - proto_map = Handle(holder->map()); - if (proto_map->is_deprecated() && JSObject::TryMigrateInstance(holder)) { - proto_map = Handle(holder->map()); - } - } - return TryUpdateInternal(map); -} - - -// static -Handle Map::Update(Handle map) { - if (!map->is_deprecated()) return map; - return ReconfigureProperty(map, -1, kData, NONE, Representation::None(), - HeapType::None(map->GetIsolate()), - ALLOW_IN_DESCRIPTOR); -} - - -// static -MaybeHandle Map::TryUpdateInternal(Handle old_map) { +MaybeHandle Map::TryUpdate(Handle old_map) { DisallowHeapAllocation no_allocation; DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); @@ -3018,6 +2995,15 @@ MaybeHandle Map::TryUpdateInternal(Handle old_map) { } +// static +Handle Map::Update(Handle map) { + if (!map->is_deprecated()) return map; + return ReconfigureProperty(map, -1, kData, NONE, Representation::None(), + HeapType::None(map->GetIsolate()), + ALLOW_IN_DESCRIPTOR); +} + + MaybeHandle JSObject::SetPropertyWithInterceptor(LookupIterator* it, Handle value) { Handle name = it->name(); diff --git a/src/objects.h b/src/objects.h index d4af4a6255..8b6f1e2e62 100644 --- a/src/objects.h +++ b/src/objects.h @@ -6068,12 +6068,9 @@ class Map: public HeapObject { // Returns a non-deprecated version of the input. If the input was not // deprecated, it is directly returned. Otherwise, the non-deprecated version // is found by re-transitioning from the root of the transition tree using the - // descriptor array of the map. Returns NULL if no updated map is found. - // This method also applies any pending migrations along the prototype chain. + // descriptor array of the map. Returns MaybeHandle() if no updated map + // is found. static MaybeHandle TryUpdate(Handle map) WARN_UNUSED_RESULT; - // Same as above, but does not touch the prototype chain. - static MaybeHandle TryUpdateInternal(Handle map) - WARN_UNUSED_RESULT; // Returns a non-deprecated version of the input. This method may deprecate // existing maps along the way if encodings conflict. Not for use while