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