[runtime] Refactor ToPropertyDescriptorFastPath to use Handle<Map>
Change-Id: I8d0b270c2cba54f9e4246997cc907daf15dfbbb0 Bug: chromium:1086798 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2222340 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Victor Gomes <victorgomes@chromium.org> Cr-Commit-Position: refs/heads/master@{#68072}
This commit is contained in:
parent
79db180b50
commit
0a25442140
@ -43,29 +43,29 @@ bool GetPropertyIfPresent(Handle<JSReceiver> receiver, Handle<String> name,
|
||||
bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
|
||||
PropertyDescriptor* desc) {
|
||||
if (!obj->IsJSObject()) return false;
|
||||
Map map = Handle<JSObject>::cast(obj)->map();
|
||||
if (map.instance_type() != JS_OBJECT_TYPE) return false;
|
||||
if (map.is_access_check_needed()) return false;
|
||||
if (map.prototype() != *isolate->initial_object_prototype()) return false;
|
||||
Handle<Map> map(Handle<JSObject>::cast(obj)->map(), isolate);
|
||||
if (map->instance_type() != JS_OBJECT_TYPE) return false;
|
||||
if (map->is_access_check_needed()) return false;
|
||||
if (map->prototype() != *isolate->initial_object_prototype()) return false;
|
||||
// During bootstrapping, the object_function_prototype_map hasn't been
|
||||
// set up yet.
|
||||
if (isolate->bootstrapper()->IsActive()) return false;
|
||||
if (JSObject::cast(map.prototype()).map() !=
|
||||
if (JSObject::cast(map->prototype()).map() !=
|
||||
isolate->native_context()->object_function_prototype_map()) {
|
||||
return false;
|
||||
}
|
||||
// TODO(jkummerow): support dictionary properties?
|
||||
if (map.is_dictionary_map()) return false;
|
||||
if (map->is_dictionary_map()) return false;
|
||||
Handle<DescriptorArray> descs =
|
||||
Handle<DescriptorArray>(map.instance_descriptors(), isolate);
|
||||
for (InternalIndex i : map.IterateOwnDescriptors()) {
|
||||
Handle<DescriptorArray>(map->instance_descriptors(), isolate);
|
||||
for (InternalIndex i : map->IterateOwnDescriptors()) {
|
||||
PropertyDetails details = descs->GetDetails(i);
|
||||
Handle<Object> value;
|
||||
if (details.location() == kField) {
|
||||
if (details.kind() == kData) {
|
||||
value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj),
|
||||
details.representation(),
|
||||
FieldIndex::ForDescriptor(map, i));
|
||||
FieldIndex::ForDescriptor(*map, i));
|
||||
} else {
|
||||
DCHECK_EQ(kAccessor, details.kind());
|
||||
// Bail out to slow path.
|
||||
|
Loading…
Reference in New Issue
Block a user