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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1559 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1560 if (object->IsJSReceiver()) { | 1560 if (object->IsJSReceiver()) { |
1561 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), | 1561 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), |
1562 FROZEN, Object::THROW_ON_ERROR), | 1562 FROZEN, Object::THROW_ON_ERROR), |
1563 isolate->heap()->exception()); | 1563 isolate->heap()->exception()); |
1564 } | 1564 } |
1565 return *object; | 1565 return *object; |
1566 } | 1566 } |
1567 | 1567 |
1568 | 1568 |
1569 // ES6 section 19.1.2.8 Object.getOwnPropertySymbols ( O ) | 1569 namespace { |
1570 BUILTIN(ObjectGetOwnPropertySymbols) { | 1570 |
| 1571 Object* GetOwnPropertyKeys(Isolate* isolate, |
| 1572 BuiltinArguments<BuiltinExtraArguments::kNone> args, |
| 1573 PropertyFilter filter) { |
1571 HandleScope scope(isolate); | 1574 HandleScope scope(isolate); |
1572 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1575 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1573 Handle<JSReceiver> receiver; | 1576 Handle<JSReceiver> receiver; |
1574 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, | 1577 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
1575 Object::ToObject(isolate, object)); | 1578 Object::ToObject(isolate, object)); |
1576 Handle<FixedArray> keys; | 1579 Handle<FixedArray> keys; |
1577 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1580 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1578 isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY, | 1581 isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY, filter, |
1579 SKIP_STRINGS, CONVERT_TO_STRING)); | 1582 CONVERT_TO_STRING)); |
1580 return *isolate->factory()->NewJSArrayWithElements(keys); | 1583 return *isolate->factory()->NewJSArrayWithElements(keys); |
1581 } | 1584 } |
1582 | 1585 |
| 1586 } // namespace |
| 1587 |
| 1588 |
| 1589 // ES6 section 19.1.2.7 Object.getOwnPropertyNames ( O ) |
| 1590 BUILTIN(ObjectGetOwnPropertyNames) { |
| 1591 return GetOwnPropertyKeys(isolate, args, SKIP_SYMBOLS); |
| 1592 } |
| 1593 |
| 1594 |
| 1595 // ES6 section 19.1.2.8 Object.getOwnPropertySymbols ( O ) |
| 1596 BUILTIN(ObjectGetOwnPropertySymbols) { |
| 1597 return GetOwnPropertyKeys(isolate, args, SKIP_STRINGS); |
| 1598 } |
| 1599 |
1583 | 1600 |
1584 // ES6 section 19.1.2.11 Object.isExtensible ( O ) | 1601 // ES6 section 19.1.2.11 Object.isExtensible ( O ) |
1585 BUILTIN(ObjectIsExtensible) { | 1602 BUILTIN(ObjectIsExtensible) { |
1586 HandleScope scope(isolate); | 1603 HandleScope scope(isolate); |
1587 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1604 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1588 Maybe<bool> result = | 1605 Maybe<bool> result = |
1589 object->IsJSReceiver() | 1606 object->IsJSReceiver() |
1590 ? JSReceiver::IsExtensible(Handle<JSReceiver>::cast(object)) | 1607 ? JSReceiver::IsExtensible(Handle<JSReceiver>::cast(object)) |
1591 : Just(false); | 1608 : Just(false); |
1592 MAYBE_RETURN(result, isolate->heap()->exception()); | 1609 MAYBE_RETURN(result, isolate->heap()->exception()); |
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3981 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 3998 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
3982 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 3999 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
3983 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4000 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
3984 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4001 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
3985 #undef DEFINE_BUILTIN_ACCESSOR_C | 4002 #undef DEFINE_BUILTIN_ACCESSOR_C |
3986 #undef DEFINE_BUILTIN_ACCESSOR_A | 4003 #undef DEFINE_BUILTIN_ACCESSOR_A |
3987 | 4004 |
3988 | 4005 |
3989 } // namespace internal | 4006 } // namespace internal |
3990 } // namespace v8 | 4007 } // namespace v8 |
OLD | NEW |