OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 789 |
790 RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) { | 790 RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) { |
791 HandleScope scope(isolate); | 791 HandleScope scope(isolate); |
792 ASSERT(args.length() == 5); | 792 ASSERT(args.length() == 5); |
793 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); | 793 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); |
794 CONVERT_SMI_ARG_CHECKED(arrayId, 1); | 794 CONVERT_SMI_ARG_CHECKED(arrayId, 1); |
795 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 2); | 795 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 2); |
796 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset_object, 3); | 796 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset_object, 3); |
797 CONVERT_ARG_HANDLE_CHECKED(Object, byte_length_object, 4); | 797 CONVERT_ARG_HANDLE_CHECKED(Object, byte_length_object, 4); |
798 | 798 |
| 799 ASSERT(holder->GetInternalFieldCount() == |
| 800 v8::ArrayBufferView::kInternalFieldCount); |
| 801 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { |
| 802 holder->SetInternalField(i, Smi::FromInt(0)); |
| 803 } |
| 804 |
799 ExternalArrayType arrayType; | 805 ExternalArrayType arrayType; |
800 size_t elementSize; | 806 size_t elementSize; |
801 switch (arrayId) { | 807 switch (arrayId) { |
802 case ARRAY_ID_UINT8: | 808 case ARRAY_ID_UINT8: |
803 arrayType = kExternalUnsignedByteArray; | 809 arrayType = kExternalUnsignedByteArray; |
804 elementSize = 1; | 810 elementSize = 1; |
805 break; | 811 break; |
806 case ARRAY_ID_INT8: | 812 case ARRAY_ID_INT8: |
807 arrayType = kExternalByteArray; | 813 arrayType = kExternalByteArray; |
808 elementSize = 1; | 814 elementSize = 1; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 | 1011 |
1006 | 1012 |
1007 RUNTIME_FUNCTION(MaybeObject*, Runtime_DataViewInitialize) { | 1013 RUNTIME_FUNCTION(MaybeObject*, Runtime_DataViewInitialize) { |
1008 HandleScope scope(isolate); | 1014 HandleScope scope(isolate); |
1009 ASSERT(args.length() == 4); | 1015 ASSERT(args.length() == 4); |
1010 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); | 1016 CONVERT_ARG_HANDLE_CHECKED(JSDataView, holder, 0); |
1011 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 1); | 1017 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 1); |
1012 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset, 2); | 1018 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset, 2); |
1013 CONVERT_ARG_HANDLE_CHECKED(Object, byte_length, 3); | 1019 CONVERT_ARG_HANDLE_CHECKED(Object, byte_length, 3); |
1014 | 1020 |
| 1021 ASSERT(holder->GetInternalFieldCount() == |
| 1022 v8::ArrayBufferView::kInternalFieldCount); |
| 1023 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { |
| 1024 holder->SetInternalField(i, Smi::FromInt(0)); |
| 1025 } |
| 1026 |
1015 holder->set_buffer(*buffer); | 1027 holder->set_buffer(*buffer); |
1016 ASSERT(byte_offset->IsNumber()); | 1028 ASSERT(byte_offset->IsNumber()); |
1017 ASSERT( | 1029 ASSERT( |
1018 NumberToSize(isolate, buffer->byte_length()) >= | 1030 NumberToSize(isolate, buffer->byte_length()) >= |
1019 NumberToSize(isolate, *byte_offset) | 1031 NumberToSize(isolate, *byte_offset) |
1020 + NumberToSize(isolate, *byte_length)); | 1032 + NumberToSize(isolate, *byte_length)); |
1021 holder->set_byte_offset(*byte_offset); | 1033 holder->set_byte_offset(*byte_offset); |
1022 ASSERT(byte_length->IsNumber()); | 1034 ASSERT(byte_length->IsNumber()); |
1023 holder->set_byte_length(*byte_length); | 1035 holder->set_byte_length(*byte_length); |
1024 | 1036 |
(...skipping 12921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13946 // Handle last resort GC and make sure to allow future allocations | 13958 // Handle last resort GC and make sure to allow future allocations |
13947 // to grow the heap without causing GCs (if possible). | 13959 // to grow the heap without causing GCs (if possible). |
13948 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13960 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13949 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13961 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13950 "Runtime::PerformGC"); | 13962 "Runtime::PerformGC"); |
13951 } | 13963 } |
13952 } | 13964 } |
13953 | 13965 |
13954 | 13966 |
13955 } } // namespace v8::internal | 13967 } } // namespace v8::internal |
OLD | NEW |