OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug.h" | 9 #include "src/debug.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 key->ToArrayIndex(&index); | 714 key->ToArrayIndex(&index); |
715 | 715 |
716 Handle<Object> result; | 716 Handle<Object> result; |
717 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 717 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
718 isolate, result, JSObject::SetElement(object, index, value, attrs, SLOPPY, | 718 isolate, result, JSObject::SetElement(object, index, value, attrs, SLOPPY, |
719 false, DEFINE_PROPERTY)); | 719 false, DEFINE_PROPERTY)); |
720 return *result; | 720 return *result; |
721 } | 721 } |
722 | 722 |
723 | 723 |
| 724 RUNTIME_FUNCTION(Runtime_AppendElement) { |
| 725 HandleScope scope(isolate); |
| 726 RUNTIME_ASSERT(args.length() == 2); |
| 727 |
| 728 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
| 729 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 730 |
| 731 int index = Smi::cast(array->length())->value(); |
| 732 |
| 733 Handle<Object> result; |
| 734 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 735 isolate, result, JSObject::SetElement(array, index, value, NONE, SLOPPY, |
| 736 false, DEFINE_PROPERTY)); |
| 737 return *array; |
| 738 } |
| 739 |
| 740 |
724 RUNTIME_FUNCTION(Runtime_DeleteProperty) { | 741 RUNTIME_FUNCTION(Runtime_DeleteProperty) { |
725 HandleScope scope(isolate); | 742 HandleScope scope(isolate); |
726 DCHECK(args.length() == 3); | 743 DCHECK(args.length() == 3); |
727 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 744 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
728 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); | 745 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
729 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 2); | 746 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 2); |
730 Handle<Object> result; | 747 Handle<Object> result; |
731 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 748 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
732 isolate, result, JSReceiver::DeleteProperty(object, key, language_mode)); | 749 isolate, result, JSReceiver::DeleteProperty(object, key, language_mode)); |
733 return *result; | 750 return *result; |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1578 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
1562 | 1579 |
1563 RETURN_FAILURE_ON_EXCEPTION( | 1580 RETURN_FAILURE_ON_EXCEPTION( |
1564 isolate, | 1581 isolate, |
1565 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1582 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
1566 setter, attrs)); | 1583 setter, attrs)); |
1567 return isolate->heap()->undefined_value(); | 1584 return isolate->heap()->undefined_value(); |
1568 } | 1585 } |
1569 } // namespace internal | 1586 } // namespace internal |
1570 } // namespace v8 | 1587 } // namespace v8 |
OLD | NEW |