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

Side by Side Diff: src/runtime/runtime-collections.cc

Issue 693813002: Add debug mirror support for ES6 Map/Set iterators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added TODO Created 6 years, 1 month 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/runtime/runtime.h ('k') | test/mjsunit/es6/mirror-iterators.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/runtime/runtime-utils.h" 8 #include "src/runtime/runtime-utils.h"
9 9
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 RUNTIME_ASSERT(kind == JSSetIterator::kKindValues || 85 RUNTIME_ASSERT(kind == JSSetIterator::kKindValues ||
86 kind == JSSetIterator::kKindEntries); 86 kind == JSSetIterator::kKindEntries);
87 Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table())); 87 Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
88 holder->set_table(*table); 88 holder->set_table(*table);
89 holder->set_index(Smi::FromInt(0)); 89 holder->set_index(Smi::FromInt(0));
90 holder->set_kind(Smi::FromInt(kind)); 90 holder->set_kind(Smi::FromInt(kind));
91 return isolate->heap()->undefined_value(); 91 return isolate->heap()->undefined_value();
92 } 92 }
93 93
94 94
95 RUNTIME_FUNCTION(Runtime_SetIteratorClone) {
96 HandleScope scope(isolate);
97 DCHECK(args.length() == 1);
98 CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0);
99
100 Handle<JSSetIterator> result = isolate->factory()->NewJSSetIterator();
101 result->set_table(holder->table());
102 result->set_index(Smi::FromInt(Smi::cast(holder->index())->value()));
103 result->set_kind(Smi::FromInt(Smi::cast(holder->kind())->value()));
104
105 return *result;
106 }
107
108
95 RUNTIME_FUNCTION(Runtime_SetIteratorNext) { 109 RUNTIME_FUNCTION(Runtime_SetIteratorNext) {
96 SealHandleScope shs(isolate); 110 SealHandleScope shs(isolate);
97 DCHECK(args.length() == 2); 111 DCHECK(args.length() == 2);
98 CONVERT_ARG_CHECKED(JSSetIterator, holder, 0); 112 CONVERT_ARG_CHECKED(JSSetIterator, holder, 0);
99 CONVERT_ARG_CHECKED(JSArray, value_array, 1); 113 CONVERT_ARG_CHECKED(JSArray, value_array, 1);
100 return holder->Next(value_array); 114 return holder->Next(value_array);
101 } 115 }
102 116
103 117
104 RUNTIME_FUNCTION(Runtime_MapInitialize) { 118 RUNTIME_FUNCTION(Runtime_MapInitialize) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 kind == JSMapIterator::kKindValues || 204 kind == JSMapIterator::kKindValues ||
191 kind == JSMapIterator::kKindEntries); 205 kind == JSMapIterator::kKindEntries);
192 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); 206 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
193 holder->set_table(*table); 207 holder->set_table(*table);
194 holder->set_index(Smi::FromInt(0)); 208 holder->set_index(Smi::FromInt(0));
195 holder->set_kind(Smi::FromInt(kind)); 209 holder->set_kind(Smi::FromInt(kind));
196 return isolate->heap()->undefined_value(); 210 return isolate->heap()->undefined_value();
197 } 211 }
198 212
199 213
214 RUNTIME_FUNCTION(Runtime_MapIteratorClone) {
215 HandleScope scope(isolate);
216 DCHECK(args.length() == 1);
217 CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0);
218
219 Handle<JSMapIterator> result = isolate->factory()->NewJSMapIterator();
220 result->set_table(holder->table());
221 result->set_index(Smi::FromInt(Smi::cast(holder->index())->value()));
222 result->set_kind(Smi::FromInt(Smi::cast(holder->kind())->value()));
223
224 return *result;
225 }
226
227
200 RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) { 228 RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) {
201 HandleScope scope(isolate); 229 HandleScope scope(isolate);
202 DCHECK(args.length() == 1); 230 DCHECK(args.length() == 1);
203 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); 231 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
204 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); 232 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
205 Handle<FixedArray> entries = 233 Handle<FixedArray> entries =
206 isolate->factory()->NewFixedArray(table->NumberOfElements() * 2); 234 isolate->factory()->NewFixedArray(table->NumberOfElements() * 2);
207 { 235 {
208 DisallowHeapAllocation no_gc; 236 DisallowHeapAllocation no_gc;
209 int number_of_non_hole_elements = 0; 237 int number_of_non_hole_elements = 0;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // isolate. If it's called more often, the map should be moved into the 373 // isolate. If it's called more often, the map should be moved into the
346 // strong root list. 374 // strong root list.
347 Handle<Map> map = 375 Handle<Map> map =
348 isolate->factory()->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); 376 isolate->factory()->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize);
349 Handle<JSWeakMap> weakmap = 377 Handle<JSWeakMap> weakmap =
350 Handle<JSWeakMap>::cast(isolate->factory()->NewJSObjectFromMap(map)); 378 Handle<JSWeakMap>::cast(isolate->factory()->NewJSObjectFromMap(map));
351 return *WeakCollectionInitialize(isolate, weakmap); 379 return *WeakCollectionInitialize(isolate, weakmap);
352 } 380 }
353 } 381 }
354 } // namespace v8::internal 382 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/es6/mirror-iterators.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698