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

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

Issue 1402973002: Move some code from Runtime_GetPrototype into a new Object::GetPrototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 3d02572a0e0cae4c6a8ef8defcc932bf035d36eb..4f55dafbc0f52cc77baeedae2b6a5669a5328fff 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -157,22 +157,7 @@ RUNTIME_FUNCTION(Runtime_GetPrototype) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
- // We don't expect access checks to be needed on JSProxy objects.
- DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
- PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
- Handle<Context> context(isolate->context());
- do {
- if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() &&
- !isolate->MayAccess(context,
- PrototypeIterator::GetCurrent<JSObject>(iter))) {
- return isolate->heap()->null_value();
- }
- iter.AdvanceIgnoringProxies();
- if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
- return *PrototypeIterator::GetCurrent(iter);
- }
- } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
- return *PrototypeIterator::GetCurrent(iter);
+ return *Object::GetPrototype(isolate, obj);
}
@@ -202,14 +187,12 @@ RUNTIME_FUNCTION(Runtime_SetPrototype) {
return isolate->heap()->undefined_value();
}
if (obj->map()->is_observed()) {
- Handle<Object> old_value =
- Object::GetPrototypeSkipHiddenPrototypes(isolate, obj);
+ Handle<Object> old_value = Object::GetPrototypeWithAccess(isolate, obj);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, JSObject::SetPrototype(obj, prototype, true));
- Handle<Object> new_value =
- Object::GetPrototypeSkipHiddenPrototypes(isolate, obj);
+ Handle<Object> new_value = Object::GetPrototypeWithAccess(isolate, obj);
if (!new_value->SameValue(*old_value)) {
RETURN_FAILURE_ON_EXCEPTION(
isolate, JSObject::EnqueueChangeRecord(

Powered by Google App Engine
This is Rietveld 408576698