Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index 18ecf8be49cc8fc903614164c1a747e70dd819e4..ea21d1ddd2c78393d6267a695201986e7fad721b 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -266,6 +266,31 @@ |
} |
+// ES6 19.1.2.6 |
+RUNTIME_FUNCTION(Runtime_GetOwnProperty) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 2); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, raw_name, 1); |
+ // 1. Let obj be ? ToObject(O). |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, object, |
+ Object::ToObject(isolate, object)); |
+ // 2. Let key be ? ToPropertyKey(P). |
+ Handle<Name> key; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, key, |
+ Object::ToName(isolate, raw_name)); |
+ |
+ // 3. Let desc be ? obj.[[GetOwnProperty]](key). |
+ PropertyDescriptor desc; |
+ Maybe<bool> found = JSReceiver::GetOwnPropertyDescriptor( |
+ isolate, Handle<JSReceiver>::cast(object), key, &desc); |
+ MAYBE_RETURN(found, isolate->heap()->exception()); |
+ // 4. Return FromPropertyDescriptor(desc). |
+ if (!found.FromJust()) return isolate->heap()->undefined_value(); |
+ return *desc.ToObject(isolate); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 2); |