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