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

Side by Side Diff: src/builtins.cc

Issue 1609173002: Revert of [runtime] Migrate Object.getOwnPropertyNames to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ObjectGetOwnPropertyDescriptor
Patch Set: 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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 PropertyDescriptor desc; 1583 PropertyDescriptor desc;
1584 Maybe<bool> found = 1584 Maybe<bool> found =
1585 JSReceiver::GetOwnPropertyDescriptor(isolate, receiver, key, &desc); 1585 JSReceiver::GetOwnPropertyDescriptor(isolate, receiver, key, &desc);
1586 MAYBE_RETURN(found, isolate->heap()->exception()); 1586 MAYBE_RETURN(found, isolate->heap()->exception());
1587 // 4. Return FromPropertyDescriptor(desc). 1587 // 4. Return FromPropertyDescriptor(desc).
1588 if (!found.FromJust()) return isolate->heap()->undefined_value(); 1588 if (!found.FromJust()) return isolate->heap()->undefined_value();
1589 return *desc.ToObject(isolate); 1589 return *desc.ToObject(isolate);
1590 } 1590 }
1591 1591
1592 1592
1593 namespace { 1593 // ES6 section 19.1.2.8 Object.getOwnPropertySymbols ( O )
1594 1594 BUILTIN(ObjectGetOwnPropertySymbols) {
1595 Object* GetOwnPropertyKeys(Isolate* isolate,
1596 BuiltinArguments<BuiltinExtraArguments::kNone> args,
1597 PropertyFilter filter) {
1598 HandleScope scope(isolate); 1595 HandleScope scope(isolate);
1599 Handle<Object> object = args.atOrUndefined(isolate, 1); 1596 Handle<Object> object = args.atOrUndefined(isolate, 1);
1600 Handle<JSReceiver> receiver; 1597 Handle<JSReceiver> receiver;
1601 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, 1598 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver,
1602 Object::ToObject(isolate, object)); 1599 Object::ToObject(isolate, object));
1603 Handle<FixedArray> keys; 1600 Handle<FixedArray> keys;
1604 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1601 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1605 isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY, filter, 1602 isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY,
1606 CONVERT_TO_STRING)); 1603 SKIP_STRINGS, CONVERT_TO_STRING));
1607 return *isolate->factory()->NewJSArrayWithElements(keys); 1604 return *isolate->factory()->NewJSArrayWithElements(keys);
1608 } 1605 }
1609 1606
1610 } // namespace
1611 1607
1612
1613 // ES6 section 19.1.2.7 Object.getOwnPropertyNames ( O )
1614 BUILTIN(ObjectGetOwnPropertyNames) {
1615 return GetOwnPropertyKeys(isolate, args, SKIP_SYMBOLS);
1616 }
1617
1618
1619 // ES6 section 19.1.2.8 Object.getOwnPropertySymbols ( O )
1620 BUILTIN(ObjectGetOwnPropertySymbols) {
1621 return GetOwnPropertyKeys(isolate, args, SKIP_STRINGS);
1622 }
1623
1624
1625 // ES6 section 19.1.2.11 Object.isExtensible ( O ) 1608 // ES6 section 19.1.2.11 Object.isExtensible ( O )
1626 BUILTIN(ObjectIsExtensible) { 1609 BUILTIN(ObjectIsExtensible) {
1627 HandleScope scope(isolate); 1610 HandleScope scope(isolate);
1628 Handle<Object> object = args.atOrUndefined(isolate, 1); 1611 Handle<Object> object = args.atOrUndefined(isolate, 1);
1629 Maybe<bool> result = 1612 Maybe<bool> result =
1630 object->IsJSReceiver() 1613 object->IsJSReceiver()
1631 ? JSReceiver::IsExtensible(Handle<JSReceiver>::cast(object)) 1614 ? JSReceiver::IsExtensible(Handle<JSReceiver>::cast(object))
1632 : Just(false); 1615 : Just(false);
1633 MAYBE_RETURN(result, isolate->heap()->exception()); 1616 MAYBE_RETURN(result, isolate->heap()->exception());
1634 return isolate->heap()->ToBoolean(result.FromJust()); 1617 return isolate->heap()->ToBoolean(result.FromJust());
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
4022 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 4005 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
4023 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 4006 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
4024 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 4007 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
4025 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 4008 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
4026 #undef DEFINE_BUILTIN_ACCESSOR_C 4009 #undef DEFINE_BUILTIN_ACCESSOR_C
4027 #undef DEFINE_BUILTIN_ACCESSOR_A 4010 #undef DEFINE_BUILTIN_ACCESSOR_A
4028 4011
4029 4012
4030 } // namespace internal 4013 } // namespace internal
4031 } // namespace v8 4014 } // 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