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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 */ | 1633 */ |
1634 | 1634 |
1635 if (target->IsJSObject()) { | 1635 if (target->IsJSObject()) { |
1636 return *isolate->factory()->ToBoolean( | 1636 return *isolate->factory()->ToBoolean( |
1637 JSObject::IsExtensible(Handle<JSObject>::cast(target))); | 1637 JSObject::IsExtensible(Handle<JSObject>::cast(target))); |
1638 } | 1638 } |
1639 return *isolate->factory()->false_value(); | 1639 return *isolate->factory()->false_value(); |
1640 } | 1640 } |
1641 | 1641 |
1642 | 1642 |
1643 // ES6 section 26.1.11 Reflect.ownKeys | |
1644 BUILTIN(ReflectOwnKeys) { | |
1645 HandleScope scope(isolate); | |
1646 DCHECK_EQ(2, args.length()); | |
1647 Handle<Object> target = args.at<Object>(1); | |
1648 | |
1649 if (!target->IsJSReceiver()) { | |
1650 THROW_NEW_ERROR_RETURN_FAILURE( | |
1651 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, | |
1652 isolate->factory()->NewStringFromAsciiChecked( | |
1653 "Reflect.ownKeys"))); | |
1654 } | |
1655 | |
1656 Handle<FixedArray> keys; | |
1657 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
1658 isolate, keys, | |
1659 JSReceiver::GetKeys(Handle<JSReceiver>::cast(target), | |
1660 JSReceiver::OWN_ONLY, INCLUDE_SYMBOLS, | |
1661 CONVERT_TO_STRING, IGNORE_ENUMERABILITY)); | |
1662 return *isolate->factory()->NewJSArrayWithElements(keys); | |
1663 } | |
1664 | |
1665 | |
1666 // ES6 section 26.1.12 Reflect.preventExtensions | 1643 // ES6 section 26.1.12 Reflect.preventExtensions |
1667 BUILTIN(ReflectPreventExtensions) { | 1644 BUILTIN(ReflectPreventExtensions) { |
1668 HandleScope scope(isolate); | 1645 HandleScope scope(isolate); |
1669 DCHECK_EQ(2, args.length()); | 1646 DCHECK_EQ(2, args.length()); |
1670 Handle<Object> target = args.at<Object>(1); | 1647 Handle<Object> target = args.at<Object>(1); |
1671 | 1648 |
1672 if (!target->IsJSReceiver()) { | 1649 if (!target->IsJSReceiver()) { |
1673 THROW_NEW_ERROR_RETURN_FAILURE( | 1650 THROW_NEW_ERROR_RETURN_FAILURE( |
1674 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, | 1651 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, |
1675 isolate->factory()->NewStringFromAsciiChecked( | 1652 isolate->factory()->NewStringFromAsciiChecked( |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2391 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
2415 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2392 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
2416 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2393 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
2417 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2394 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
2418 #undef DEFINE_BUILTIN_ACCESSOR_C | 2395 #undef DEFINE_BUILTIN_ACCESSOR_C |
2419 #undef DEFINE_BUILTIN_ACCESSOR_A | 2396 #undef DEFINE_BUILTIN_ACCESSOR_A |
2420 | 2397 |
2421 | 2398 |
2422 } // namespace internal | 2399 } // namespace internal |
2423 } // namespace v8 | 2400 } // namespace v8 |
OLD | NEW |