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

Side by Side Diff: src/bootstrapper.cc

Issue 1069883002: WIP SharedArrayBuffer implementation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/arraybuffer.js ('k') | src/contexts.h » ('j') | src/factory.h » ('J')
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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) 182 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
183 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) 183 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
184 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) 184 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
185 #undef DECLARE_FEATURE_INITIALIZATION 185 #undef DECLARE_FEATURE_INITIALIZATION
186 186
187 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, 187 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins,
188 const char* name, 188 const char* name,
189 ElementsKind elements_kind); 189 ElementsKind elements_kind);
190 bool InstallNatives(); 190 bool InstallNatives();
191 191
192 void InstallTypedArray( 192 void InstallTypedArray(const char* name, ElementsKind elements_kind,
193 const char* name, 193 Handle<JSFunction>* fun, Handle<Map>* external_map,
194 ElementsKind elements_kind, 194 bool is_shared);
Jarin 2015/04/16 14:55:28 Could you introduce an enum for the various places
binji 2015/04/16 21:00:33 Done.
195 Handle<JSFunction>* fun,
196 Handle<Map>* external_map);
197 bool InstallExperimentalNatives(); 195 bool InstallExperimentalNatives();
198 void InstallBuiltinFunctionIds(); 196 void InstallBuiltinFunctionIds();
199 void InstallJSFunctionResultCaches(); 197 void InstallJSFunctionResultCaches();
200 void InitializeNormalizedMapCaches(); 198 void InitializeNormalizedMapCaches();
201 199
202 enum ExtensionTraversalState { 200 enum ExtensionTraversalState {
203 UNVISITED, VISITED, INSTALLED 201 UNVISITED, VISITED, INSTALLED
204 }; 202 };
205 203
206 class ExtensionStates { 204 class ExtensionStates {
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 Handle<JSFunction> array_buffer_fun = 1144 Handle<JSFunction> array_buffer_fun =
1147 InstallFunction( 1145 InstallFunction(
1148 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, 1146 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1149 JSArrayBuffer::kSizeWithInternalFields, 1147 JSArrayBuffer::kSizeWithInternalFields,
1150 isolate->initial_object_prototype(), 1148 isolate->initial_object_prototype(),
1151 Builtins::kIllegal); 1149 Builtins::kIllegal);
1152 native_context()->set_array_buffer_fun(*array_buffer_fun); 1150 native_context()->set_array_buffer_fun(*array_buffer_fun);
1153 } 1151 }
1154 1152
1155 { // -- T y p e d A r r a y s 1153 { // -- T y p e d A r r a y s
1156 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ 1154 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
1157 { \ 1155 { \
1158 Handle<JSFunction> fun; \ 1156 Handle<JSFunction> fun; \
1159 Handle<Map> external_map; \ 1157 Handle<Map> external_map; \
1160 InstallTypedArray(#Type "Array", \ 1158 InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun, &external_map, \
1161 TYPE##_ELEMENTS, \ 1159 false); \
1162 &fun, \ 1160 native_context()->set_##type##_array_fun(*fun); \
1163 &external_map); \ 1161 native_context()->set_##type##_array_external_map(*external_map); \
1164 native_context()->set_##type##_array_fun(*fun); \ 1162 }
1165 native_context()->set_##type##_array_external_map(*external_map); \
1166 }
1167 TYPED_ARRAYS(INSTALL_TYPED_ARRAY) 1163 TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
1168 #undef INSTALL_TYPED_ARRAY 1164 #undef INSTALL_TYPED_ARRAY
1169 1165
1170 Handle<JSFunction> data_view_fun = 1166 Handle<JSFunction> data_view_fun =
1171 InstallFunction( 1167 InstallFunction(
1172 global, "DataView", JS_DATA_VIEW_TYPE, 1168 global, "DataView", JS_DATA_VIEW_TYPE,
1173 JSDataView::kSizeWithInternalFields, 1169 JSDataView::kSizeWithInternalFields,
1174 isolate->initial_object_prototype(), 1170 isolate->initial_object_prototype(),
1175 Builtins::kIllegal); 1171 Builtins::kIllegal);
1176 native_context()->set_data_view_fun(*data_view_fun); 1172 native_context()->set_data_view_fun(*data_view_fun);
1177 } 1173 }
1178 1174
1175 { // -- S h a r e d A r r a y B u f f e r
1176 Handle<JSFunction> shared_array_buffer_fun = InstallFunction(
1177 global, "SharedArrayBuffer", JS_SHARED_ARRAY_BUFFER_TYPE,
1178 JSArrayBuffer::kSizeWithInternalFields,
1179 isolate->initial_object_prototype(), Builtins::kIllegal);
1180 native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun);
1181 }
1182
1183 { // -- S h a r e d T y p e d A r r a y s
1184 #define INSTALL_SHARED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
1185 { \
1186 Handle<JSFunction> fun; \
1187 Handle<Map> external_map; \
1188 InstallTypedArray("Shared" #Type "Array", TYPE##_ELEMENTS, &fun, \
1189 &external_map, true); \
1190 native_context()->set_shared_##type##_array_fun(*fun); \
1191 native_context()->set_shared_##type##_array_external_map(*external_map); \
1192 }
1193 TYPED_ARRAYS(INSTALL_SHARED_TYPED_ARRAY)
1194 #undef INSTALL_SHARED_TYPED_ARRAY
1195 }
1196
1179 // -- M a p 1197 // -- M a p
1180 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, 1198 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize,
1181 isolate->initial_object_prototype(), Builtins::kIllegal); 1199 isolate->initial_object_prototype(), Builtins::kIllegal);
1182 1200
1183 // -- S e t 1201 // -- S e t
1184 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, 1202 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize,
1185 isolate->initial_object_prototype(), Builtins::kIllegal); 1203 isolate->initial_object_prototype(), Builtins::kIllegal);
1186 1204
1187 { // Set up the iterator result object 1205 { // Set up the iterator result object
1188 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); 1206 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 native_context()->set_call_as_constructor_delegate(*delegate); 1382 native_context()->set_call_as_constructor_delegate(*delegate);
1365 delegate->shared()->DontAdaptArguments(); 1383 delegate->shared()->DontAdaptArguments();
1366 } 1384 }
1367 1385
1368 // Initialize the embedder data slot. 1386 // Initialize the embedder data slot.
1369 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); 1387 Handle<FixedArray> embedder_data = factory->NewFixedArray(3);
1370 native_context()->set_embedder_data(*embedder_data); 1388 native_context()->set_embedder_data(*embedder_data);
1371 } 1389 }
1372 1390
1373 1391
1374 void Genesis::InstallTypedArray( 1392 void Genesis::InstallTypedArray(const char* name, ElementsKind elements_kind,
1375 const char* name, 1393 Handle<JSFunction>* fun,
1376 ElementsKind elements_kind, 1394 Handle<Map>* external_map, bool is_shared) {
1377 Handle<JSFunction>* fun, 1395 InstanceType type =
1378 Handle<Map>* external_map) { 1396 is_shared ? JS_SHARED_TYPED_ARRAY_TYPE : JS_TYPED_ARRAY_TYPE;
1379 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); 1397 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1380 Handle<JSFunction> result = InstallFunction( 1398 Handle<JSFunction> result = InstallFunction(
1381 global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, 1399 global, name, type, JSTypedArray::kSize,
1382 isolate()->initial_object_prototype(), Builtins::kIllegal); 1400 isolate()->initial_object_prototype(), Builtins::kIllegal);
1383 1401
1384 Handle<Map> initial_map = isolate()->factory()->NewMap( 1402 Handle<Map> initial_map = isolate()->factory()->NewMap(
1385 JS_TYPED_ARRAY_TYPE, 1403 type, JSTypedArray::kSizeWithInternalFields, elements_kind);
1386 JSTypedArray::kSizeWithInternalFields,
1387 elements_kind);
1388 JSFunction::SetInitialMap(result, initial_map, 1404 JSFunction::SetInitialMap(result, initial_map,
1389 handle(initial_map->prototype(), isolate())); 1405 handle(initial_map->prototype(), isolate()));
1390 *fun = result; 1406 *fun = result;
1391 1407
1392 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); 1408 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind);
1393 *external_map = Map::AsElementsKind(initial_map, external_kind); 1409 *external_map = Map::AsElementsKind(initial_map, external_kind);
1394 } 1410 }
1395 1411
1396 1412
1397 void Genesis::InitializeExperimentalGlobal() { 1413 void Genesis::InitializeExperimentalGlobal() {
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 return from + sizeof(NestingCounterType); 2979 return from + sizeof(NestingCounterType);
2964 } 2980 }
2965 2981
2966 2982
2967 // Called when the top-level V8 mutex is destroyed. 2983 // Called when the top-level V8 mutex is destroyed.
2968 void Bootstrapper::FreeThreadResources() { 2984 void Bootstrapper::FreeThreadResources() {
2969 DCHECK(!IsActive()); 2985 DCHECK(!IsActive());
2970 } 2986 }
2971 2987
2972 } } // namespace v8::internal 2988 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arraybuffer.js ('k') | src/contexts.h » ('j') | src/factory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698