| 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 822 |
| 823 size_t byte_offset = NumberToSize(isolate, *byte_offset_object); | 823 size_t byte_offset = NumberToSize(isolate, *byte_offset_object); |
| 824 size_t byte_length = NumberToSize(isolate, *byte_length_object); | 824 size_t byte_length = NumberToSize(isolate, *byte_length_object); |
| 825 ASSERT(byte_length % elementSize == 0); | 825 ASSERT(byte_length % elementSize == 0); |
| 826 size_t length = byte_length / elementSize; | 826 size_t length = byte_length / elementSize; |
| 827 | 827 |
| 828 holder->set_length( | 828 holder->set_length( |
| 829 *isolate->factory()->NewNumber(static_cast<double>(length))); | 829 *isolate->factory()->NewNumber(static_cast<double>(length))); |
| 830 Handle<ExternalArray> elements = | 830 Handle<ExternalArray> elements = |
| 831 isolate->factory()->NewExternalArray( | 831 isolate->factory()->NewExternalArray( |
| 832 length, arrayType, | 832 static_cast<int>(length), arrayType, |
| 833 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); | 833 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); |
| 834 Handle<Map> map = | 834 Handle<Map> map = |
| 835 isolate->factory()->GetElementsTransitionMap(holder, elementsKind); | 835 isolate->factory()->GetElementsTransitionMap(holder, elementsKind); |
| 836 holder->set_map(*map); | 836 holder->set_map(*map); |
| 837 holder->set_elements(*elements); | 837 holder->set_elements(*elements); |
| 838 return isolate->heap()->undefined_value(); | 838 return isolate->heap()->undefined_value(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 | 841 |
| 842 #define TYPED_ARRAY_GETTER(getter, accessor) \ | 842 #define TYPED_ARRAY_GETTER(getter, accessor) \ |
| (...skipping 12363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13206 // Handle last resort GC and make sure to allow future allocations | 13206 // Handle last resort GC and make sure to allow future allocations |
| 13207 // to grow the heap without causing GCs (if possible). | 13207 // to grow the heap without causing GCs (if possible). |
| 13208 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13208 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13209 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13209 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13210 "Runtime::PerformGC"); | 13210 "Runtime::PerformGC"); |
| 13211 } | 13211 } |
| 13212 } | 13212 } |
| 13213 | 13213 |
| 13214 | 13214 |
| 13215 } } // namespace v8::internal | 13215 } } // namespace v8::internal |
| OLD | NEW |