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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 array_buffer->set_flag(Smi::FromInt(0)); | 683 array_buffer->set_flag(Smi::FromInt(0)); |
684 array_buffer->set_is_external(is_external); | 684 array_buffer->set_is_external(is_external); |
685 | 685 |
686 Handle<Object> byte_length = | 686 Handle<Object> byte_length = |
687 isolate->factory()->NewNumberFromSize(allocated_length); | 687 isolate->factory()->NewNumberFromSize(allocated_length); |
688 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); | 688 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); |
689 array_buffer->set_byte_length(*byte_length); | 689 array_buffer->set_byte_length(*byte_length); |
690 | 690 |
691 array_buffer->set_weak_next(isolate->heap()->array_buffers_list()); | 691 array_buffer->set_weak_next(isolate->heap()->array_buffers_list()); |
692 isolate->heap()->set_array_buffers_list(*array_buffer); | 692 isolate->heap()->set_array_buffers_list(*array_buffer); |
693 array_buffer->set_weak_first_array(Smi::FromInt(0)); | 693 array_buffer->set_weak_first_array(isolate->heap()->undefined_value()); |
694 } | 694 } |
695 | 695 |
696 | 696 |
697 bool Runtime::SetupArrayBufferAllocatingData( | 697 bool Runtime::SetupArrayBufferAllocatingData( |
698 Isolate* isolate, | 698 Isolate* isolate, |
699 Handle<JSArrayBuffer> array_buffer, | 699 Handle<JSArrayBuffer> array_buffer, |
700 size_t allocated_length) { | 700 size_t allocated_length) { |
701 void* data; | 701 void* data; |
702 if (allocated_length != 0) { | 702 if (allocated_length != 0) { |
703 data = malloc(allocated_length); | 703 data = malloc(allocated_length); |
(...skipping 12927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13631 // Handle last resort GC and make sure to allow future allocations | 13631 // Handle last resort GC and make sure to allow future allocations |
13632 // to grow the heap without causing GCs (if possible). | 13632 // to grow the heap without causing GCs (if possible). |
13633 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13633 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13634 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13634 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13635 "Runtime::PerformGC"); | 13635 "Runtime::PerformGC"); |
13636 } | 13636 } |
13637 } | 13637 } |
13638 | 13638 |
13639 | 13639 |
13640 } } // namespace v8::internal | 13640 } } // namespace v8::internal |
OLD | NEW |