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 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 | 1789 |
1790 void SetupArrayBufferView(i::Isolate* isolate, | 1790 void SetupArrayBufferView(i::Isolate* isolate, |
1791 i::Handle<i::JSArrayBufferView> obj, | 1791 i::Handle<i::JSArrayBufferView> obj, |
1792 i::Handle<i::JSArrayBuffer> buffer, | 1792 i::Handle<i::JSArrayBuffer> buffer, |
1793 size_t byte_offset, size_t byte_length) { | 1793 size_t byte_offset, size_t byte_length) { |
1794 DCHECK(byte_offset + byte_length <= | 1794 DCHECK(byte_offset + byte_length <= |
1795 static_cast<size_t>(buffer->byte_length()->Number())); | 1795 static_cast<size_t>(buffer->byte_length()->Number())); |
1796 | 1796 |
1797 obj->set_buffer(*buffer); | 1797 obj->set_buffer(*buffer); |
1798 | 1798 |
1799 obj->set_weak_next(buffer->weak_first_view()); | 1799 Heap* heap = isolate->heap(); |
1800 buffer->set_weak_first_view(*obj); | 1800 if (heap->InNewSpace(*obj)) { |
| 1801 obj->set_weak_next(heap->new_array_buffer_views_list()); |
| 1802 heap->set_new_array_buffer_views_list(*obj); |
| 1803 } else { |
| 1804 obj->set_weak_next(buffer->weak_first_view()); |
| 1805 buffer->set_weak_first_view(*obj); |
| 1806 } |
1801 | 1807 |
1802 i::Handle<i::Object> byte_offset_object = | 1808 i::Handle<i::Object> byte_offset_object = |
1803 isolate->factory()->NewNumberFromSize(byte_offset); | 1809 isolate->factory()->NewNumberFromSize(byte_offset); |
1804 obj->set_byte_offset(*byte_offset_object); | 1810 obj->set_byte_offset(*byte_offset_object); |
1805 | 1811 |
1806 i::Handle<i::Object> byte_length_object = | 1812 i::Handle<i::Object> byte_length_object = |
1807 isolate->factory()->NewNumberFromSize(byte_length); | 1813 isolate->factory()->NewNumberFromSize(byte_length); |
1808 obj->set_byte_length(*byte_length_object); | 1814 obj->set_byte_length(*byte_length_object); |
1809 } | 1815 } |
1810 | 1816 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 return Handle<Object>::null(); | 2335 return Handle<Object>::null(); |
2330 } | 2336 } |
2331 | 2337 |
2332 | 2338 |
2333 Handle<Object> Factory::ToBoolean(bool value) { | 2339 Handle<Object> Factory::ToBoolean(bool value) { |
2334 return value ? true_value() : false_value(); | 2340 return value ? true_value() : false_value(); |
2335 } | 2341 } |
2336 | 2342 |
2337 | 2343 |
2338 } } // namespace v8::internal | 2344 } } // namespace v8::internal |
OLD | NEW |