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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } |
| 1306 { // -- S e t I t e r a t o r | |
| 1307 Handle<Map> map = isolate()->factory()->NewMap( | |
| 1308 JS_SET_ITERATOR_TYPE, JSSetIterator::kSize); | |
| 1309 native_context()->set_set_iterator_map(*map); | |
| 1310 } | |
| 1311 { // -- M a p I t e r a t o r | |
| 1312 Handle<Map> map = isolate()->factory()->NewMap( | |
| 1313 JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize); | |
| 1314 native_context()->set_map_iterator_map(*map); | |
| 1315 } | |
| 1306 } | 1316 } |
| 1307 | 1317 |
| 1308 if (FLAG_harmony_weak_collections) { | 1318 if (FLAG_harmony_weak_collections) { |
| 1309 { // -- W e a k M a p | 1319 { // -- W e a k M a p |
| 1310 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, | 1320 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, |
| 1311 isolate()->initial_object_prototype(), | 1321 isolate()->initial_object_prototype(), |
| 1312 Builtins::kIllegal, true, true); | 1322 Builtins::kIllegal, true, true); |
| 1313 } | 1323 } |
| 1314 { // -- W e a k S e t | 1324 { // -- W e a k S e t |
| 1315 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, | 1325 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1350 native_context()->set_strict_generator_function_map( | 1360 native_context()->set_strict_generator_function_map( |
| 1351 *strict_mode_generator_function_map); | 1361 *strict_mode_generator_function_map); |
| 1352 | 1362 |
| 1353 Handle<JSFunction> object_function(native_context()->object_function()); | 1363 Handle<JSFunction> object_function(native_context()->object_function()); |
| 1354 Handle<Map> generator_object_prototype_map = Map::Create( | 1364 Handle<Map> generator_object_prototype_map = Map::Create( |
| 1355 object_function, 0); | 1365 object_function, 0); |
| 1356 generator_object_prototype_map->set_prototype( | 1366 generator_object_prototype_map->set_prototype( |
| 1357 *generator_object_prototype); | 1367 *generator_object_prototype); |
| 1358 native_context()->set_generator_object_prototype_map( | 1368 native_context()->set_generator_object_prototype_map( |
| 1359 *generator_object_prototype_map); | 1369 *generator_object_prototype_map); |
| 1370 ASSERT(object_function->initial_map()->inobject_properties() == 0); | |
|
Michael Starzinger
2014/04/15 16:13:56
nit: This assert belongs to the code creating the
arv (Not doing code reviews)
2014/04/15 17:07:23
Done.
| |
| 1371 } | |
| 1360 | 1372 |
| 1361 // Create a map for generator result objects. | 1373 if (FLAG_harmony_collections || FLAG_harmony_generators) { |
| 1362 ASSERT(object_function->initial_map()->inobject_properties() == 0); | 1374 // Collection forEach uses an iterator result object. |
| 1375 // Generators return iteraror result objects. | |
| 1376 | |
| 1363 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); | 1377 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); |
| 1364 Handle<Map> generator_result_map = Map::Create( | 1378 Handle<JSFunction> object_function(native_context()->object_function()); |
| 1379 Handle<Map> iterator_result_map = Map::Create( | |
| 1365 object_function, JSGeneratorObject::kResultPropertyCount); | 1380 object_function, JSGeneratorObject::kResultPropertyCount); |
| 1366 ASSERT(generator_result_map->inobject_properties() == | 1381 ASSERT(iterator_result_map->inobject_properties() == |
| 1367 JSGeneratorObject::kResultPropertyCount); | 1382 JSGeneratorObject::kResultPropertyCount); |
| 1368 Map::EnsureDescriptorSlack( | 1383 Map::EnsureDescriptorSlack( |
| 1369 generator_result_map, JSGeneratorObject::kResultPropertyCount); | 1384 iterator_result_map, JSGeneratorObject::kResultPropertyCount); |
| 1370 | 1385 |
| 1371 Handle<String> value_string = factory()->InternalizeOneByteString( | 1386 Handle<String> value_string = factory()->InternalizeOneByteString( |
| 1372 STATIC_ASCII_VECTOR("value")); | 1387 STATIC_ASCII_VECTOR("value")); |
| 1373 FieldDescriptor value_descr(value_string, | 1388 FieldDescriptor value_descr(value_string, |
| 1374 JSGeneratorObject::kResultValuePropertyIndex, | 1389 JSGeneratorObject::kResultValuePropertyIndex, |
| 1375 NONE, | 1390 NONE, |
| 1376 Representation::Tagged()); | 1391 Representation::Tagged()); |
| 1377 generator_result_map->AppendDescriptor(&value_descr); | 1392 iterator_result_map->AppendDescriptor(&value_descr); |
| 1378 | 1393 |
| 1379 Handle<String> done_string = factory()->InternalizeOneByteString( | 1394 Handle<String> done_string = factory()->InternalizeOneByteString( |
| 1380 STATIC_ASCII_VECTOR("done")); | 1395 STATIC_ASCII_VECTOR("done")); |
| 1381 FieldDescriptor done_descr(done_string, | 1396 FieldDescriptor done_descr(done_string, |
| 1382 JSGeneratorObject::kResultDonePropertyIndex, | 1397 JSGeneratorObject::kResultDonePropertyIndex, |
| 1383 NONE, | 1398 NONE, |
| 1384 Representation::Tagged()); | 1399 Representation::Tagged()); |
| 1385 generator_result_map->AppendDescriptor(&done_descr); | 1400 iterator_result_map->AppendDescriptor(&done_descr); |
| 1386 | 1401 |
| 1387 generator_result_map->set_unused_property_fields(0); | 1402 iterator_result_map->set_unused_property_fields(0); |
| 1388 ASSERT_EQ(JSGeneratorObject::kResultSize, | 1403 ASSERT_EQ(JSGeneratorObject::kResultSize, |
| 1389 generator_result_map->instance_size()); | 1404 iterator_result_map->instance_size()); |
| 1390 native_context()->set_generator_result_map(*generator_result_map); | 1405 native_context()->set_iterator_result_map(*iterator_result_map); |
| 1391 } | 1406 } |
| 1392 } | 1407 } |
| 1393 | 1408 |
| 1394 | 1409 |
| 1395 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1410 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
| 1396 Vector<const char> name = Natives::GetScriptName(index); | 1411 Vector<const char> name = Natives::GetScriptName(index); |
| 1397 Handle<String> source_code = | 1412 Handle<String> source_code = |
| 1398 isolate->bootstrapper()->NativesSourceLookup(index); | 1413 isolate->bootstrapper()->NativesSourceLookup(index); |
| 1399 return CompileNative(isolate, name, source_code); | 1414 return CompileNative(isolate, name, source_code); |
| 1400 } | 1415 } |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2688 return from + sizeof(NestingCounterType); | 2703 return from + sizeof(NestingCounterType); |
| 2689 } | 2704 } |
| 2690 | 2705 |
| 2691 | 2706 |
| 2692 // Called when the top-level V8 mutex is destroyed. | 2707 // Called when the top-level V8 mutex is destroyed. |
| 2693 void Bootstrapper::FreeThreadResources() { | 2708 void Bootstrapper::FreeThreadResources() { |
| 2694 ASSERT(!IsActive()); | 2709 ASSERT(!IsActive()); |
| 2695 } | 2710 } |
| 2696 | 2711 |
| 2697 } } // namespace v8::internal | 2712 } } // namespace v8::internal |
| OLD | NEW |