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

Side by Side Diff: src/factory.cc

Issue 1136553006: Implement SharedArrayBuffer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge master 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
« no previous file with comments | « src/factory.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 == SharedFlag::kShared
1723 ? isolate()->native_context()->shared_array_buffer_fun()
1724 : isolate()->native_context()->array_buffer_fun());
1723 CALL_HEAP_FUNCTION( 1725 CALL_HEAP_FUNCTION(
1724 isolate(), 1726 isolate(),
1725 isolate()->heap()->AllocateJSObject(*array_buffer_fun), 1727 isolate()->heap()->AllocateJSObject(*array_buffer_fun),
1726 JSArrayBuffer); 1728 JSArrayBuffer);
1727 } 1729 }
1728 1730
1729 1731
1730 Handle<JSDataView> Factory::NewJSDataView() { 1732 Handle<JSDataView> Factory::NewJSDataView() {
1731 Handle<JSFunction> data_view_fun( 1733 Handle<JSFunction> data_view_fun(
1732 isolate()->native_context()->data_view_fun()); 1734 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; 1929 size_t byte_length = number_of_elements * element_size;
1928 1930
1929 obj->set_byte_offset(Smi::FromInt(0)); 1931 obj->set_byte_offset(Smi::FromInt(0));
1930 i::Handle<i::Object> byte_length_object = 1932 i::Handle<i::Object> byte_length_object =
1931 isolate()->factory()->NewNumberFromSize(byte_length); 1933 isolate()->factory()->NewNumberFromSize(byte_length);
1932 obj->set_byte_length(*byte_length_object); 1934 obj->set_byte_length(*byte_length_object);
1933 Handle<Object> length_object = NewNumberFromSize(number_of_elements); 1935 Handle<Object> length_object = NewNumberFromSize(number_of_elements);
1934 obj->set_length(*length_object); 1936 obj->set_length(*length_object);
1935 1937
1936 Handle<JSArrayBuffer> buffer = isolate()->factory()->NewJSArrayBuffer(); 1938 Handle<JSArrayBuffer> buffer = isolate()->factory()->NewJSArrayBuffer();
1937 Runtime::SetupArrayBuffer(isolate(), buffer, true, NULL, byte_length); 1939 Runtime::SetupArrayBuffer(isolate(), buffer, true, NULL, byte_length,
1940 SharedFlag::kNotShared);
1938 obj->set_buffer(*buffer); 1941 obj->set_buffer(*buffer);
1939 Handle<FixedTypedArrayBase> elements = 1942 Handle<FixedTypedArrayBase> elements =
1940 isolate()->factory()->NewFixedTypedArray( 1943 isolate()->factory()->NewFixedTypedArray(
1941 static_cast<int>(number_of_elements), array_type); 1944 static_cast<int>(number_of_elements), array_type);
1942 obj->set_elements(*elements); 1945 obj->set_elements(*elements);
1943 return obj; 1946 return obj;
1944 } 1947 }
1945 1948
1946 1949
1947 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer, 1950 Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer,
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 return Handle<Object>::null(); 2443 return Handle<Object>::null();
2441 } 2444 }
2442 2445
2443 2446
2444 Handle<Object> Factory::ToBoolean(bool value) { 2447 Handle<Object> Factory::ToBoolean(bool value) {
2445 return value ? true_value() : false_value(); 2448 return value ? true_value() : false_value();
2446 } 2449 }
2447 2450
2448 2451
2449 } } // namespace v8::internal 2452 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698