Commit 9cb8ad14 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[in-place weak refs prework] Enhance DCHECKs for handler types.

BUG=v8:7308

Change-Id: I5bc2faea374f116d3916b71465c34a84bd14f74f
Reviewed-on: https://chromium-review.googlesource.com/1019501Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52695}
parent 8bf73830
...@@ -674,6 +674,7 @@ bool FeedbackNexus::ConfigureLexicalVarMode(int script_context_index, ...@@ -674,6 +674,7 @@ bool FeedbackNexus::ConfigureLexicalVarMode(int script_context_index,
void FeedbackNexus::ConfigureHandlerMode(Handle<Object> handler) { void FeedbackNexus::ConfigureHandlerMode(Handle<Object> handler) {
DCHECK(IsGlobalICKind(kind())); DCHECK(IsGlobalICKind(kind()));
DCHECK(IC::IsHandler(*handler));
SetFeedback(GetIsolate()->heap()->empty_weak_cell()); SetFeedback(GetIsolate()->heap()->empty_weak_cell());
SetFeedbackExtra(*handler); SetFeedbackExtra(*handler);
} }
...@@ -722,6 +723,7 @@ float FeedbackNexus::ComputeCallFrequency() { ...@@ -722,6 +723,7 @@ float FeedbackNexus::ComputeCallFrequency() {
void FeedbackNexus::ConfigureMonomorphic(Handle<Name> name, void FeedbackNexus::ConfigureMonomorphic(Handle<Name> name,
Handle<Map> receiver_map, Handle<Map> receiver_map,
Handle<Object> handler) { Handle<Object> handler) {
DCHECK(handler.is_null() || IC::IsHandler(*handler));
Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
if (kind() == FeedbackSlotKind::kStoreDataPropertyInLiteral) { if (kind() == FeedbackSlotKind::kStoreDataPropertyInLiteral) {
SetFeedback(*cell); SetFeedback(*cell);
...@@ -742,6 +744,7 @@ void FeedbackNexus::ConfigureMonomorphic(Handle<Name> name, ...@@ -742,6 +744,7 @@ void FeedbackNexus::ConfigureMonomorphic(Handle<Name> name,
void FeedbackNexus::ConfigurePolymorphic(Handle<Name> name, void FeedbackNexus::ConfigurePolymorphic(Handle<Name> name,
MapHandles const& maps, MapHandles const& maps,
ObjectHandles* handlers) { ObjectHandles* handlers) {
DCHECK_EQ(handlers->size(), maps.size());
int receiver_count = static_cast<int>(maps.size()); int receiver_count = static_cast<int>(maps.size());
DCHECK_GT(receiver_count, 1); DCHECK_GT(receiver_count, 1);
Handle<FixedArray> array; Handle<FixedArray> array;
...@@ -755,6 +758,7 @@ void FeedbackNexus::ConfigurePolymorphic(Handle<Name> name, ...@@ -755,6 +758,7 @@ void FeedbackNexus::ConfigurePolymorphic(Handle<Name> name,
} }
for (int current = 0; current < receiver_count; ++current) { for (int current = 0; current < receiver_count; ++current) {
DCHECK(IC::IsHandler(*handlers->at(current)));
Handle<Map> map = maps[current]; Handle<Map> map = maps[current];
Handle<WeakCell> cell = Map::WeakCellForMap(map); Handle<WeakCell> cell = Map::WeakCellForMap(map);
array->set(current * 2, *cell); array->set(current * 2, *cell);
......
...@@ -42,7 +42,11 @@ Address IC::raw_constant_pool() const { ...@@ -42,7 +42,11 @@ Address IC::raw_constant_pool() const {
bool IC::IsHandler(Object* object) { bool IC::IsHandler(Object* object) {
return (object->IsSmi() && (object != nullptr)) || object->IsDataHandler() || return (object->IsSmi() && (object != nullptr)) || object->IsDataHandler() ||
object->IsWeakCell() || object->IsCode(); (object->IsWeakCell() &&
(WeakCell::cast(object)->cleared() ||
WeakCell::cast(object)->value()->IsMap() ||
WeakCell::cast(object)->value()->IsPropertyCell())) ||
object->IsCode();
} }
bool IC::AddressIsDeoptimizedCode() const { bool IC::AddressIsDeoptimizedCode() const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment