Index: src/runtime/runtime-classes.cc |
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc |
index dedff928a79618606824127258f3c9d6930ceffa..95a65f53ad93646d8757a9a1596d4d842cf39efa 100644 |
--- a/src/runtime/runtime-classes.cc |
+++ b/src/runtime/runtime-classes.cc |
@@ -120,7 +120,8 @@ |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, prototype_parent, |
Runtime::GetObjectProperty(isolate, super_class, |
- isolate->factory()->prototype_string())); |
+ isolate->factory()->prototype_string(), |
+ SLOPPY)); |
if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) { |
THROW_NEW_ERROR_RETURN_FAILURE( |
isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, |
@@ -244,64 +245,87 @@ |
} |
-static Object* LoadFromSuper(Isolate* isolate, Handle<Object> receiver, |
- Handle<JSObject> home_object, Handle<Name> name) { |
+static MaybeHandle<Object> LoadFromSuper(Isolate* isolate, |
+ Handle<Object> receiver, |
+ Handle<JSObject> home_object, |
+ Handle<Name> name, |
+ LanguageMode language_mode) { |
if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { |
isolate->ReportFailedAccessCheck(home_object); |
- RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
+ RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
} |
PrototypeIterator iter(isolate, home_object); |
Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
- if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); |
+ if (!proto->IsJSReceiver()) { |
+ return Object::ReadAbsentProperty(isolate, proto, name, language_mode); |
+ } |
LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); |
Handle<Object> result; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); |
- return *result; |
-} |
- |
- |
-static Object* LoadElementFromSuper(Isolate* isolate, Handle<Object> receiver, |
- Handle<JSObject> home_object, |
- uint32_t index) { |
+ ASSIGN_RETURN_ON_EXCEPTION(isolate, result, |
+ Object::GetProperty(&it, language_mode), Object); |
+ return result; |
+} |
+ |
+ |
+static MaybeHandle<Object> LoadElementFromSuper(Isolate* isolate, |
+ Handle<Object> receiver, |
+ Handle<JSObject> home_object, |
+ uint32_t index, |
+ LanguageMode language_mode) { |
if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { |
isolate->ReportFailedAccessCheck(home_object); |
- RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
+ RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
} |
PrototypeIterator iter(isolate, home_object); |
Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
- if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); |
+ if (!proto->IsJSReceiver()) { |
+ Handle<Object> name = isolate->factory()->NewNumberFromUint(index); |
+ return Object::ReadAbsentProperty(isolate, proto, name, language_mode); |
+ } |
LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto)); |
Handle<Object> result; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); |
+ ASSIGN_RETURN_ON_EXCEPTION(isolate, result, |
+ Object::GetProperty(&it, language_mode), Object); |
+ return result; |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_LoadFromSuper) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 4); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); |
+ CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); |
+ CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 3); |
+ |
+ Handle<Object> result; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, |
+ LoadFromSuper(isolate, receiver, home_object, name, language_mode)); |
return *result; |
} |
-RUNTIME_FUNCTION(Runtime_LoadFromSuper) { |
- HandleScope scope(isolate); |
- DCHECK(args.length() == 3); |
- CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
- CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); |
- CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); |
- |
- return LoadFromSuper(isolate, receiver, home_object, name); |
-} |
- |
- |
RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) { |
HandleScope scope(isolate); |
- DCHECK(args.length() == 3); |
+ DCHECK(args.length() == 4); |
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); |
CONVERT_ARG_HANDLE_CHECKED(Object, key, 2); |
+ CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 3); |
uint32_t index = 0; |
+ Handle<Object> result; |
+ |
if (key->ToArrayIndex(&index)) { |
- return LoadElementFromSuper(isolate, receiver, home_object, index); |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, LoadElementFromSuper(isolate, receiver, home_object, |
+ index, language_mode)); |
+ return *result; |
} |
Handle<Name> name; |
@@ -309,9 +333,15 @@ |
Runtime::ToName(isolate, key)); |
// TODO(verwaest): Unify using LookupIterator. |
if (name->AsArrayIndex(&index)) { |
- return LoadElementFromSuper(isolate, receiver, home_object, index); |
- } |
- return LoadFromSuper(isolate, receiver, home_object, name); |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, LoadElementFromSuper(isolate, receiver, home_object, |
+ index, language_mode)); |
+ return *result; |
+ } |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, result, |
+ LoadFromSuper(isolate, receiver, home_object, name, language_mode)); |
+ return *result; |
} |