OLD | NEW |
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 Loading... |
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 Loading... |
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // isolate. If it's called more often, the map should be moved into the | 365 // isolate. If it's called more often, the map should be moved into the |
338 // strong root list. | 366 // strong root list. |
339 Handle<Map> map = | 367 Handle<Map> map = |
340 isolate->factory()->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); | 368 isolate->factory()->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); |
341 Handle<JSWeakMap> weakmap = | 369 Handle<JSWeakMap> weakmap = |
342 Handle<JSWeakMap>::cast(isolate->factory()->NewJSObjectFromMap(map)); | 370 Handle<JSWeakMap>::cast(isolate->factory()->NewJSObjectFromMap(map)); |
343 return *WeakCollectionInitialize(isolate, weakmap); | 371 return *WeakCollectionInitialize(isolate, weakmap); |
344 } | 372 } |
345 } | 373 } |
346 } // namespace v8::internal | 374 } // namespace v8::internal |
OLD | NEW |