| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/conversions-inl.h" | 8 #include "src/conversions-inl.h" |
| 9 #include "src/factory.h" | 9 #include "src/factory.h" |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 RUNTIME_FUNCTION(Runtime_SetIteratorInitialize) { | 88 RUNTIME_FUNCTION(Runtime_SetIteratorInitialize) { |
| 89 HandleScope scope(isolate); | 89 HandleScope scope(isolate); |
| 90 DCHECK(args.length() == 3); | 90 DCHECK(args.length() == 3); |
| 91 CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0); | 91 CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0); |
| 92 CONVERT_ARG_HANDLE_CHECKED(JSSet, set, 1); | 92 CONVERT_ARG_HANDLE_CHECKED(JSSet, set, 1); |
| 93 CONVERT_SMI_ARG_CHECKED(kind, 2) | 93 CONVERT_SMI_ARG_CHECKED(kind, 2) |
| 94 CHECK(kind == JSSetIterator::kKindValues || | 94 CHECK(kind == JSSetIterator::kKindValues || |
| 95 kind == JSSetIterator::kKindEntries); | 95 kind == JSSetIterator::kKindEntries); |
| 96 Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table())); | 96 Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table())); |
| 97 holder->set_table(*table); | 97 holder->set_table(*table); |
| 98 holder->set_index(Smi::FromInt(0)); | 98 holder->set_index(Smi::kZero); |
| 99 holder->set_kind(Smi::FromInt(kind)); | 99 holder->set_kind(Smi::FromInt(kind)); |
| 100 return isolate->heap()->undefined_value(); | 100 return isolate->heap()->undefined_value(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 RUNTIME_FUNCTION(Runtime_SetIteratorClone) { | 104 RUNTIME_FUNCTION(Runtime_SetIteratorClone) { |
| 105 HandleScope scope(isolate); | 105 HandleScope scope(isolate); |
| 106 DCHECK(args.length() == 1); | 106 DCHECK(args.length() == 1); |
| 107 CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0); | 107 CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0); |
| 108 | 108 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 HandleScope scope(isolate); | 184 HandleScope scope(isolate); |
| 185 DCHECK(args.length() == 3); | 185 DCHECK(args.length() == 3); |
| 186 CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0); | 186 CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0); |
| 187 CONVERT_ARG_HANDLE_CHECKED(JSMap, map, 1); | 187 CONVERT_ARG_HANDLE_CHECKED(JSMap, map, 1); |
| 188 CONVERT_SMI_ARG_CHECKED(kind, 2) | 188 CONVERT_SMI_ARG_CHECKED(kind, 2) |
| 189 CHECK(kind == JSMapIterator::kKindKeys || | 189 CHECK(kind == JSMapIterator::kKindKeys || |
| 190 kind == JSMapIterator::kKindValues || | 190 kind == JSMapIterator::kKindValues || |
| 191 kind == JSMapIterator::kKindEntries); | 191 kind == JSMapIterator::kKindEntries); |
| 192 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); | 192 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); |
| 193 holder->set_table(*table); | 193 holder->set_table(*table); |
| 194 holder->set_index(Smi::FromInt(0)); | 194 holder->set_index(Smi::kZero); |
| 195 holder->set_kind(Smi::FromInt(kind)); | 195 holder->set_kind(Smi::FromInt(kind)); |
| 196 return isolate->heap()->undefined_value(); | 196 return isolate->heap()->undefined_value(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 | 199 |
| 200 RUNTIME_FUNCTION(Runtime_MapIteratorClone) { | 200 RUNTIME_FUNCTION(Runtime_MapIteratorClone) { |
| 201 HandleScope scope(isolate); | 201 HandleScope scope(isolate); |
| 202 DCHECK(args.length() == 1); | 202 DCHECK(args.length() == 1); |
| 203 CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0); | 203 CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0); |
| 204 | 204 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 for (int i = 0; count < max_values && i < table->Capacity(); i++) { | 364 for (int i = 0; count < max_values && i < table->Capacity(); i++) { |
| 365 Object* key = table->KeyAt(i); | 365 Object* key = table->KeyAt(i); |
| 366 if (table->IsKey(isolate, key)) values->set(count++, key); | 366 if (table->IsKey(isolate, key)) values->set(count++, key); |
| 367 } | 367 } |
| 368 DCHECK_EQ(max_values, count); | 368 DCHECK_EQ(max_values, count); |
| 369 } | 369 } |
| 370 return *isolate->factory()->NewJSArrayWithElements(values); | 370 return *isolate->factory()->NewJSArrayWithElements(values); |
| 371 } | 371 } |
| 372 } // namespace internal | 372 } // namespace internal |
| 373 } // namespace v8 | 373 } // namespace v8 |
| OLD | NEW |