Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: src/runtime/runtime-object.cc

Issue 1675223002: Mark maps having a hidden prototype rather than maps of hidden prototypes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 46ad21818e78f4940dd8594f34b91c54f1da6b87..9dbd410b2c76f30c209051d0c31ca79d9b6b6a72 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -158,10 +158,10 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
RUNTIME_FUNCTION(Runtime_GetPrototype) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
Handle<Object> prototype;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype,
- Object::GetPrototype(isolate, obj));
+ JSReceiver::GetPrototype(isolate, obj));
return *prototype;
}
@@ -576,11 +576,10 @@ static Object* HasOwnPropertyImplementation(Isolate* isolate,
// Handle hidden prototypes. If there's a hidden prototype above this thing
// then we have to check it for properties, because they are supposed to
// look like they are on this object.
- PrototypeIterator iter(isolate, object);
- if (!iter.IsAtEnd() &&
- PrototypeIterator::GetCurrent<HeapObject>(iter)
- ->map()
- ->is_hidden_prototype()) {
+ if (object->map()->has_hidden_prototype()) {
+ PrototypeIterator iter(isolate, object);
+ DCHECK(!iter.IsAtEnd());
+
// TODO(verwaest): The recursion is not necessary for keys that are array
// indices. Removing this.
// Casting to JSObject is fine because JSProxies are never used as
@@ -625,7 +624,7 @@ RUNTIME_FUNCTION(Runtime_HasOwnProperty) {
}
Map* map = js_obj->map();
if (!key_is_array_index && !map->has_named_interceptor() &&
- !HeapObject::cast(map->prototype())->map()->is_hidden_prototype()) {
+ !map->has_hidden_prototype()) {
return isolate->heap()->false_value();
}
// Slow case.
@@ -1247,7 +1246,9 @@ RUNTIME_FUNCTION(Runtime_InstanceOf) {
NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype));
}
// Return whether or not {prototype} is in the prototype chain of {object}.
- Maybe<bool> result = Object::HasInPrototypeChain(isolate, object, prototype);
+ Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
+ Maybe<bool> result =
+ JSReceiver::HasInPrototypeChain(isolate, receiver, prototype);
MAYBE_RETURN(result, isolate->heap()->exception());
return isolate->heap()->ToBoolean(result.FromJust());
}
@@ -1256,9 +1257,10 @@ RUNTIME_FUNCTION(Runtime_InstanceOf) {
RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
- CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
- Maybe<bool> result = Object::HasInPrototypeChain(isolate, object, prototype);
+ Maybe<bool> result =
+ JSReceiver::HasInPrototypeChain(isolate, object, prototype);
MAYBE_RETURN(result, isolate->heap()->exception());
return isolate->heap()->ToBoolean(result.FromJust());
}
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/string-stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698