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

Unified Diff: src/contexts.cc

Issue 2314483002: Store the ScopeInfo in WithContexts (Closed)
Patch Set: updates 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-operator.cc ('k') | src/debug/debug-evaluate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 3c9e471479453a0c0e11a2e92d0e1b9f70e87898..01ce0d2a7f2bf77550ec013e86e0a45d75e76eaa 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -101,20 +101,21 @@ JSObject* Context::extension_object() {
return JSObject::cast(object);
}
-
JSReceiver* Context::extension_receiver() {
DCHECK(IsNativeContext() || IsWithContext() ||
IsFunctionContext() || IsBlockContext());
- return IsWithContext() ? JSReceiver::cast(extension()) : extension_object();
+ return IsWithContext() ? JSReceiver::cast(
+ ContextExtension::cast(extension())->extension())
+ : extension_object();
}
-
ScopeInfo* Context::scope_info() {
DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext() ||
- IsCatchContext());
+ IsCatchContext() || IsWithContext() || IsDebugEvaluateContext());
HeapObject* object = extension();
if (object->IsContextExtension()) {
- DCHECK(IsBlockContext() || IsCatchContext());
+ DCHECK(IsBlockContext() || IsCatchContext() || IsWithContext() ||
+ IsDebugEvaluateContext());
object = ContextExtension::cast(object)->scope_info();
}
return ScopeInfo::cast(object);
@@ -340,18 +341,21 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
} else if (context->IsDebugEvaluateContext()) {
// Check materialized locals.
- Object* obj = context->get(EXTENSION_INDEX);
- if (obj->IsJSReceiver()) {
- Handle<JSReceiver> extension(JSReceiver::cast(obj));
- LookupIterator it(extension, name, extension);
- Maybe<bool> found = JSReceiver::HasProperty(&it);
- if (found.FromMaybe(false)) {
- *attributes = NONE;
- return extension;
+ Object* ext = context->get(EXTENSION_INDEX);
+ if (ext->IsContextExtension()) {
+ Object* obj = ContextExtension::cast(ext)->extension();
+ if (obj->IsJSReceiver()) {
+ Handle<JSReceiver> extension(JSReceiver::cast(obj));
+ LookupIterator it(extension, name, extension);
+ Maybe<bool> found = JSReceiver::HasProperty(&it);
+ if (found.FromMaybe(false)) {
+ *attributes = NONE;
+ return extension;
+ }
}
}
// Check the original context, but do not follow its context chain.
- obj = context->get(WRAPPED_CONTEXT_INDEX);
+ Object* obj = context->get(WRAPPED_CONTEXT_INDEX);
if (obj->IsContext()) {
Handle<Object> result =
Context::cast(obj)->Lookup(name, DONT_FOLLOW_CHAINS, index,
« no previous file with comments | « src/compiler/js-operator.cc ('k') | src/debug/debug-evaluate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698