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

Side by Side Diff: src/objects.cc

Issue 259883002: ES6: Add support for Map and Set Iterator (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review changes Created 6 years, 6 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/objects.h ('k') | src/objects-debug.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "allocation-site-scopes.h" 8 #include "allocation-site-scopes.h"
9 #include "api.h" 9 #include "api.h"
10 #include "arguments.h" 10 #include "arguments.h"
(...skipping 16596 matching lines...) Expand 10 before | Expand all | Expand 10 after
16607 } 16607 }
16608 16608
16609 table = next_table; 16609 table = next_table;
16610 } 16610 }
16611 16611
16612 set_table(*table); 16612 set_table(*table);
16613 set_index(Smi::FromInt(index)); 16613 set_index(Smi::FromInt(index));
16614 } 16614 }
16615 16615
16616 16616
16617 template<class Derived, class TableType>
16618 Handle<Derived> OrderedHashTableIterator<Derived, TableType>::CreateInternal(
16619 Handle<Map> map,
16620 Handle<TableType> table,
16621 int kind) {
16622 Isolate* isolate = table->GetIsolate();
16623
16624 Handle<Derived> new_iterator = Handle<Derived>::cast(
16625 isolate->factory()->NewJSObjectFromMap(map));
16626 new_iterator->set_table(*table);
16627 new_iterator->set_index(Smi::FromInt(0));
16628 new_iterator->set_kind(Smi::FromInt(kind));
16629 return new_iterator;
16630 }
16631
16632
16633 template Handle<JSObject> 16617 template Handle<JSObject>
16634 OrderedHashTableIterator<JSSetIterator, OrderedHashSet>::Next( 16618 OrderedHashTableIterator<JSSetIterator, OrderedHashSet>::Next(
16635 Handle<JSSetIterator> iterator); 16619 Handle<JSSetIterator> iterator);
16636 16620
16637 template void 16621 template void
16638 OrderedHashTableIterator<JSSetIterator, OrderedHashSet>::Transition(); 16622 OrderedHashTableIterator<JSSetIterator, OrderedHashSet>::Transition();
16639 16623
16640 template Handle<JSSetIterator>
16641 OrderedHashTableIterator<JSSetIterator, OrderedHashSet>::CreateInternal(
16642 Handle<Map> map, Handle<OrderedHashSet> table, int kind);
16643
16644 16624
16645 template Handle<JSObject> 16625 template Handle<JSObject>
16646 OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::Next( 16626 OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::Next(
16647 Handle<JSMapIterator> iterator); 16627 Handle<JSMapIterator> iterator);
16648 16628
16649 template void 16629 template void
16650 OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::Transition(); 16630 OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::Transition();
16651 16631
16652 template Handle<JSMapIterator>
16653 OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::CreateInternal(
16654 Handle<Map> map, Handle<OrderedHashMap> table, int kind);
16655
16656 16632
16657 Handle<Object> JSSetIterator::ValueForKind( 16633 Handle<Object> JSSetIterator::ValueForKind(
16658 Handle<JSSetIterator> iterator, int entry_index) { 16634 Handle<JSSetIterator> iterator, int entry_index) {
16659 int kind = iterator->kind()->value(); 16635 int kind = iterator->kind()->value();
16660 // Set.prototype only has values and entries. 16636 // Set.prototype only has values and entries.
16661 ASSERT(kind == kKindValues || kind == kKindEntries); 16637 ASSERT(kind == kKindValues || kind == kKindEntries);
16662 16638
16663 Isolate* isolate = iterator->GetIsolate(); 16639 Isolate* isolate = iterator->GetIsolate();
16664 Factory* factory = isolate->factory(); 16640 Factory* factory = isolate->factory();
16665 16641
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
17296 #define ERROR_MESSAGES_TEXTS(C, T) T, 17272 #define ERROR_MESSAGES_TEXTS(C, T) T,
17297 static const char* error_messages_[] = { 17273 static const char* error_messages_[] = {
17298 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17274 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17299 }; 17275 };
17300 #undef ERROR_MESSAGES_TEXTS 17276 #undef ERROR_MESSAGES_TEXTS
17301 return error_messages_[reason]; 17277 return error_messages_[reason];
17302 } 17278 }
17303 17279
17304 17280
17305 } } // namespace v8::internal 17281 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698