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 "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
11 #include "src/allocation-site-scopes.h" | 11 #include "src/allocation-site-scopes.h" |
12 #include "src/api.h" | 12 #include "src/api.h" |
13 #include "src/arguments.h" | 13 #include "src/arguments.h" |
14 #include "src/base/bits.h" | 14 #include "src/base/bits.h" |
15 #include "src/base/utils/random-number-generator.h" | 15 #include "src/base/utils/random-number-generator.h" |
16 #include "src/bootstrapper.h" | 16 #include "src/bootstrapper.h" |
17 #include "src/code-stubs.h" | 17 #include "src/code-stubs.h" |
18 #include "src/codegen.h" | 18 #include "src/codegen.h" |
19 #include "src/compilation-dependencies.h" | 19 #include "src/compilation-dependencies.h" |
20 #include "src/compiler.h" | 20 #include "src/compiler.h" |
21 #include "src/cpu-profiler.h" | 21 #include "src/cpu-profiler.h" |
22 #include "src/date.h" | 22 #include "src/date.h" |
23 #include "src/debug/debug.h" | 23 #include "src/debug/debug.h" |
24 #include "src/deoptimizer.h" | 24 #include "src/deoptimizer.h" |
25 #include "src/elements.h" | 25 #include "src/elements.h" |
26 #include "src/execution.h" | 26 #include "src/execution.h" |
27 #include "src/field-index-inl.h" | 27 #include "src/field-index-inl.h" |
28 #include "src/field-index.h" | 28 #include "src/field-index.h" |
29 #include "src/full-codegen/full-codegen.h" | 29 #include "src/full-codegen/full-codegen.h" |
30 #include "src/heap/array-buffer-tracker.h" | |
Michael Lippautz
2015/09/04 08:24:15
Only include src/heap/heap.h
fedor.indutny
2015/09/04 08:58:05
Acknowledged, doesn't look like it is needed.
| |
30 #include "src/hydrogen.h" | 31 #include "src/hydrogen.h" |
31 #include "src/ic/ic.h" | 32 #include "src/ic/ic.h" |
32 #include "src/interpreter/bytecodes.h" | 33 #include "src/interpreter/bytecodes.h" |
33 #include "src/isolate-inl.h" | 34 #include "src/isolate-inl.h" |
34 #include "src/log.h" | 35 #include "src/log.h" |
35 #include "src/lookup.h" | 36 #include "src/lookup.h" |
36 #include "src/macro-assembler.h" | 37 #include "src/macro-assembler.h" |
37 #include "src/messages.h" | 38 #include "src/messages.h" |
38 #include "src/objects-inl.h" | 39 #include "src/objects-inl.h" |
39 #include "src/prototype.h" | 40 #include "src/prototype.h" |
(...skipping 15896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15936 for (int i = 0; i < v8::ArrayBuffer::kInternalFieldCount; i++) { | 15937 for (int i = 0; i < v8::ArrayBuffer::kInternalFieldCount; i++) { |
15937 array_buffer->SetInternalField(i, Smi::FromInt(0)); | 15938 array_buffer->SetInternalField(i, Smi::FromInt(0)); |
15938 } | 15939 } |
15939 array_buffer->set_backing_store(data); | 15940 array_buffer->set_backing_store(data); |
15940 array_buffer->set_bit_field(0); | 15941 array_buffer->set_bit_field(0); |
15941 array_buffer->set_is_external(is_external); | 15942 array_buffer->set_is_external(is_external); |
15942 array_buffer->set_is_neuterable(shared == SharedFlag::kNotShared); | 15943 array_buffer->set_is_neuterable(shared == SharedFlag::kNotShared); |
15943 array_buffer->set_is_shared(shared == SharedFlag::kShared); | 15944 array_buffer->set_is_shared(shared == SharedFlag::kShared); |
15944 | 15945 |
15945 if (data && !is_external) { | 15946 if (data && !is_external) { |
15946 isolate->heap()->RegisterNewArrayBuffer( | 15947 isolate->heap()->array_buffer_tracker()->RegisterNew( |
Michael Lippautz
2015/09/04 08:24:15
Use the wrapper call for Register.
fedor.indutny
2015/09/04 08:58:05
Acknowledged.
| |
15947 isolate->heap()->InNewSpace(*array_buffer), data, allocated_length); | 15948 isolate->heap()->InNewSpace(*array_buffer), data, allocated_length); |
15948 } | 15949 } |
15949 | 15950 |
15950 Handle<Object> byte_length = | 15951 Handle<Object> byte_length = |
15951 isolate->factory()->NewNumberFromSize(allocated_length); | 15952 isolate->factory()->NewNumberFromSize(allocated_length); |
15952 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); | 15953 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); |
15953 array_buffer->set_byte_length(*byte_length); | 15954 array_buffer->set_byte_length(*byte_length); |
15954 } | 15955 } |
15955 | 15956 |
15956 | 15957 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15991 Handle<FixedTypedArrayBase> fixed_typed_array( | 15992 Handle<FixedTypedArrayBase> fixed_typed_array( |
15992 FixedTypedArrayBase::cast(typed_array->elements())); | 15993 FixedTypedArrayBase::cast(typed_array->elements())); |
15993 | 15994 |
15994 Handle<JSArrayBuffer> buffer(JSArrayBuffer::cast(typed_array->buffer()), | 15995 Handle<JSArrayBuffer> buffer(JSArrayBuffer::cast(typed_array->buffer()), |
15995 isolate); | 15996 isolate); |
15996 void* backing_store = | 15997 void* backing_store = |
15997 isolate->array_buffer_allocator()->AllocateUninitialized( | 15998 isolate->array_buffer_allocator()->AllocateUninitialized( |
15998 fixed_typed_array->DataSize()); | 15999 fixed_typed_array->DataSize()); |
15999 buffer->set_backing_store(backing_store); | 16000 buffer->set_backing_store(backing_store); |
16000 buffer->set_is_external(false); | 16001 buffer->set_is_external(false); |
16001 isolate->heap()->RegisterNewArrayBuffer(isolate->heap()->InNewSpace(*buffer), | 16002 isolate->heap()->array_buffer_tracker()->RegisterNew( |
Michael Lippautz
2015/09/04 08:24:15
Ditto.
fedor.indutny
2015/09/04 08:58:05
Acknowledged.
| |
16002 backing_store, | 16003 isolate->heap()->InNewSpace(*buffer), backing_store, |
16003 fixed_typed_array->DataSize()); | 16004 fixed_typed_array->DataSize()); |
16004 memcpy(buffer->backing_store(), | 16005 memcpy(buffer->backing_store(), |
16005 fixed_typed_array->DataPtr(), | 16006 fixed_typed_array->DataPtr(), |
16006 fixed_typed_array->DataSize()); | 16007 fixed_typed_array->DataSize()); |
16007 Handle<FixedTypedArrayBase> new_elements = | 16008 Handle<FixedTypedArrayBase> new_elements = |
16008 isolate->factory()->NewFixedTypedArrayWithExternalPointer( | 16009 isolate->factory()->NewFixedTypedArrayWithExternalPointer( |
16009 fixed_typed_array->length(), typed_array->type(), | 16010 fixed_typed_array->length(), typed_array->type(), |
16010 static_cast<uint8_t*>(buffer->backing_store())); | 16011 static_cast<uint8_t*>(buffer->backing_store())); |
16011 | 16012 |
16012 typed_array->set_elements(*new_elements); | 16013 typed_array->set_elements(*new_elements); |
16013 | 16014 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16159 if (cell->value() != *new_value) { | 16160 if (cell->value() != *new_value) { |
16160 cell->set_value(*new_value); | 16161 cell->set_value(*new_value); |
16161 Isolate* isolate = cell->GetIsolate(); | 16162 Isolate* isolate = cell->GetIsolate(); |
16162 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16163 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16163 isolate, DependentCode::kPropertyCellChangedGroup); | 16164 isolate, DependentCode::kPropertyCellChangedGroup); |
16164 } | 16165 } |
16165 } | 16166 } |
16166 | 16167 |
16167 } // namespace internal | 16168 } // namespace internal |
16168 } // namespace v8 | 16169 } // namespace v8 |
OLD | NEW |