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

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

Issue 1668853002: [proxies] allow duplicate keys for [[OwnPropertyKeys]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressing nits Created 4 years, 10 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-object.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 namespace { 15 namespace {
16 16
17 // Returns either a FixedArray or, if the given {receiver} has an enum cache 17 // Returns either a FixedArray or, if the given {receiver} has an enum cache
18 // that contains all enumerable properties of the {receiver} and its prototypes 18 // that contains all enumerable properties of the {receiver} and its prototypes
19 // have none, the map of the {receiver}. This is used to speed up the check for 19 // have none, the map of the {receiver}. This is used to speed up the check for
20 // deletions during a for-in. 20 // deletions during a for-in.
21 MaybeHandle<HeapObject> Enumerate(Handle<JSReceiver> receiver) { 21 MaybeHandle<HeapObject> Enumerate(Handle<JSReceiver> receiver) {
22 Isolate* const isolate = receiver->GetIsolate(); 22 Isolate* const isolate = receiver->GetIsolate();
23 // Test if we have an enum cache for {receiver}. 23 // Test if we have an enum cache for {receiver}.
24 if (!receiver->IsSimpleEnum()) { 24 if (!receiver->IsSimpleEnum()) {
25 Handle<FixedArray> keys; 25 Handle<FixedArray> keys;
26 ASSIGN_RETURN_ON_EXCEPTION( 26 ASSIGN_RETURN_ON_EXCEPTION(
27 isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::INCLUDE_PROTOS, 27 isolate, keys,
28 ENUMERABLE_STRINGS), 28 JSReceiver::GetKeys(receiver, INCLUDE_PROTOS, ENUMERABLE_STRINGS),
29 HeapObject); 29 HeapObject);
30 // Test again, since cache may have been built by GetKeys() calls above. 30 // Test again, since cache may have been built by GetKeys() calls above.
31 if (!receiver->IsSimpleEnum()) return keys; 31 if (!receiver->IsSimpleEnum()) return keys;
32 } 32 }
33 return handle(receiver->map(), isolate); 33 return handle(receiver->map(), isolate);
34 } 34 }
35 35
36 36
37 MaybeHandle<Object> Filter(Handle<JSReceiver> receiver, Handle<Object> key) { 37 MaybeHandle<Object> Filter(Handle<JSReceiver> receiver, Handle<Object> key) {
38 Isolate* const isolate = receiver->GetIsolate(); 38 Isolate* const isolate = receiver->GetIsolate();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 SealHandleScope scope(isolate); 133 SealHandleScope scope(isolate);
134 DCHECK_EQ(1, args.length()); 134 DCHECK_EQ(1, args.length());
135 CONVERT_SMI_ARG_CHECKED(index, 0); 135 CONVERT_SMI_ARG_CHECKED(index, 0);
136 DCHECK_LE(0, index); 136 DCHECK_LE(0, index);
137 DCHECK_LT(index, Smi::kMaxValue); 137 DCHECK_LT(index, Smi::kMaxValue);
138 return Smi::FromInt(index + 1); 138 return Smi::FromInt(index + 1);
139 } 139 }
140 140
141 } // namespace internal 141 } // namespace internal
142 } // namespace v8 142 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698