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/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 | 1783 |
1784 void SetupArrayBufferView(i::Isolate* isolate, | 1784 void SetupArrayBufferView(i::Isolate* isolate, |
1785 i::Handle<i::JSArrayBufferView> obj, | 1785 i::Handle<i::JSArrayBufferView> obj, |
1786 i::Handle<i::JSArrayBuffer> buffer, | 1786 i::Handle<i::JSArrayBuffer> buffer, |
1787 size_t byte_offset, size_t byte_length) { | 1787 size_t byte_offset, size_t byte_length) { |
1788 DCHECK(byte_offset + byte_length <= | 1788 DCHECK(byte_offset + byte_length <= |
1789 static_cast<size_t>(buffer->byte_length()->Number())); | 1789 static_cast<size_t>(buffer->byte_length()->Number())); |
1790 | 1790 |
1791 obj->set_buffer(*buffer); | 1791 obj->set_buffer(*buffer); |
1792 | 1792 |
1793 obj->set_weak_next(buffer->weak_first_view()); | 1793 Heap* heap = isolate->heap(); |
1794 buffer->set_weak_first_view(*obj); | 1794 if (heap->InNewSpace(*obj)) { |
| 1795 obj->set_weak_next(heap->new_array_buffer_views_list()); |
| 1796 heap->set_new_array_buffer_views_list(*obj); |
| 1797 } else { |
| 1798 obj->set_weak_next(buffer->weak_first_view()); |
| 1799 buffer->set_weak_first_view(*obj); |
| 1800 } |
1795 | 1801 |
1796 i::Handle<i::Object> byte_offset_object = | 1802 i::Handle<i::Object> byte_offset_object = |
1797 isolate->factory()->NewNumberFromSize(byte_offset); | 1803 isolate->factory()->NewNumberFromSize(byte_offset); |
1798 obj->set_byte_offset(*byte_offset_object); | 1804 obj->set_byte_offset(*byte_offset_object); |
1799 | 1805 |
1800 i::Handle<i::Object> byte_length_object = | 1806 i::Handle<i::Object> byte_length_object = |
1801 isolate->factory()->NewNumberFromSize(byte_length); | 1807 isolate->factory()->NewNumberFromSize(byte_length); |
1802 obj->set_byte_length(*byte_length_object); | 1808 obj->set_byte_length(*byte_length_object); |
1803 } | 1809 } |
1804 | 1810 |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 return Handle<Object>::null(); | 2323 return Handle<Object>::null(); |
2318 } | 2324 } |
2319 | 2325 |
2320 | 2326 |
2321 Handle<Object> Factory::ToBoolean(bool value) { | 2327 Handle<Object> Factory::ToBoolean(bool value) { |
2322 return value ? true_value() : false_value(); | 2328 return value ? true_value() : false_value(); |
2323 } | 2329 } |
2324 | 2330 |
2325 | 2331 |
2326 } } // namespace v8::internal | 2332 } } // namespace v8::internal |
OLD | NEW |