| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
| 9 #include "src/runtime/runtime-utils.h" | 9 #include "src/runtime/runtime-utils.h" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 array_buffer->set_weak_first_view(isolate->heap()->undefined_value()); | 56 array_buffer->set_weak_first_view(isolate->heap()->undefined_value()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate, | 60 bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate, |
| 61 Handle<JSArrayBuffer> array_buffer, | 61 Handle<JSArrayBuffer> array_buffer, |
| 62 size_t allocated_length, | 62 size_t allocated_length, |
| 63 bool initialize) { | 63 bool initialize) { |
| 64 void* data; | 64 void* data; |
| 65 CHECK(V8::ArrayBufferAllocator() != NULL); | 65 CHECK(V8::ArrayBufferAllocator() != NULL); |
| 66 // Prevent creating array buffers when serializing. |
| 67 DCHECK(!isolate->serializer_enabled()); |
| 66 if (allocated_length != 0) { | 68 if (allocated_length != 0) { |
| 67 if (initialize) { | 69 if (initialize) { |
| 68 data = V8::ArrayBufferAllocator()->Allocate(allocated_length); | 70 data = V8::ArrayBufferAllocator()->Allocate(allocated_length); |
| 69 } else { | 71 } else { |
| 70 data = | 72 data = |
| 71 V8::ArrayBufferAllocator()->AllocateUninitialized(allocated_length); | 73 V8::ArrayBufferAllocator()->AllocateUninitialized(allocated_length); |
| 72 } | 74 } |
| 73 if (data == NULL) return false; | 75 if (data == NULL) return false; |
| 74 } else { | 76 } else { |
| 75 data = NULL; | 77 data = NULL; |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 DATA_VIEW_SETTER(Uint16, uint16_t) | 761 DATA_VIEW_SETTER(Uint16, uint16_t) |
| 760 DATA_VIEW_SETTER(Int16, int16_t) | 762 DATA_VIEW_SETTER(Int16, int16_t) |
| 761 DATA_VIEW_SETTER(Uint32, uint32_t) | 763 DATA_VIEW_SETTER(Uint32, uint32_t) |
| 762 DATA_VIEW_SETTER(Int32, int32_t) | 764 DATA_VIEW_SETTER(Int32, int32_t) |
| 763 DATA_VIEW_SETTER(Float32, float) | 765 DATA_VIEW_SETTER(Float32, float) |
| 764 DATA_VIEW_SETTER(Float64, double) | 766 DATA_VIEW_SETTER(Float64, double) |
| 765 | 767 |
| 766 #undef DATA_VIEW_SETTER | 768 #undef DATA_VIEW_SETTER |
| 767 } | 769 } |
| 768 } // namespace v8::internal | 770 } // namespace v8::internal |
| OLD | NEW |