Commit 65c54c7a authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Change return type of TransitionsAccessor::FindTransitionToField().

... to MaybeHandle<Map> and add TransitionsAccessor::FindTransitionToDataProperty()
which will be used in follow-up CLs.

Bug: v8:7310
Change-Id: I98cc4fe16dc1ef335885101aa457f27c90ecf1a4
Reviewed-on: https://chromium-review.googlesource.com/968222Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52018}
parent 9b07e2ee
......@@ -419,9 +419,10 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonObject() {
key = ParseJsonString();
if (key.is_null()) return ReportUnexpectedCharacter();
target = TransitionsAccessor(map).FindTransitionToField(key);
// If a transition was found, follow it and continue.
transitioning = !target.is_null();
transitioning =
TransitionsAccessor(map).FindTransitionToField(key).ToHandle(
&target);
}
if (c0_ != ':') return ReportUnexpectedCharacter();
......
......@@ -303,15 +303,19 @@ bool TransitionsAccessor::IsSpecialTransition(Name* name) {
name == heap->strict_function_transition_symbol();
}
Handle<Map> TransitionsAccessor::FindTransitionToField(Handle<Name> name) {
MaybeHandle<Map> TransitionsAccessor::FindTransitionToDataProperty(
Handle<Name> name, RequestedLocation requested_location) {
DCHECK(name->IsUniqueName());
DisallowHeapAllocation no_gc;
Map* target = SearchTransition(*name, kData, NONE);
if (target == nullptr) return Handle<Map>::null();
PropertyAttributes attributes = name->IsPrivate() ? DONT_ENUM : NONE;
Map* target = SearchTransition(*name, kData, attributes);
if (target == nullptr) return MaybeHandle<Map>();
PropertyDetails details = target->GetLastDescriptorDetails();
DCHECK_EQ(NONE, details.attributes());
if (details.location() != kField) return Handle<Map>::null();
DCHECK_EQ(attributes, details.attributes());
DCHECK_EQ(kData, details.kind());
if (requested_location == kFieldOnly && details.location() != kField) {
return MaybeHandle<Map>();
}
return Handle<Map>(target);
}
......
......@@ -67,7 +67,13 @@ class TransitionsAccessor {
// or frozen/sealed transitions.
static bool IsSpecialTransition(Name* name);
Handle<Map> FindTransitionToField(Handle<Name> name);
enum RequestedLocation { kAnyLocation, kFieldOnly };
MaybeHandle<Map> FindTransitionToDataProperty(
Handle<Name> name, RequestedLocation requested_location = kAnyLocation);
MaybeHandle<Map> FindTransitionToField(Handle<Name> name) {
return FindTransitionToDataProperty(name, kFieldOnly);
}
Handle<String> ExpectedTransitionKey();
Handle<Map> ExpectedTransitionTarget();
......
......@@ -1913,9 +1913,9 @@ Maybe<uint32_t> ValueDeserializer::ReadJSObjectProperties(
key =
isolate_->factory()->InternalizeString(Handle<String>::cast(key));
// Don't reuse |transitions| because it could be stale.
target = TransitionsAccessor(map).FindTransitionToField(
Handle<String>::cast(key));
transitioning = !target.is_null();
transitioning = TransitionsAccessor(map)
.FindTransitionToField(Handle<String>::cast(key))
.ToHandle(&target);
} else {
transitioning = false;
}
......
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