OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 16974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16985 Runtime::SetupArrayBufferAllocatingData(isolate, buffer, | 16985 Runtime::SetupArrayBufferAllocatingData(isolate, buffer, |
16986 fixed_typed_array->DataSize(), false); | 16986 fixed_typed_array->DataSize(), false); |
16987 memcpy(buffer->backing_store(), | 16987 memcpy(buffer->backing_store(), |
16988 fixed_typed_array->DataPtr(), | 16988 fixed_typed_array->DataPtr(), |
16989 fixed_typed_array->DataSize()); | 16989 fixed_typed_array->DataSize()); |
16990 Handle<ExternalArray> new_elements = | 16990 Handle<ExternalArray> new_elements = |
16991 isolate->factory()->NewExternalArray( | 16991 isolate->factory()->NewExternalArray( |
16992 fixed_typed_array->length(), typed_array->type(), | 16992 fixed_typed_array->length(), typed_array->type(), |
16993 static_cast<uint8_t*>(buffer->backing_store())); | 16993 static_cast<uint8_t*>(buffer->backing_store())); |
16994 | 16994 |
16995 buffer->set_weak_first_view(*typed_array); | 16995 Heap* heap = isolate->heap(); |
16996 DCHECK(typed_array->weak_next() == isolate->heap()->undefined_value()); | 16996 if (heap->InNewSpace(*typed_array)) { |
| 16997 DCHECK(typed_array->weak_next() == isolate->heap()->undefined_value()); |
| 16998 typed_array->set_weak_next(heap->new_array_buffer_views_list()); |
| 16999 heap->set_new_array_buffer_views_list(*typed_array); |
| 17000 } else { |
| 17001 buffer->set_weak_first_view(*typed_array); |
| 17002 DCHECK(typed_array->weak_next() == isolate->heap()->undefined_value()); |
| 17003 } |
16997 typed_array->set_buffer(*buffer); | 17004 typed_array->set_buffer(*buffer); |
16998 JSObject::SetMapAndElements(typed_array, new_map, new_elements); | 17005 JSObject::SetMapAndElements(typed_array, new_map, new_elements); |
16999 | 17006 |
17000 return buffer; | 17007 return buffer; |
17001 } | 17008 } |
17002 | 17009 |
17003 | 17010 |
17004 Handle<JSArrayBuffer> JSTypedArray::GetBuffer() { | 17011 Handle<JSArrayBuffer> JSTypedArray::GetBuffer() { |
17005 Handle<Object> result(buffer(), GetIsolate()); | 17012 Handle<Object> result(buffer(), GetIsolate()); |
17006 if (*result != Smi::FromInt(0)) { | 17013 if (*result != Smi::FromInt(0)) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17070 CompilationInfo* info) { | 17077 CompilationInfo* info) { |
17071 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17078 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17072 handle(cell->dependent_code(), info->isolate()), | 17079 handle(cell->dependent_code(), info->isolate()), |
17073 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17080 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17074 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17081 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17075 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17082 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17076 cell, info->zone()); | 17083 cell, info->zone()); |
17077 } | 17084 } |
17078 | 17085 |
17079 } } // namespace v8::internal | 17086 } } // namespace v8::internal |
OLD | NEW |