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

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

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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/runtime/runtime-array.cc ('k') | src/runtime/runtime-compiler.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 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
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::kZero); 98 holder->set_index(Smi::FromInt(0));
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
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::kZero); 194 holder->set_index(Smi::FromInt(0));
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
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
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698