Chromium Code Reviews| 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 "bootstrapper.h" | 5 #include "bootstrapper.h" |
| 6 | 6 |
| 7 #include "accessors.h" | 7 #include "accessors.h" |
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
| 9 #include "natives.h" | 9 #include "natives.h" |
| 10 #include "snapshot.h" | 10 #include "snapshot.h" |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 | 1285 |
| 1286 if (FLAG_harmony_symbols) { | 1286 if (FLAG_harmony_symbols) { |
| 1287 // --- S y m b o l --- | 1287 // --- S y m b o l --- |
| 1288 Handle<JSFunction> symbol_fun = | 1288 Handle<JSFunction> symbol_fun = |
| 1289 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, | 1289 InstallFunction(global, "Symbol", JS_VALUE_TYPE, JSValue::kSize, |
| 1290 isolate()->initial_object_prototype(), | 1290 isolate()->initial_object_prototype(), |
| 1291 Builtins::kIllegal, true, true); | 1291 Builtins::kIllegal, true, true); |
| 1292 native_context()->set_symbol_function(*symbol_fun); | 1292 native_context()->set_symbol_function(*symbol_fun); |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 if (FLAG_harmony_collections) { | 1295 if (FLAG_harmony_collections) { |
|
adamk
2014/04/14 22:46:38
Can you move those map constructions up to here?
arv (Not doing code reviews)
2014/04/15 00:29:17
Done.
| |
| 1296 { // -- M a p | 1296 { // -- M a p |
| 1297 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, | 1297 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, |
| 1298 isolate()->initial_object_prototype(), | 1298 isolate()->initial_object_prototype(), |
| 1299 Builtins::kIllegal, true, true); | 1299 Builtins::kIllegal, true, true); |
| 1300 } | 1300 } |
| 1301 { // -- S e t | 1301 { // -- S e t |
| 1302 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, | 1302 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, |
| 1303 isolate()->initial_object_prototype(), | 1303 isolate()->initial_object_prototype(), |
| 1304 Builtins::kIllegal, true, true); | 1304 Builtins::kIllegal, true, true); |
| 1305 } | 1305 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1350 native_context()->set_strict_generator_function_map( | 1350 native_context()->set_strict_generator_function_map( |
| 1351 *strict_mode_generator_function_map); | 1351 *strict_mode_generator_function_map); |
| 1352 | 1352 |
| 1353 Handle<JSFunction> object_function(native_context()->object_function()); | 1353 Handle<JSFunction> object_function(native_context()->object_function()); |
| 1354 Handle<Map> generator_object_prototype_map = Map::Create( | 1354 Handle<Map> generator_object_prototype_map = Map::Create( |
| 1355 object_function, 0); | 1355 object_function, 0); |
| 1356 generator_object_prototype_map->set_prototype( | 1356 generator_object_prototype_map->set_prototype( |
| 1357 *generator_object_prototype); | 1357 *generator_object_prototype); |
| 1358 native_context()->set_generator_object_prototype_map( | 1358 native_context()->set_generator_object_prototype_map( |
| 1359 *generator_object_prototype_map); | 1359 *generator_object_prototype_map); |
| 1360 ASSERT(object_function->initial_map()->inobject_properties() == 0); | |
| 1361 } | |
| 1360 | 1362 |
| 1361 // Create a map for generator result objects. | 1363 if (FLAG_harmony_collections || FLAG_harmony_generators) { |
| 1362 ASSERT(object_function->initial_map()->inobject_properties() == 0); | 1364 // Collection forEach uses an iterator result object. |
| 1365 // Generators return iteraror result objects. | |
| 1366 | |
| 1363 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); | 1367 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); |
| 1364 Handle<Map> generator_result_map = Map::Create( | 1368 Handle<JSFunction> object_function(native_context()->object_function()); |
| 1369 Handle<Map> iterator_result_map = Map::Create( | |
| 1365 object_function, JSGeneratorObject::kResultPropertyCount); | 1370 object_function, JSGeneratorObject::kResultPropertyCount); |
| 1366 ASSERT(generator_result_map->inobject_properties() == | 1371 ASSERT(iterator_result_map->inobject_properties() == |
| 1367 JSGeneratorObject::kResultPropertyCount); | 1372 JSGeneratorObject::kResultPropertyCount); |
| 1368 Map::EnsureDescriptorSlack( | 1373 Map::EnsureDescriptorSlack( |
| 1369 generator_result_map, JSGeneratorObject::kResultPropertyCount); | 1374 iterator_result_map, JSGeneratorObject::kResultPropertyCount); |
| 1370 | 1375 |
| 1371 Handle<String> value_string = factory()->InternalizeOneByteString( | 1376 Handle<String> value_string = factory()->InternalizeOneByteString( |
| 1372 STATIC_ASCII_VECTOR("value")); | 1377 STATIC_ASCII_VECTOR("value")); |
| 1373 FieldDescriptor value_descr(value_string, | 1378 FieldDescriptor value_descr(value_string, |
| 1374 JSGeneratorObject::kResultValuePropertyIndex, | 1379 JSGeneratorObject::kResultValuePropertyIndex, |
| 1375 NONE, | 1380 NONE, |
| 1376 Representation::Tagged()); | 1381 Representation::Tagged()); |
| 1377 generator_result_map->AppendDescriptor(&value_descr); | 1382 iterator_result_map->AppendDescriptor(&value_descr); |
| 1378 | 1383 |
| 1379 Handle<String> done_string = factory()->InternalizeOneByteString( | 1384 Handle<String> done_string = factory()->InternalizeOneByteString( |
| 1380 STATIC_ASCII_VECTOR("done")); | 1385 STATIC_ASCII_VECTOR("done")); |
| 1381 FieldDescriptor done_descr(done_string, | 1386 FieldDescriptor done_descr(done_string, |
| 1382 JSGeneratorObject::kResultDonePropertyIndex, | 1387 JSGeneratorObject::kResultDonePropertyIndex, |
| 1383 NONE, | 1388 NONE, |
| 1384 Representation::Tagged()); | 1389 Representation::Tagged()); |
| 1385 generator_result_map->AppendDescriptor(&done_descr); | 1390 iterator_result_map->AppendDescriptor(&done_descr); |
| 1386 | 1391 |
| 1387 generator_result_map->set_unused_property_fields(0); | 1392 iterator_result_map->set_unused_property_fields(0); |
| 1388 ASSERT_EQ(JSGeneratorObject::kResultSize, | 1393 ASSERT_EQ(JSGeneratorObject::kResultSize, |
| 1389 generator_result_map->instance_size()); | 1394 iterator_result_map->instance_size()); |
| 1390 native_context()->set_generator_result_map(*generator_result_map); | 1395 native_context()->set_iterator_result_map(*iterator_result_map); |
| 1396 } | |
| 1397 | |
| 1398 if (FLAG_harmony_collections) { | |
| 1399 { // -- S e t I t e r a t o r | |
| 1400 Handle<Map> map = isolate()->factory()->NewMap( | |
|
adamk
2014/04/14 22:46:38
Please move these up to their associated collectio
arv (Not doing code reviews)
2014/04/15 00:29:17
Done.
| |
| 1401 JS_SET_ITERATOR_TYPE, JSSetIterator::kSize); | |
| 1402 native_context()->set_set_iterator_map(*map); | |
| 1403 } | |
| 1404 { // -- M a p I t e r a t o r | |
| 1405 Handle<Map> map = isolate()->factory()->NewMap( | |
| 1406 JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize); | |
| 1407 native_context()->set_map_iterator_map(*map); | |
| 1408 } | |
| 1391 } | 1409 } |
| 1392 } | 1410 } |
| 1393 | 1411 |
| 1394 | 1412 |
| 1395 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1413 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
| 1396 Vector<const char> name = Natives::GetScriptName(index); | 1414 Vector<const char> name = Natives::GetScriptName(index); |
| 1397 Handle<String> source_code = | 1415 Handle<String> source_code = |
| 1398 isolate->bootstrapper()->NativesSourceLookup(index); | 1416 isolate->bootstrapper()->NativesSourceLookup(index); |
| 1399 return CompileNative(isolate, name, source_code); | 1417 return CompileNative(isolate, name, source_code); |
| 1400 } | 1418 } |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2688 return from + sizeof(NestingCounterType); | 2706 return from + sizeof(NestingCounterType); |
| 2689 } | 2707 } |
| 2690 | 2708 |
| 2691 | 2709 |
| 2692 // Called when the top-level V8 mutex is destroyed. | 2710 // Called when the top-level V8 mutex is destroyed. |
| 2693 void Bootstrapper::FreeThreadResources() { | 2711 void Bootstrapper::FreeThreadResources() { |
| 2694 ASSERT(!IsActive()); | 2712 ASSERT(!IsActive()); |
| 2695 } | 2713 } |
| 2696 | 2714 |
| 2697 } } // namespace v8::internal | 2715 } } // namespace v8::internal |
| OLD | NEW |