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

Side by Side Diff: src/elements.cc

Issue 2081733002: [keys] support shadowing keys in the KeyAccumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebasing Created 4 years, 5 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 | « no previous file | src/keys.h » ('j') | src/keys.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 if (keys->filter() & SKIP_STRINGS) return; 1316 if (keys->filter() & SKIP_STRINGS) return;
1317 Isolate* isolate = keys->isolate(); 1317 Isolate* isolate = keys->isolate();
1318 Handle<SeededNumberDictionary> dictionary = 1318 Handle<SeededNumberDictionary> dictionary =
1319 Handle<SeededNumberDictionary>::cast(backing_store); 1319 Handle<SeededNumberDictionary>::cast(backing_store);
1320 int capacity = dictionary->Capacity(); 1320 int capacity = dictionary->Capacity();
1321 Handle<FixedArray> elements = isolate->factory()->NewFixedArray( 1321 Handle<FixedArray> elements = isolate->factory()->NewFixedArray(
1322 GetMaxNumberOfEntries(*object, *backing_store)); 1322 GetMaxNumberOfEntries(*object, *backing_store));
1323 int insertion_index = 0; 1323 int insertion_index = 0;
1324 PropertyFilter filter = keys->filter(); 1324 PropertyFilter filter = keys->filter();
1325 for (int i = 0; i < capacity; i++) { 1325 for (int i = 0; i < capacity; i++) {
1326 uint32_t key = GetKeyForEntryImpl(isolate, dictionary, i, filter); 1326 Object* raw_key = dictionary->KeyAt(i);
1327 if (key == kMaxUInt32) continue; 1327 if (!dictionary->IsKey(isolate, raw_key)) continue;
1328 Handle<Object> key_handle = isolate->factory()->NewNumberFromUint(key); 1328 uint32_t key = FilterKey(dictionary, i, raw_key, filter);
1329 elements->set(insertion_index, *key_handle); 1329 if (key == kMaxUInt32) {
1330 keys->AddShadowKey(raw_key);
1331 continue;
1332 }
1333 elements->set(insertion_index, raw_key);
1330 insertion_index++; 1334 insertion_index++;
1331 } 1335 }
1332 SortIndices(elements, insertion_index); 1336 SortIndices(elements, insertion_index);
1333 for (int i = 0; i < insertion_index; i++) { 1337 for (int i = 0; i < insertion_index; i++) {
1334 keys->AddKey(elements->get(i)); 1338 keys->AddKey(elements->get(i));
1335 } 1339 }
1336 } 1340 }
1337 1341
1338 static Handle<FixedArray> DirectCollectElementIndicesImpl( 1342 static Handle<FixedArray> DirectCollectElementIndicesImpl(
1339 Isolate* isolate, Handle<JSObject> object, 1343 Isolate* isolate, Handle<JSObject> object,
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 insertion_index += len; 3030 insertion_index += len;
3027 } 3031 }
3028 3032
3029 DCHECK_EQ(insertion_index, result_len); 3033 DCHECK_EQ(insertion_index, result_len);
3030 return result_array; 3034 return result_array;
3031 } 3035 }
3032 3036
3033 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3037 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3034 } // namespace internal 3038 } // namespace internal
3035 } // namespace v8 3039 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/keys.h » ('j') | src/keys.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698