OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1654 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1655 if (object->IsJSReceiver()) { | 1655 if (object->IsJSReceiver()) { |
1656 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), | 1656 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), |
1657 FROZEN, Object::THROW_ON_ERROR), | 1657 FROZEN, Object::THROW_ON_ERROR), |
1658 isolate->heap()->exception()); | 1658 isolate->heap()->exception()); |
1659 } | 1659 } |
1660 return *object; | 1660 return *object; |
1661 } | 1661 } |
1662 | 1662 |
1663 | 1663 |
| 1664 // ES6 section 19.1.2.6 Object.getOwnPropertyDescriptor ( O, P ) |
| 1665 BUILTIN(ObjectGetOwnPropertyDescriptor) { |
| 1666 HandleScope scope(isolate); |
| 1667 // 1. Let obj be ? ToObject(O). |
| 1668 Handle<Object> object = args.atOrUndefined(isolate, 1); |
| 1669 Handle<JSReceiver> receiver; |
| 1670 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
| 1671 Object::ToObject(isolate, object)); |
| 1672 // 2. Let key be ? ToPropertyKey(P). |
| 1673 Handle<Object> property = args.atOrUndefined(isolate, 2); |
| 1674 Handle<Name> key; |
| 1675 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, key, |
| 1676 Object::ToName(isolate, property)); |
| 1677 // 3. Let desc be ? obj.[[GetOwnProperty]](key). |
| 1678 PropertyDescriptor desc; |
| 1679 Maybe<bool> found = |
| 1680 JSReceiver::GetOwnPropertyDescriptor(isolate, receiver, key, &desc); |
| 1681 MAYBE_RETURN(found, isolate->heap()->exception()); |
| 1682 // 4. Return FromPropertyDescriptor(desc). |
| 1683 if (!found.FromJust()) return isolate->heap()->undefined_value(); |
| 1684 return *desc.ToObject(isolate); |
| 1685 } |
| 1686 |
| 1687 |
1664 namespace { | 1688 namespace { |
1665 | 1689 |
1666 Object* GetOwnPropertyKeys(Isolate* isolate, | 1690 Object* GetOwnPropertyKeys(Isolate* isolate, |
1667 BuiltinArguments<BuiltinExtraArguments::kNone> args, | 1691 BuiltinArguments<BuiltinExtraArguments::kNone> args, |
1668 PropertyFilter filter) { | 1692 PropertyFilter filter) { |
1669 HandleScope scope(isolate); | 1693 HandleScope scope(isolate); |
1670 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1694 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1671 Handle<JSReceiver> receiver; | 1695 Handle<JSReceiver> receiver; |
1672 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, | 1696 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
1673 Object::ToObject(isolate, object)); | 1697 Object::ToObject(isolate, object)); |
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4188 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4212 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4189 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4213 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4190 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4214 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4191 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4215 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4192 #undef DEFINE_BUILTIN_ACCESSOR_C | 4216 #undef DEFINE_BUILTIN_ACCESSOR_C |
4193 #undef DEFINE_BUILTIN_ACCESSOR_A | 4217 #undef DEFINE_BUILTIN_ACCESSOR_A |
4194 | 4218 |
4195 | 4219 |
4196 } // namespace internal | 4220 } // namespace internal |
4197 } // namespace v8 | 4221 } // namespace v8 |
OLD | NEW |