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 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1595 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1596 Maybe<bool> result = object->IsJSReceiver() | 1596 Maybe<bool> result = object->IsJSReceiver() |
1597 ? JSReceiver::TestIntegrityLevel( | 1597 ? JSReceiver::TestIntegrityLevel( |
1598 Handle<JSReceiver>::cast(object), SEALED) | 1598 Handle<JSReceiver>::cast(object), SEALED) |
1599 : Just(true); | 1599 : Just(true); |
1600 MAYBE_RETURN(result, isolate->heap()->exception()); | 1600 MAYBE_RETURN(result, isolate->heap()->exception()); |
1601 return isolate->heap()->ToBoolean(result.FromJust()); | 1601 return isolate->heap()->ToBoolean(result.FromJust()); |
1602 } | 1602 } |
1603 | 1603 |
1604 | 1604 |
| 1605 // ES6 section 19.1.2.14 Object.keys ( O ) |
| 1606 BUILTIN(ObjectKeys) { |
| 1607 HandleScope scope(isolate); |
| 1608 Handle<Object> object = args.atOrUndefined(isolate, 1); |
| 1609 Handle<JSReceiver> receiver; |
| 1610 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
| 1611 Execution::ToObject(isolate, object)); |
| 1612 Handle<FixedArray> keys; |
| 1613 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1614 isolate, keys, |
| 1615 JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY, ENUMERABLE_STRINGS, |
| 1616 CONVERT_TO_STRING)); |
| 1617 return *isolate->factory()->NewJSArrayWithElements(keys); |
| 1618 } |
| 1619 |
| 1620 |
1605 // ES6 section 19.1.2.15 Object.preventExtensions ( O ) | 1621 // ES6 section 19.1.2.15 Object.preventExtensions ( O ) |
1606 BUILTIN(ObjectPreventExtensions) { | 1622 BUILTIN(ObjectPreventExtensions) { |
1607 HandleScope scope(isolate); | 1623 HandleScope scope(isolate); |
1608 Handle<Object> object = args.atOrUndefined(isolate, 1); | 1624 Handle<Object> object = args.atOrUndefined(isolate, 1); |
1609 if (object->IsJSReceiver()) { | 1625 if (object->IsJSReceiver()) { |
1610 MAYBE_RETURN(JSReceiver::PreventExtensions(Handle<JSReceiver>::cast(object), | 1626 MAYBE_RETURN(JSReceiver::PreventExtensions(Handle<JSReceiver>::cast(object), |
1611 Object::THROW_ON_ERROR), | 1627 Object::THROW_ON_ERROR), |
1612 isolate->heap()->exception()); | 1628 isolate->heap()->exception()); |
1613 } | 1629 } |
1614 return *object; | 1630 return *object; |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3311 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 3327 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
3312 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 3328 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
3313 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 3329 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
3314 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 3330 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
3315 #undef DEFINE_BUILTIN_ACCESSOR_C | 3331 #undef DEFINE_BUILTIN_ACCESSOR_C |
3316 #undef DEFINE_BUILTIN_ACCESSOR_A | 3332 #undef DEFINE_BUILTIN_ACCESSOR_A |
3317 | 3333 |
3318 | 3334 |
3319 } // namespace internal | 3335 } // namespace internal |
3320 } // namespace v8 | 3336 } // namespace v8 |
OLD | NEW |