Commit 7187d795 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[cleanup] Add DCHECKs to show the encoding in TransitionsAccessor Insert

As a drive-by, change an if(...) else UNREACHABLE into a CHECK(...).

Change-Id: I6440191c690f36444faa89ac0f7f7dde51ebba3f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2237143Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68369}
parent 10e713b6
......@@ -36,6 +36,7 @@ bool TransitionsAccessor::HasSimpleTransitionTo(Map map) {
void TransitionsAccessor::Insert(Handle<Name> name, Handle<Map> target,
SimpleTransitionFlag flag) {
DCHECK(!map_handle_.is_null());
DCHECK_NE(kPrototypeInfo, encoding());
target->SetBackPointer(map_);
// If the map doesn't have any transitions at all yet, install the new one.
......@@ -49,12 +50,14 @@ void TransitionsAccessor::Insert(Handle<Name> name, Handle<Map> target,
isolate_->factory()->NewTransitionArray(0, 1);
ReplaceTransitions(MaybeObject::FromObject(*result));
Reload();
DCHECK_EQ(kFullTransitionArray, encoding());
}
bool is_special_transition = flag == SPECIAL_TRANSITION;
// If the map has a simple transition, check if it should be overwritten.
Map simple_transition = GetSimpleTransition();
if (!simple_transition.is_null()) {
DCHECK_EQ(kWeakRef, encoding());
Name key = GetSimpleTransitionKey(simple_transition);
PropertyDetails old_details = GetSimpleTargetDetails(simple_transition);
PropertyDetails new_details = is_special_transition
......@@ -75,12 +78,9 @@ void TransitionsAccessor::Insert(Handle<Name> name, Handle<Map> target,
simple_transition = GetSimpleTransition();
if (!simple_transition.is_null()) {
DCHECK_EQ(*map, simple_transition);
if (encoding_ == kWeakRef) {
result->Set(0, GetSimpleTransitionKey(simple_transition),
HeapObjectReference::Weak(simple_transition));
} else {
UNREACHABLE();
}
DCHECK_EQ(kWeakRef, encoding());
result->Set(0, GetSimpleTransitionKey(simple_transition),
HeapObjectReference::Weak(simple_transition));
} else {
result->SetNumberOfTransitions(0);
}
......
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