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

Side by Side Diff: src/builtins.cc

Issue 1605803002: [runtime] Migrate Object.getOwnPropertyNames to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ObjectGetOwnPropertyDescriptor
Patch Set: REBASE Created 4 years, 11 months 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/js/v8natives.js » ('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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698