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

Unified Diff: src/bootstrapper.cc

Issue 1302173007: [es6] Introduce a dedicated JSIteratorResult type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/array-iterator.js ('k') | src/collection-iterator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 65dbaebdba781312618fbb87c8c0c47fca7109ff..a940eb900d12aa773b251df80f590cf11eb6bcc6 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1307,32 +1307,26 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
native_context()->set_js_set_fun(*js_set_fun);
}
- { // Set up the iterator result object
- STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2);
- Handle<JSFunction> object_function(native_context()->object_function());
- Handle<Map> iterator_result_map =
- Map::Create(isolate, JSGeneratorObject::kResultPropertyCount);
- DCHECK_EQ(JSGeneratorObject::kResultSize,
- iterator_result_map->instance_size());
- DCHECK_EQ(JSGeneratorObject::kResultPropertyCount,
- iterator_result_map->GetInObjectProperties());
- Map::EnsureDescriptorSlack(iterator_result_map,
- JSGeneratorObject::kResultPropertyCount);
-
- DataDescriptor value_descr(factory->value_string(),
- JSGeneratorObject::kResultValuePropertyIndex,
- NONE, Representation::Tagged());
- iterator_result_map->AppendDescriptor(&value_descr);
-
- DataDescriptor done_descr(factory->done_string(),
- JSGeneratorObject::kResultDonePropertyIndex, NONE,
- Representation::Tagged());
- iterator_result_map->AppendDescriptor(&done_descr);
-
- iterator_result_map->set_unused_property_fields(0);
- DCHECK_EQ(JSGeneratorObject::kResultSize,
- iterator_result_map->instance_size());
- native_context()->set_iterator_result_map(*iterator_result_map);
+ { // -- I t e r a t o r R e s u l t
+ Handle<Map> map =
+ factory->NewMap(JS_ITERATOR_RESULT_TYPE, JSIteratorResult::kSize);
+ Map::SetPrototype(map, isolate->initial_object_prototype());
+ Map::EnsureDescriptorSlack(map, 2);
+
+ { // value
+ DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex,
+ NONE, Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+
+ { // done
+ DataDescriptor d(factory->done_string(), JSIteratorResult::kDoneIndex,
+ NONE, Representation::Tagged());
+ map->AppendDescriptor(&d);
+ }
+
+ map->SetInObjectProperties(2);
+ native_context()->set_iterator_result_map(*map);
}
// -- W e a k M a p
« no previous file with comments | « src/array-iterator.js ('k') | src/collection-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698