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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 | 1526 |
1527 Handle<Object> result; | 1527 Handle<Object> result; |
1528 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1528 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1529 isolate, result, Object::GetPropertyOrElement( | 1529 isolate, result, Object::GetPropertyOrElement( |
1530 Handle<JSReceiver>::cast(target), name, receiver)); | 1530 Handle<JSReceiver>::cast(target), name, receiver)); |
1531 | 1531 |
1532 return *result; | 1532 return *result; |
1533 } | 1533 } |
1534 | 1534 |
1535 | 1535 |
| 1536 // ES6 section 26.1.7 Reflect.getOwnPropertyDescriptor |
| 1537 BUILTIN(ReflectGetOwnPropertyDescriptor) { |
| 1538 HandleScope scope(isolate); |
| 1539 DCHECK_EQ(3, args.length()); |
| 1540 Handle<Object> target = args.at<Object>(1); |
| 1541 Handle<Object> key = args.at<Object>(2); |
| 1542 |
| 1543 if (!target->IsJSReceiver()) { |
| 1544 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1545 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, |
| 1546 isolate->factory()->NewStringFromAsciiChecked( |
| 1547 "Reflect.getOwnPropertyDescriptor"))); |
| 1548 } |
| 1549 |
| 1550 Handle<Name> name; |
| 1551 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, |
| 1552 Object::ToName(isolate, key)); |
| 1553 |
| 1554 PropertyDescriptor desc; |
| 1555 bool found = JSReceiver::GetOwnPropertyDescriptor( |
| 1556 isolate, Handle<JSReceiver>::cast(target), name, &desc); |
| 1557 if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
| 1558 if (!found) return isolate->heap()->undefined_value(); |
| 1559 return *desc.ToObject(isolate); |
| 1560 } |
| 1561 |
| 1562 |
1536 // ES6 section 26.1.8 Reflect.getPrototypeOf | 1563 // ES6 section 26.1.8 Reflect.getPrototypeOf |
1537 BUILTIN(ReflectGetPrototypeOf) { | 1564 BUILTIN(ReflectGetPrototypeOf) { |
1538 HandleScope scope(isolate); | 1565 HandleScope scope(isolate); |
1539 DCHECK_EQ(2, args.length()); | 1566 DCHECK_EQ(2, args.length()); |
1540 Handle<Object> target = args.at<Object>(1); | 1567 Handle<Object> target = args.at<Object>(1); |
1541 | 1568 |
1542 if (!target->IsJSReceiver()) { | 1569 if (!target->IsJSReceiver()) { |
1543 THROW_NEW_ERROR_RETURN_FAILURE( | 1570 THROW_NEW_ERROR_RETURN_FAILURE( |
1544 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, | 1571 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, |
1545 isolate->factory()->NewStringFromAsciiChecked( | 1572 isolate->factory()->NewStringFromAsciiChecked( |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2326 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
2300 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2327 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
2301 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2328 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
2302 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2329 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
2303 #undef DEFINE_BUILTIN_ACCESSOR_C | 2330 #undef DEFINE_BUILTIN_ACCESSOR_C |
2304 #undef DEFINE_BUILTIN_ACCESSOR_A | 2331 #undef DEFINE_BUILTIN_ACCESSOR_A |
2305 | 2332 |
2306 | 2333 |
2307 } // namespace internal | 2334 } // namespace internal |
2308 } // namespace v8 | 2335 } // namespace v8 |
OLD | NEW |