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}
This commit is contained in:
verwaest 2015-02-23 10:25:38 -08:00 committed by Commit bot
parent 3a8e496fa4
commit 74c0cdbf76
3 changed files with 13 additions and 30 deletions

View File

@ -74,7 +74,7 @@ Handle<Code> PropertyHandlerCompiler::GetCode(Code::Kind kind,
Handle<Name> name) { Handle<Name> name) {
Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder()); Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder());
Handle<Code> code = GetCodeWithFlags(flags, name); Handle<Code> code = GetCodeWithFlags(flags, name);
PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code, *name)); PROFILE(isolate(), CodeCreateEvent(Logger::HANDLER_TAG, *code, *name));
#ifdef DEBUG #ifdef DEBUG
code->VerifyEmbeddedObjects(); code->VerifyEmbeddedObjects();
#endif #endif

View File

@ -2931,30 +2931,7 @@ Handle<Map> Map::GeneralizeAllFieldRepresentations(
// static // static
MaybeHandle<Map> Map::TryUpdate(Handle<Map> map) { MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) {
Handle<Map> proto_map(map);
while (proto_map->prototype()->IsJSObject()) {
Handle<JSObject> holder(JSObject::cast(proto_map->prototype()));
proto_map = Handle<Map>(holder->map());
if (proto_map->is_deprecated() && JSObject::TryMigrateInstance(holder)) {
proto_map = Handle<Map>(holder->map());
}
}
return TryUpdateInternal(map);
}
// static
Handle<Map> Map::Update(Handle<Map> 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> Map::TryUpdateInternal(Handle<Map> old_map) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); DisallowDeoptimization no_deoptimization(old_map->GetIsolate());
@ -3018,6 +2995,15 @@ MaybeHandle<Map> Map::TryUpdateInternal(Handle<Map> old_map) {
} }
// static
Handle<Map> Map::Update(Handle<Map> map) {
if (!map->is_deprecated()) return map;
return ReconfigureProperty(map, -1, kData, NONE, Representation::None(),
HeapType::None(map->GetIsolate()),
ALLOW_IN_DESCRIPTOR);
}
MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(LookupIterator* it, MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
Handle<Object> value) { Handle<Object> value) {
Handle<Name> name = it->name(); Handle<Name> name = it->name();

View File

@ -6068,12 +6068,9 @@ class Map: public HeapObject {
// Returns a non-deprecated version of the input. If the input was not // Returns a non-deprecated version of the input. If the input was not
// deprecated, it is directly returned. Otherwise, the non-deprecated version // deprecated, it is directly returned. Otherwise, the non-deprecated version
// is found by re-transitioning from the root of the transition tree using the // 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. // descriptor array of the map. Returns MaybeHandle<Map>() if no updated map
// This method also applies any pending migrations along the prototype chain. // is found.
static MaybeHandle<Map> TryUpdate(Handle<Map> map) WARN_UNUSED_RESULT; static MaybeHandle<Map> TryUpdate(Handle<Map> map) WARN_UNUSED_RESULT;
// Same as above, but does not touch the prototype chain.
static MaybeHandle<Map> TryUpdateInternal(Handle<Map> map)
WARN_UNUSED_RESULT;
// Returns a non-deprecated version of the input. This method may deprecate // Returns a non-deprecated version of the input. This method may deprecate
// existing maps along the way if encodings conflict. Not for use while // existing maps along the way if encodings conflict. Not for use while