Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: src/factory.cc

Issue 1136553006: Implement SharedArrayBuffer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix dumb typo Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 JSFunction::EnsureHasInitialMap(function); 1710 JSFunction::EnsureHasInitialMap(function);
1711 Handle<Map> map(function->initial_map()); 1711 Handle<Map> map(function->initial_map());
1712 DCHECK(map->instance_type() == JS_GENERATOR_OBJECT_TYPE); 1712 DCHECK(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
1713 CALL_HEAP_FUNCTION( 1713 CALL_HEAP_FUNCTION(
1714 isolate(), 1714 isolate(),
1715 isolate()->heap()->AllocateJSObjectFromMap(*map), 1715 isolate()->heap()->AllocateJSObjectFromMap(*map),
1716 JSGeneratorObject); 1716 JSGeneratorObject);
1717 } 1717 }
1718 1718
1719 1719
1720 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() { 1720 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared) {
1721 Handle<JSFunction> array_buffer_fun( 1721 Handle<JSFunction> array_buffer_fun(
1722 isolate()->native_context()->array_buffer_fun()); 1722 shared == SHARED ? isolate()->native_context()->shared_array_buffer_fun()
1723 : isolate()->native_context()->array_buffer_fun());
1723 CALL_HEAP_FUNCTION( 1724 CALL_HEAP_FUNCTION(
1724 isolate(), 1725 isolate(),
1725 isolate()->heap()->AllocateJSObject(*array_buffer_fun), 1726 isolate()->heap()->AllocateJSObject(*array_buffer_fun),
1726 JSArrayBuffer); 1727 JSArrayBuffer);
1727 } 1728 }
1728 1729
1729 1730
1730 Handle<JSDataView> Factory::NewJSDataView() { 1731 Handle<JSDataView> Factory::NewJSDataView() {
1731 Handle<JSFunction> data_view_fun( 1732 Handle<JSFunction> data_view_fun(
1732 isolate()->native_context()->data_view_fun()); 1733 isolate()->native_context()->data_view_fun());
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 size_t byte_length = number_of_elements * element_size; 1928 size_t byte_length = number_of_elements * element_size;
1928 1929
1929 obj->set_byte_offset(Smi::FromInt(0)); 1930 obj->set_byte_offset(Smi::FromInt(0));
1930 i::Handle<i::Object> byte_length_object = 1931 i::Handle<i::Object> byte_length_object =
1931 isolate()->factory()->NewNumberFromSize(byte_length); 1932 isolate()->factory()->NewNumberFromSize(byte_length);
1932 obj->set_byte_length(*byte_length_object); 1933 obj->set_byte_length(*byte_length_object);
1933 Handle<Object> length_object = NewNumberFromSize(number_of_elements); 1934 Handle<Object> length_object = NewNumberFromSize(number_of_elements);
1934 obj->set_length(*length_object); 1935 obj->set_length(*length_object);
1935 1936
1936 Handle<JSArrayBuffer> buffer = isolate()->factory()->NewJSArrayBuffer(); 1937 Handle<JSArrayBuffer> buffer = isolate()->factory()->NewJSArrayBuffer();
1937 Runtime::SetupArrayBuffer(isolate(), buffer, true, NULL, byte_length); 1938 Runtime::SetupArrayBuffer(isolate(), buffer, true, NULL, byte_length,
1939 NOT_SHARED);
1938 obj->set_buffer(*buffer); 1940 obj->set_buffer(*buffer);
1939 Handle<FixedTypedArrayBase> elements = 1941 Handle<FixedTypedArrayBase> elements =
1940 isolate()->factory()->NewFixedTypedArray( 1942 isolate()->factory()->NewFixedTypedArray(
1941 static_cast<int>(number_of_elements), array_type); 1943 static_cast<int>(number_of_elements), array_type);
1942 obj->set_elements(*elements); 1944 obj->set_elements(*elements);
1943 return obj; 1945 return obj;
1944 } 1946 }
1945 1947
1946 1948
1947 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer, 1949 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer,
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 return Handle<Object>::null(); 2428 return Handle<Object>::null();
2427 } 2429 }
2428 2430
2429 2431
2430 Handle<Object> Factory::ToBoolean(bool value) { 2432 Handle<Object> Factory::ToBoolean(bool value) {
2431 return value ? true_value() : false_value(); 2433 return value ? true_value() : false_value();
2432 } 2434 }
2433 2435
2434 2436
2435 } } // namespace v8::internal 2437 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698