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

Side by Side Diff: src/bootstrapper.cc

Issue 13975012: First cut at impementing ES6 TypedArrays in V8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/messages.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 Handle<JSFunction> empty_function); 192 Handle<JSFunction> empty_function);
193 void InitializeExperimentalGlobal(); 193 void InitializeExperimentalGlobal();
194 // Installs the contents of the native .js files on the global objects. 194 // Installs the contents of the native .js files on the global objects.
195 // Used for creating a context from scratch. 195 // Used for creating a context from scratch.
196 void InstallNativeFunctions(); 196 void InstallNativeFunctions();
197 void InstallExperimentalNativeFunctions(); 197 void InstallExperimentalNativeFunctions();
198 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, 198 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins,
199 const char* name, 199 const char* name,
200 ElementsKind elements_kind); 200 ElementsKind elements_kind);
201 bool InstallNatives(); 201 bool InstallNatives();
202
203 void InstallTypedArray(const char* name);
202 bool InstallExperimentalNatives(); 204 bool InstallExperimentalNatives();
203 void InstallBuiltinFunctionIds(); 205 void InstallBuiltinFunctionIds();
204 void InstallJSFunctionResultCaches(); 206 void InstallJSFunctionResultCaches();
205 void InitializeNormalizedMapCaches(); 207 void InitializeNormalizedMapCaches();
206 208
207 enum ExtensionTraversalState { 209 enum ExtensionTraversalState {
208 UNVISITED, VISITED, INSTALLED 210 UNVISITED, VISITED, INSTALLED
209 }; 211 };
210 212
211 class ExtensionStates { 213 class ExtensionStates {
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 // Initialize the random seed slot. 1253 // Initialize the random seed slot.
1252 Handle<ByteArray> zeroed_byte_array( 1254 Handle<ByteArray> zeroed_byte_array(
1253 factory->NewByteArray(kRandomStateSize)); 1255 factory->NewByteArray(kRandomStateSize));
1254 native_context()->set_random_seed(*zeroed_byte_array); 1256 native_context()->set_random_seed(*zeroed_byte_array);
1255 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize); 1257 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize);
1256 } 1258 }
1257 return true; 1259 return true;
1258 } 1260 }
1259 1261
1260 1262
1263 void Genesis::InstallTypedArray(const char* name) {
1264 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1265 InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
1266 JSTypedArray::kSize, isolate()->initial_object_prototype(),
1267 Builtins::kIllegal, true);
1268 }
1269
1270
1261 void Genesis::InitializeExperimentalGlobal() { 1271 void Genesis::InitializeExperimentalGlobal() {
1262 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); 1272 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1263 1273
1264 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no 1274 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
1265 // longer need to live behind flags, so functions get added to the snapshot. 1275 // longer need to live behind flags, so functions get added to the snapshot.
1266 1276
1267 if (FLAG_harmony_symbols) { 1277 if (FLAG_harmony_symbols) {
1268 // --- S y m b o l --- 1278 // --- S y m b o l ---
1269 Handle<JSFunction> symbol_fun = 1279 Handle<JSFunction> symbol_fun =
1270 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, 1280 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize,
(...skipping 20 matching lines...) Expand all
1291 } 1301 }
1292 } 1302 }
1293 1303
1294 if (FLAG_harmony_typed_arrays) { 1304 if (FLAG_harmony_typed_arrays) {
1295 { // -- A r r a y B u f f e r 1305 { // -- A r r a y B u f f e r
1296 InstallFunction(global, "__ArrayBuffer", JS_ARRAY_BUFFER_TYPE, 1306 InstallFunction(global, "__ArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1297 JSArrayBuffer::kSize, 1307 JSArrayBuffer::kSize,
1298 isolate()->initial_object_prototype(), 1308 isolate()->initial_object_prototype(),
1299 Builtins::kIllegal, true); 1309 Builtins::kIllegal, true);
1300 } 1310 }
1311 {
1312 // -- T y p e d A r r a y s
1313 InstallTypedArray("__Int8Array");
1314 InstallTypedArray("__Uint8Array");
1315 InstallTypedArray("__Int16Array");
1316 InstallTypedArray("__Uint16Array");
1317 InstallTypedArray("__Int32Array");
1318 InstallTypedArray("__Uint32Array");
1319 InstallTypedArray("__Float32Array");
1320 InstallTypedArray("__Float64Array");
1321 }
1301 } 1322 }
1302 1323
1303 if (FLAG_harmony_generators) { 1324 if (FLAG_harmony_generators) {
1304 // Create generator meta-objects and install them on the builtins object. 1325 // Create generator meta-objects and install them on the builtins object.
1305 Handle<JSObject> builtins(native_context()->builtins()); 1326 Handle<JSObject> builtins(native_context()->builtins());
1306 Handle<JSObject> generator_object_prototype = 1327 Handle<JSObject> generator_object_prototype =
1307 factory()->NewJSObject(isolate()->object_function(), TENURED); 1328 factory()->NewJSObject(isolate()->object_function(), TENURED);
1308 Handle<JSFunction> generator_function_prototype = 1329 Handle<JSFunction> generator_function_prototype =
1309 InstallFunction(builtins, "GeneratorFunctionPrototype", 1330 InstallFunction(builtins, "GeneratorFunctionPrototype",
1310 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, 1331 JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2533 return from + sizeof(NestingCounterType); 2554 return from + sizeof(NestingCounterType);
2534 } 2555 }
2535 2556
2536 2557
2537 // Called when the top-level V8 mutex is destroyed. 2558 // Called when the top-level V8 mutex is destroyed.
2538 void Bootstrapper::FreeThreadResources() { 2559 void Bootstrapper::FreeThreadResources() {
2539 ASSERT(!IsActive()); 2560 ASSERT(!IsActive());
2540 } 2561 }
2541 2562
2542 } } // namespace v8::internal 2563 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698