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 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 THROW_NEW_ERROR_RETURN_FAILURE( | 1493 THROW_NEW_ERROR_RETURN_FAILURE( |
1494 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, | 1494 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, |
1495 isolate->factory()->NewStringFromAsciiChecked( | 1495 isolate->factory()->NewStringFromAsciiChecked( |
1496 "Reflect.deleteProperty"))); | 1496 "Reflect.deleteProperty"))); |
1497 } | 1497 } |
1498 | 1498 |
1499 Handle<Name> name; | 1499 Handle<Name> name; |
1500 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, | 1500 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, |
1501 Object::ToName(isolate, key)); | 1501 Object::ToName(isolate, key)); |
1502 | 1502 |
1503 Handle<Object> result; | 1503 Maybe<bool> result = JSReceiver::DeletePropertyOrElement( |
1504 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1504 Handle<JSReceiver>::cast(target), name, SLOPPY); |
1505 isolate, result, JSReceiver::DeletePropertyOrElement( | 1505 MAYBE_RETURN(result, isolate->heap()->exception()); |
1506 Handle<JSReceiver>::cast(target), name)); | 1506 return *isolate->factory()->ToBoolean(result.FromJust()); |
1507 | |
1508 return *result; | |
1509 } | 1507 } |
1510 | 1508 |
1511 | 1509 |
1512 // ES6 section 26.1.6 Reflect.get | 1510 // ES6 section 26.1.6 Reflect.get |
1513 BUILTIN(ReflectGet) { | 1511 BUILTIN(ReflectGet) { |
1514 HandleScope scope(isolate); | 1512 HandleScope scope(isolate); |
1515 Handle<Object> undef = isolate->factory()->undefined_value(); | 1513 Handle<Object> undef = isolate->factory()->undefined_value(); |
1516 Handle<Object> target = args.length() > 1 ? args.at<Object>(1) : undef; | 1514 Handle<Object> target = args.length() > 1 ? args.at<Object>(1) : undef; |
1517 Handle<Object> key = args.length() > 2 ? args.at<Object>(2) : undef; | 1515 Handle<Object> key = args.length() > 2 ? args.at<Object>(2) : undef; |
1518 Handle<Object> receiver = args.length() > 3 ? args.at<Object>(3) : target; | 1516 Handle<Object> receiver = args.length() > 3 ? args.at<Object>(3) : target; |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2402 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2400 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
2403 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2401 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
2404 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2402 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
2405 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2403 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
2406 #undef DEFINE_BUILTIN_ACCESSOR_C | 2404 #undef DEFINE_BUILTIN_ACCESSOR_C |
2407 #undef DEFINE_BUILTIN_ACCESSOR_A | 2405 #undef DEFINE_BUILTIN_ACCESSOR_A |
2408 | 2406 |
2409 | 2407 |
2410 } // namespace internal | 2408 } // namespace internal |
2411 } // namespace v8 | 2409 } // namespace v8 |
OLD | NEW |