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 Heap* heap = isolate->heap(); | 1798 obj->set_weak_next(buffer->weak_first_view()); |
1799 if (heap->InNewSpace(*obj)) { | 1799 buffer->set_weak_first_view(*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 } | |
1806 | 1800 |
1807 i::Handle<i::Object> byte_offset_object = | 1801 i::Handle<i::Object> byte_offset_object = |
1808 isolate->factory()->NewNumberFromSize(byte_offset); | 1802 isolate->factory()->NewNumberFromSize(byte_offset); |
1809 obj->set_byte_offset(*byte_offset_object); | 1803 obj->set_byte_offset(*byte_offset_object); |
1810 | 1804 |
1811 i::Handle<i::Object> byte_length_object = | 1805 i::Handle<i::Object> byte_length_object = |
1812 isolate->factory()->NewNumberFromSize(byte_length); | 1806 isolate->factory()->NewNumberFromSize(byte_length); |
1813 obj->set_byte_length(*byte_length_object); | 1807 obj->set_byte_length(*byte_length_object); |
1814 } | 1808 } |
1815 | 1809 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 return Handle<Object>::null(); | 2329 return Handle<Object>::null(); |
2336 } | 2330 } |
2337 | 2331 |
2338 | 2332 |
2339 Handle<Object> Factory::ToBoolean(bool value) { | 2333 Handle<Object> Factory::ToBoolean(bool value) { |
2340 return value ? true_value() : false_value(); | 2334 return value ? true_value() : false_value(); |
2341 } | 2335 } |
2342 | 2336 |
2343 | 2337 |
2344 } } // namespace v8::internal | 2338 } } // namespace v8::internal |
OLD | NEW |