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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 | 1844 |
1845 void SetupArrayBufferView(i::Isolate* isolate, | 1845 void SetupArrayBufferView(i::Isolate* isolate, |
1846 i::Handle<i::JSArrayBufferView> obj, | 1846 i::Handle<i::JSArrayBufferView> obj, |
1847 i::Handle<i::JSArrayBuffer> buffer, | 1847 i::Handle<i::JSArrayBuffer> buffer, |
1848 size_t byte_offset, size_t byte_length) { | 1848 size_t byte_offset, size_t byte_length) { |
1849 DCHECK(byte_offset + byte_length <= | 1849 DCHECK(byte_offset + byte_length <= |
1850 static_cast<size_t>(buffer->byte_length()->Number())); | 1850 static_cast<size_t>(buffer->byte_length()->Number())); |
1851 | 1851 |
1852 obj->set_buffer(*buffer); | 1852 obj->set_buffer(*buffer); |
1853 | 1853 |
1854 Heap* heap = isolate->heap(); | |
1855 if (heap->InNewSpace(*obj)) { | |
1856 obj->set_weak_next(heap->new_array_buffer_views_list()); | |
1857 heap->set_new_array_buffer_views_list(*obj); | |
1858 } else { | |
1859 obj->set_weak_next(buffer->weak_first_view()); | |
1860 buffer->set_weak_first_view(*obj); | |
1861 } | |
1862 | |
1863 i::Handle<i::Object> byte_offset_object = | 1854 i::Handle<i::Object> byte_offset_object = |
1864 isolate->factory()->NewNumberFromSize(byte_offset); | 1855 isolate->factory()->NewNumberFromSize(byte_offset); |
1865 obj->set_byte_offset(*byte_offset_object); | 1856 obj->set_byte_offset(*byte_offset_object); |
1866 | 1857 |
1867 i::Handle<i::Object> byte_length_object = | 1858 i::Handle<i::Object> byte_length_object = |
1868 isolate->factory()->NewNumberFromSize(byte_length); | 1859 isolate->factory()->NewNumberFromSize(byte_length); |
1869 obj->set_byte_length(*byte_length_object); | 1860 obj->set_byte_length(*byte_length_object); |
1870 } | 1861 } |
1871 | 1862 |
1872 | 1863 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2390 return Handle<Object>::null(); | 2381 return Handle<Object>::null(); |
2391 } | 2382 } |
2392 | 2383 |
2393 | 2384 |
2394 Handle<Object> Factory::ToBoolean(bool value) { | 2385 Handle<Object> Factory::ToBoolean(bool value) { |
2395 return value ? true_value() : false_value(); | 2386 return value ? true_value() : false_value(); |
2396 } | 2387 } |
2397 | 2388 |
2398 | 2389 |
2399 } } // namespace v8::internal | 2390 } } // namespace v8::internal |
OLD | NEW |