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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/array-iterator.js ('k') | src/collection-iterator.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 "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 native_context()->set_js_map_fun(*js_map_fun); 1300 native_context()->set_js_map_fun(*js_map_fun);
1301 } 1301 }
1302 1302
1303 { // -- S e t 1303 { // -- S e t
1304 Handle<JSFunction> js_set_fun = InstallFunction( 1304 Handle<JSFunction> js_set_fun = InstallFunction(
1305 global, "Set", JS_SET_TYPE, JSSet::kSize, 1305 global, "Set", JS_SET_TYPE, JSSet::kSize,
1306 isolate->initial_object_prototype(), Builtins::kIllegal); 1306 isolate->initial_object_prototype(), Builtins::kIllegal);
1307 native_context()->set_js_set_fun(*js_set_fun); 1307 native_context()->set_js_set_fun(*js_set_fun);
1308 } 1308 }
1309 1309
1310 { // Set up the iterator result object 1310 { // -- I t e r a t o r R e s u l t
1311 STATIC_ASSERT(JSGeneratorObject::kResultPropertyCount == 2); 1311 Handle<Map> map =
1312 Handle<JSFunction> object_function(native_context()->object_function()); 1312 factory->NewMap(JS_ITERATOR_RESULT_TYPE, JSIteratorResult::kSize);
1313 Handle<Map> iterator_result_map = 1313 Map::SetPrototype(map, isolate->initial_object_prototype());
1314 Map::Create(isolate, JSGeneratorObject::kResultPropertyCount); 1314 Map::EnsureDescriptorSlack(map, 2);
1315 DCHECK_EQ(JSGeneratorObject::kResultSize,
1316 iterator_result_map->instance_size());
1317 DCHECK_EQ(JSGeneratorObject::kResultPropertyCount,
1318 iterator_result_map->GetInObjectProperties());
1319 Map::EnsureDescriptorSlack(iterator_result_map,
1320 JSGeneratorObject::kResultPropertyCount);
1321 1315
1322 DataDescriptor value_descr(factory->value_string(), 1316 { // value
1323 JSGeneratorObject::kResultValuePropertyIndex, 1317 DataDescriptor d(factory->value_string(), JSIteratorResult::kValueIndex,
1324 NONE, Representation::Tagged()); 1318 NONE, Representation::Tagged());
1325 iterator_result_map->AppendDescriptor(&value_descr); 1319 map->AppendDescriptor(&d);
1320 }
1326 1321
1327 DataDescriptor done_descr(factory->done_string(), 1322 { // done
1328 JSGeneratorObject::kResultDonePropertyIndex, NONE, 1323 DataDescriptor d(factory->done_string(), JSIteratorResult::kDoneIndex,
1329 Representation::Tagged()); 1324 NONE, Representation::Tagged());
1330 iterator_result_map->AppendDescriptor(&done_descr); 1325 map->AppendDescriptor(&d);
1326 }
1331 1327
1332 iterator_result_map->set_unused_property_fields(0); 1328 map->SetInObjectProperties(2);
1333 DCHECK_EQ(JSGeneratorObject::kResultSize, 1329 native_context()->set_iterator_result_map(*map);
1334 iterator_result_map->instance_size());
1335 native_context()->set_iterator_result_map(*iterator_result_map);
1336 } 1330 }
1337 1331
1338 // -- W e a k M a p 1332 // -- W e a k M a p
1339 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, 1333 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1340 isolate->initial_object_prototype(), Builtins::kIllegal); 1334 isolate->initial_object_prototype(), Builtins::kIllegal);
1341 // -- W e a k S e t 1335 // -- W e a k S e t
1342 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, 1336 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1343 isolate->initial_object_prototype(), Builtins::kIllegal); 1337 isolate->initial_object_prototype(), Builtins::kIllegal);
1344 1338
1345 { // --- sloppy arguments map 1339 { // --- sloppy arguments map
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
3190 } 3184 }
3191 3185
3192 3186
3193 // Called when the top-level V8 mutex is destroyed. 3187 // Called when the top-level V8 mutex is destroyed.
3194 void Bootstrapper::FreeThreadResources() { 3188 void Bootstrapper::FreeThreadResources() {
3195 DCHECK(!IsActive()); 3189 DCHECK(!IsActive());
3196 } 3190 }
3197 3191
3198 } // namespace internal 3192 } // namespace internal
3199 } // namespace v8 3193 } // namespace v8
OLDNEW
« 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