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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } | 669 } |
670 | 670 |
671 | 671 |
672 bool Runtime::SetupArrayBuffer(Isolate* isolate, | 672 bool Runtime::SetupArrayBuffer(Isolate* isolate, |
673 Handle<JSArrayBuffer> array_buffer, | 673 Handle<JSArrayBuffer> array_buffer, |
674 void* data, | 674 void* data, |
675 size_t allocated_length) { | 675 size_t allocated_length) { |
676 array_buffer->set_backing_store(data); | 676 array_buffer->set_backing_store(data); |
677 | 677 |
678 Handle<Object> byte_length = | 678 Handle<Object> byte_length = |
679 isolate->factory()->NewNumber(static_cast<double>(allocated_length)); | 679 isolate->factory()->NewNumberFromSize(allocated_length); |
680 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); | 680 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); |
681 array_buffer->set_byte_length(*byte_length); | 681 array_buffer->set_byte_length(*byte_length); |
682 return true; | 682 return true; |
683 } | 683 } |
684 | 684 |
685 | 685 |
686 bool Runtime::SetupArrayBufferAllocatingData( | 686 bool Runtime::SetupArrayBufferAllocatingData( |
687 Isolate* isolate, | 687 Isolate* isolate, |
688 Handle<JSArrayBuffer> array_buffer, | 688 Handle<JSArrayBuffer> array_buffer, |
689 size_t allocated_length) { | 689 size_t allocated_length) { |
(...skipping 12805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13495 // Handle last resort GC and make sure to allow future allocations | 13495 // Handle last resort GC and make sure to allow future allocations |
13496 // to grow the heap without causing GCs (if possible). | 13496 // to grow the heap without causing GCs (if possible). |
13497 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13497 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13498 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13498 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13499 "Runtime::PerformGC"); | 13499 "Runtime::PerformGC"); |
13500 } | 13500 } |
13501 } | 13501 } |
13502 | 13502 |
13503 | 13503 |
13504 } } // namespace v8::internal | 13504 } } // namespace v8::internal |
OLD | NEW |