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

Side by Side Diff: src/contexts.cc

Issue 1113133006: Revert of Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 7 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/compiler/ast-graph-builder.cc ('k') | src/heap/heap.h » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/debug.h" 8 #include "src/debug.h"
9 #include "src/scopeinfo.h" 9 #include "src/scopeinfo.h"
10 10
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 // Context extension objects needs to behave as if they have no 253 // Context extension objects needs to behave as if they have no
254 // prototype. So even if we want to follow prototype chains, we need 254 // prototype. So even if we want to follow prototype chains, we need
255 // to only do a local lookup for context extension objects. 255 // to only do a local lookup for context extension objects.
256 Maybe<PropertyAttributes> maybe = Nothing<PropertyAttributes>(); 256 Maybe<PropertyAttributes> maybe = Nothing<PropertyAttributes>();
257 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || 257 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 ||
258 object->IsJSContextExtensionObject()) { 258 object->IsJSContextExtensionObject()) {
259 maybe = JSReceiver::GetOwnPropertyAttributes(object, name); 259 maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
260 } else if (context->IsWithContext()) { 260 } else if (context->IsWithContext()) {
261 // A with context will never bind "this". 261 LookupIterator it(object, name);
262 if (name->Equals(*isolate->factory()->this_string())) { 262 maybe = UnscopableLookup(&it);
263 maybe = Just(ABSENT);
264 } else {
265 LookupIterator it(object, name);
266 maybe = UnscopableLookup(&it);
267 }
268 } else { 263 } else {
269 maybe = JSReceiver::GetPropertyAttributes(object, name); 264 maybe = JSReceiver::GetPropertyAttributes(object, name);
270 } 265 }
271 266
272 if (!maybe.IsJust()) return Handle<Object>(); 267 if (!maybe.IsJust()) return Handle<Object>();
273 DCHECK(!isolate->has_pending_exception()); 268 DCHECK(!isolate->has_pending_exception());
274 *attributes = maybe.FromJust(); 269 *attributes = maybe.FromJust();
275 270
276 if (maybe.FromJust() != ABSENT) { 271 if (maybe.FromJust() != ABSENT) {
277 if (FLAG_trace_contexts) { 272 if (FLAG_trace_contexts) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 488 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
494 // During bootstrapping we allow all objects to pass as global 489 // During bootstrapping we allow all objects to pass as global
495 // objects. This is necessary to fix circular dependencies. 490 // objects. This is necessary to fix circular dependencies.
496 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 491 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
497 isolate->bootstrapper()->IsActive() || 492 isolate->bootstrapper()->IsActive() ||
498 object->IsGlobalObject(); 493 object->IsGlobalObject();
499 } 494 }
500 #endif 495 #endif
501 496
502 } } // namespace v8::internal 497 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698