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

Side by Side Diff: src/contexts.cc

Issue 2353623002: Filter out synthetic variables from with scopes (Closed)
Patch Set: Minimal fix Created 4 years, 3 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-5405.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/contexts.h" 5 #include "src/contexts.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 10
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 255
256 // Context extension objects needs to behave as if they have no 256 // Context extension objects needs to behave as if they have no
257 // prototype. So even if we want to follow prototype chains, we need 257 // prototype. So even if we want to follow prototype chains, we need
258 // to only do a local lookup for context extension objects. 258 // to only do a local lookup for context extension objects.
259 Maybe<PropertyAttributes> maybe = Nothing<PropertyAttributes>(); 259 Maybe<PropertyAttributes> maybe = Nothing<PropertyAttributes>();
260 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || 260 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 ||
261 object->IsJSContextExtensionObject()) { 261 object->IsJSContextExtensionObject()) {
262 maybe = JSReceiver::GetOwnPropertyAttributes(object, name); 262 maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
263 } else if (context->IsWithContext()) { 263 } else if (context->IsWithContext()) {
264 // A with context will never bind "this". 264 // A with context will never bind "this", but debug-eval may look into
265 if (name->Equals(*isolate->factory()->this_string())) { 265 // a with context when resolving "this". Other synthetic variables such
266 // as new.target may be resolved as DYNAMIC_LOCAL due to bug v8:5405 ,
267 // skipping them here serves as a workaround until a more thorough
268 // fix can be applied.
269 // TODO(v8:5405): Replace this check with a DCHECK when resolution of
270 // of synthetic variables does not go through this code path.
271 if (ScopeInfo::VariableIsSynthetic(*name)) {
266 maybe = Just(ABSENT); 272 maybe = Just(ABSENT);
267 } else { 273 } else {
268 LookupIterator it(object, name, object); 274 LookupIterator it(object, name, object);
269 Maybe<bool> found = UnscopableLookup(&it); 275 Maybe<bool> found = UnscopableLookup(&it);
270 if (found.IsNothing()) { 276 if (found.IsNothing()) {
271 maybe = Nothing<PropertyAttributes>(); 277 maybe = Nothing<PropertyAttributes>();
272 } else { 278 } else {
273 // Luckily, consumers of |maybe| only care whether the property 279 // Luckily, consumers of |maybe| only care whether the property
274 // was absent or not, so we can return a dummy |NONE| value 280 // was absent or not, so we can return a dummy |NONE| value
275 // for its attributes when it was present. 281 // for its attributes when it was present.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 588
583 int previous_value = errors_thrown()->value(); 589 int previous_value = errors_thrown()->value();
584 set_errors_thrown(Smi::FromInt(previous_value + 1)); 590 set_errors_thrown(Smi::FromInt(previous_value + 1));
585 } 591 }
586 592
587 593
588 int Context::GetErrorsThrown() { return errors_thrown()->value(); } 594 int Context::GetErrorsThrown() { return errors_thrown()->value(); }
589 595
590 } // namespace internal 596 } // namespace internal
591 } // namespace v8 597 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5405.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698