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

Side by Side Diff: src/bootstrapper.cc

Issue 238973011: Revert "ES6: Add support for Map/Set forEach" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/array-iterator.js ('k') | src/collection.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 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 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 { // -- M a p 1297 { // -- M a p
1298 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, 1298 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize,
1299 isolate()->initial_object_prototype(), 1299 isolate()->initial_object_prototype(),
1300 Builtins::kIllegal, true, true); 1300 Builtins::kIllegal, true, true);
1301 } 1301 }
1302 { // -- S e t 1302 { // -- S e t
1303 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize, 1303 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize,
1304 isolate()->initial_object_prototype(), 1304 isolate()->initial_object_prototype(),
1305 Builtins::kIllegal, true, true); 1305 Builtins::kIllegal, true, true);
1306 } 1306 }
1307 { // -- S e t I t e r a t o r
1308 Handle<Map> map = isolate()->factory()->NewMap(
1309 JS_SET_ITERATOR_TYPE, JSSetIterator::kSize);
1310 native_context()->set_set_iterator_map(*map);
1311 }
1312 { // -- M a p I t e r a t o r
1313 Handle<Map> map = isolate()->factory()->NewMap(
1314 JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize);
1315 native_context()->set_map_iterator_map(*map);
1316 }
1317 } 1307 }
1318 1308
1319 if (FLAG_harmony_weak_collections) { 1309 if (FLAG_harmony_weak_collections) {
1320 { // -- W e a k M a p 1310 { // -- W e a k M a p
1321 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, 1311 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1322 isolate()->initial_object_prototype(), 1312 isolate()->initial_object_prototype(),
1323 Builtins::kIllegal, true, true); 1313 Builtins::kIllegal, true, true);
1324 } 1314 }
1325 { // -- W e a k S e t 1315 { // -- W e a k S e t
1326 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, 1316 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 native_context()->set_strict_generator_function_map( 1351 native_context()->set_strict_generator_function_map(
1362 *strict_mode_generator_function_map); 1352 *strict_mode_generator_function_map);
1363 1353
1364 Handle<JSFunction> object_function(native_context()->object_function()); 1354 Handle<JSFunction> object_function(native_context()->object_function());
1365 Handle<Map> generator_object_prototype_map = Map::Create( 1355 Handle<Map> generator_object_prototype_map = Map::Create(
1366 object_function, 0); 1356 object_function, 0);
1367 generator_object_prototype_map->set_prototype( 1357 generator_object_prototype_map->set_prototype(
1368 *generator_object_prototype); 1358 *generator_object_prototype);
1369 native_context()->set_generator_object_prototype_map( 1359 native_context()->set_generator_object_prototype_map(
1370 *generator_object_prototype_map); 1360 *generator_object_prototype_map);
1371 }
1372 1361
1373 if (FLAG_harmony_collections || FLAG_harmony_generators) { 1362 // Create a map for generator result objects.
1374 // Collection forEach uses an iterator result object. 1363 ASSERT(object_function->initial_map()->inobject_properties() == 0);
1375 // Generators return iteraror result objects.
1376
1377 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); 1364 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2);
1378 Handle<JSFunction> object_function(native_context()->object_function()); 1365 Handle<Map> generator_result_map = Map::Create(
1379 ASSERT(object_function->initial_map()->inobject_properties() == 0);
1380 Handle<Map> iterator_result_map = Map::Create(
1381 object_function, JSGeneratorObject::kResultPropertyCount); 1366 object_function, JSGeneratorObject::kResultPropertyCount);
1382 ASSERT(iterator_result_map->inobject_properties() == 1367 ASSERT(generator_result_map->inobject_properties() ==
1383 JSGeneratorObject::kResultPropertyCount); 1368 JSGeneratorObject::kResultPropertyCount);
1384 Map::EnsureDescriptorSlack( 1369 Map::EnsureDescriptorSlack(
1385 iterator_result_map, JSGeneratorObject::kResultPropertyCount); 1370 generator_result_map, JSGeneratorObject::kResultPropertyCount);
1386 1371
1387 FieldDescriptor value_descr(isolate()->factory()->value_string(), 1372 Handle<String> value_string = factory()->InternalizeOneByteString(
1373 STATIC_ASCII_VECTOR("value"));
1374 FieldDescriptor value_descr(value_string,
1388 JSGeneratorObject::kResultValuePropertyIndex, 1375 JSGeneratorObject::kResultValuePropertyIndex,
1389 NONE, 1376 NONE,
1390 Representation::Tagged()); 1377 Representation::Tagged());
1391 iterator_result_map->AppendDescriptor(&value_descr); 1378 generator_result_map->AppendDescriptor(&value_descr);
1392 1379
1393 FieldDescriptor done_descr(isolate()->factory()->done_string(), 1380 Handle<String> done_string = factory()->InternalizeOneByteString(
1381 STATIC_ASCII_VECTOR("done"));
1382 FieldDescriptor done_descr(done_string,
1394 JSGeneratorObject::kResultDonePropertyIndex, 1383 JSGeneratorObject::kResultDonePropertyIndex,
1395 NONE, 1384 NONE,
1396 Representation::Tagged()); 1385 Representation::Tagged());
1397 iterator_result_map->AppendDescriptor(&done_descr); 1386 generator_result_map->AppendDescriptor(&done_descr);
1398 1387
1399 iterator_result_map->set_unused_property_fields(0); 1388 generator_result_map->set_unused_property_fields(0);
1400 ASSERT_EQ(JSGeneratorObject::kResultSize, 1389 ASSERT_EQ(JSGeneratorObject::kResultSize,
1401 iterator_result_map->instance_size()); 1390 generator_result_map->instance_size());
1402 native_context()->set_iterator_result_map(*iterator_result_map); 1391 native_context()->set_generator_result_map(*generator_result_map);
1403 } 1392 }
1404 } 1393 }
1405 1394
1406 1395
1407 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { 1396 bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
1408 Vector<const char> name = Natives::GetScriptName(index); 1397 Vector<const char> name = Natives::GetScriptName(index);
1409 Handle<String> source_code = 1398 Handle<String> source_code =
1410 isolate->bootstrapper()->NativesSourceLookup(index); 1399 isolate->bootstrapper()->NativesSourceLookup(index);
1411 return CompileNative(isolate, name, source_code); 1400 return CompileNative(isolate, name, source_code);
1412 } 1401 }
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 return from + sizeof(NestingCounterType); 2665 return from + sizeof(NestingCounterType);
2677 } 2666 }
2678 2667
2679 2668
2680 // Called when the top-level V8 mutex is destroyed. 2669 // Called when the top-level V8 mutex is destroyed.
2681 void Bootstrapper::FreeThreadResources() { 2670 void Bootstrapper::FreeThreadResources() {
2682 ASSERT(!IsActive()); 2671 ASSERT(!IsActive());
2683 } 2672 }
2684 2673
2685 } } // namespace v8::internal 2674 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array-iterator.js ('k') | src/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698