Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: src/builtins.cc

Issue 1405243006: [es6] Partially implement Reflect.ownKeys. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reland 1405243006: [es6] Partially implement Reflect.ownKeys. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 */ 1631 */
1632 1632
1633 if (target->IsJSObject()) { 1633 if (target->IsJSObject()) {
1634 return *isolate->factory()->ToBoolean( 1634 return *isolate->factory()->ToBoolean(
1635 JSObject::IsExtensible(Handle<JSObject>::cast(target))); 1635 JSObject::IsExtensible(Handle<JSObject>::cast(target)));
1636 } 1636 }
1637 return *isolate->factory()->false_value(); 1637 return *isolate->factory()->false_value();
1638 } 1638 }
1639 1639
1640 1640
1641 // ES6 section 26.1.11 Reflect.ownKeys
1642 BUILTIN(ReflectOwnKeys) {
1643 HandleScope scope(isolate);
1644 DCHECK_EQ(2, args.length());
1645 Handle<Object> target = args.at<Object>(1);
1646
1647 if (!target->IsJSReceiver()) {
1648 THROW_NEW_ERROR_RETURN_FAILURE(
1649 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject,
1650 isolate->factory()->NewStringFromAsciiChecked(
1651 "Reflect.ownKeys")));
1652 }
1653
1654 Handle<FixedArray> keys;
1655 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1656 isolate, keys,
1657 JSReceiver::GetKeys(Handle<JSReceiver>::cast(target),
1658 JSReceiver::OWN_ONLY, INCLUDE_SYMBOLS,
1659 CONVERT_TO_STRING, IGNORE_ENUMERABILITY));
1660 return *isolate->factory()->NewJSArrayWithElements(keys);
1661 }
1662
1663
1641 // ES6 section 26.1.12 Reflect.preventExtensions 1664 // ES6 section 26.1.12 Reflect.preventExtensions
1642 BUILTIN(ReflectPreventExtensions) { 1665 BUILTIN(ReflectPreventExtensions) {
1643 HandleScope scope(isolate); 1666 HandleScope scope(isolate);
1644 DCHECK_EQ(2, args.length()); 1667 DCHECK_EQ(2, args.length());
1645 Handle<Object> target = args.at<Object>(1); 1668 Handle<Object> target = args.at<Object>(1);
1646 1669
1647 if (!target->IsJSReceiver()) { 1670 if (!target->IsJSReceiver()) {
1648 THROW_NEW_ERROR_RETURN_FAILURE( 1671 THROW_NEW_ERROR_RETURN_FAILURE(
1649 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, 1672 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject,
1650 isolate->factory()->NewStringFromAsciiChecked( 1673 isolate->factory()->NewStringFromAsciiChecked(
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 2412 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
2390 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 2413 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
2391 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 2414 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
2392 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 2415 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
2393 #undef DEFINE_BUILTIN_ACCESSOR_C 2416 #undef DEFINE_BUILTIN_ACCESSOR_C
2394 #undef DEFINE_BUILTIN_ACCESSOR_A 2417 #undef DEFINE_BUILTIN_ACCESSOR_A
2395 2418
2396 2419
2397 } // namespace internal 2420 } // namespace internal
2398 } // namespace v8 2421 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698