From c58260cd505b9f5bbd5dc6309c8a8eed287a8538 Mon Sep 17 00:00:00 2001 From: "danno@chromium.org" Date: Wed, 15 May 2013 09:04:10 +0000 Subject: [PATCH] Ensure all maps gathered from the ICs are updated if deprecated. Add ASSERT to SmallMapList::Add to ensure no deprecated maps are ever added. BUG= R=danno@chromium.org Review URL: https://codereview.chromium.org/15179004 Patch from Toon Verwaest . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14675 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ast.h | 1 + src/type-info.cc | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/ast.h b/src/ast.h index a32540c..d697da7 100644 --- a/src/ast.h +++ b/src/ast.h @@ -286,6 +286,7 @@ class SmallMapList { } void Add(Handle handle, Zone* zone) { + ASSERT(!handle->is_deprecated()); list_.Add(handle.location(), zone); } diff --git a/src/type-info.cc b/src/type-info.cc index 1757bee..d52536e 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -192,13 +192,14 @@ Handle TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { Handle map_or_code = GetInfo(expr->PropertyFeedbackId()); if (map_or_code->IsCode()) { Handle code = Handle::cast(map_or_code); - Map* first_map = code->FindFirstMap(); - ASSERT(first_map != NULL); - return CanRetainOtherContext(first_map, *native_context_) + Handle first_map(code->FindFirstMap()); + ASSERT(!first_map.is_null()); + first_map = Map::CurrentMapForDeprecated(first_map); + return CanRetainOtherContext(*first_map, *native_context_) ? Handle::null() - : Handle(first_map); + : first_map; } - return Handle::cast(map_or_code); + return Map::CurrentMapForDeprecated(Handle::cast(map_or_code)); } @@ -208,13 +209,14 @@ Handle TypeFeedbackOracle::StoreMonomorphicReceiverType( Handle map_or_code = GetInfo(ast_id); if (map_or_code->IsCode()) { Handle code = Handle::cast(map_or_code); - Map* first_map = code->FindFirstMap(); - ASSERT(first_map != NULL); - return CanRetainOtherContext(first_map, *native_context_) + Handle first_map(code->FindFirstMap()); + ASSERT(!first_map.is_null()); + first_map = Map::CurrentMapForDeprecated(first_map); + return CanRetainOtherContext(*first_map, *native_context_) ? Handle::null() - : Handle(first_map); + : first_map; } - return Handle::cast(map_or_code); + return Map::CurrentMapForDeprecated(Handle::cast(map_or_code)); } @@ -223,7 +225,9 @@ Handle TypeFeedbackOracle::CompareNilMonomorphicReceiverType( Handle maybe_code = GetInfo(id); if (maybe_code->IsCode()) { Map* first_map = Handle::cast(maybe_code)->FindFirstMap(); - if (first_map != NULL) return Handle(first_map); + if (first_map != NULL) { + return Map::CurrentMapForDeprecated(Handle(first_map)); + } } return Handle(); } @@ -347,7 +351,8 @@ ElementsKind TypeFeedbackOracle::GetCallNewElementsKind(CallNew* expr) { Handle TypeFeedbackOracle::GetObjectLiteralStoreMap( ObjectLiteral::Property* prop) { ASSERT(ObjectLiteralStoreIsMonomorphic(prop)); - return Handle::cast(GetInfo(prop->key()->LiteralFeedbackId())); + return Map::CurrentMapForDeprecated( + Handle::cast(GetInfo(prop->key()->LiteralFeedbackId()))); } @@ -426,11 +431,12 @@ Handle TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) { if (state != CompareIC::KNOWN_OBJECT) { return Handle::null(); } - Map* first_map = code->FindFirstMap(); - ASSERT(first_map != NULL); - return CanRetainOtherContext(first_map, *native_context_) + Handle first_map(code->FindFirstMap()); + ASSERT(!first_map.is_null()); + first_map = Map::CurrentMapForDeprecated(first_map); + return CanRetainOtherContext(*first_map, *native_context_) ? Handle::null() - : Handle(first_map); + : first_map; } -- 2.7.4