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

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

Issue 2129563002: [ForIn] Fix HasEnumerableProperty for Proxies with null prototype (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | test/mjsunit/regress/regress-5181.js » ('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/elements.h" 8 #include "src/elements.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 case LookupIterator::JSPROXY: { 58 case LookupIterator::JSPROXY: {
59 // For proxies we have to invoke the [[GetOwnProperty]] trap. 59 // For proxies we have to invoke the [[GetOwnProperty]] trap.
60 result = JSProxy::GetPropertyAttributes(&it); 60 result = JSProxy::GetPropertyAttributes(&it);
61 if (result.IsNothing()) return MaybeHandle<Object>(); 61 if (result.IsNothing()) return MaybeHandle<Object>();
62 if (result.FromJust() == ABSENT) { 62 if (result.FromJust() == ABSENT) {
63 // Continue lookup on the proxy's prototype. 63 // Continue lookup on the proxy's prototype.
64 Handle<JSProxy> proxy = it.GetHolder<JSProxy>(); 64 Handle<JSProxy> proxy = it.GetHolder<JSProxy>();
65 Handle<Object> prototype; 65 Handle<Object> prototype;
66 ASSIGN_RETURN_ON_EXCEPTION(isolate, prototype, 66 ASSIGN_RETURN_ON_EXCEPTION(isolate, prototype,
67 JSProxy::GetPrototype(proxy), Object); 67 JSProxy::GetPrototype(proxy), Object);
68 if (prototype->IsNull(isolate)) break; 68 if (prototype->IsNull(isolate)) {
69 return isolate->factory()->undefined_value();
70 }
69 // We already have a stack-check in JSProxy::GetPrototype. 71 // We already have a stack-check in JSProxy::GetPrototype.
70 return HasEnumerableProperty( 72 return HasEnumerableProperty(
71 isolate, Handle<JSReceiver>::cast(prototype), key); 73 isolate, Handle<JSReceiver>::cast(prototype), key);
72 } else if (result.FromJust() & DONT_ENUM) { 74 } else if (result.FromJust() & DONT_ENUM) {
73 return isolate->factory()->undefined_value(); 75 return isolate->factory()->undefined_value();
74 } else { 76 } else {
75 return it.GetName(); 77 return it.GetName();
76 } 78 }
77 } 79 }
78 case LookupIterator::INTERCEPTOR: { 80 case LookupIterator::INTERCEPTOR: {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 SealHandleScope scope(isolate); 187 SealHandleScope scope(isolate);
186 DCHECK_EQ(1, args.length()); 188 DCHECK_EQ(1, args.length());
187 CONVERT_SMI_ARG_CHECKED(index, 0); 189 CONVERT_SMI_ARG_CHECKED(index, 0);
188 DCHECK_LE(0, index); 190 DCHECK_LE(0, index);
189 DCHECK_LT(index, Smi::kMaxValue); 191 DCHECK_LT(index, Smi::kMaxValue);
190 return Smi::FromInt(index + 1); 192 return Smi::FromInt(index + 1);
191 } 193 }
192 194
193 } // namespace internal 195 } // namespace internal
194 } // namespace v8 196 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5181.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698