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

Unified Diff: src/contexts.cc

Issue 2233673003: Remove CONST_LEGACY VariableMode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 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-global-object-specialization.cc ('k') | src/crankshaft/hydrogen.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 c62eb452abfd8f766ae870a2eccdbf27f0a6812b..0822e45cd0ed71e4a878acf92ba84da04f67760d 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -178,7 +178,7 @@ static Maybe<bool> UnscopableLookup(LookupIterator* it) {
static PropertyAttributes GetAttributesForMode(VariableMode mode) {
DCHECK(IsDeclaredVariableMode(mode));
- return IsImmutableVariableMode(mode) ? READ_ONLY : NONE;
+ return mode == CONST ? READ_ONLY : NONE;
}
Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -307,10 +307,11 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
// Check the slot corresponding to the intermediate context holding
- // only the function name variable.
- if (follow_context_chain && context->IsFunctionContext()) {
- VariableMode mode;
- int function_index = scope_info->FunctionContextSlotIndex(*name, &mode);
+ // only the function name variable. It's conceptually (and spec-wise)
+ // in an outer scope of the function's declaration scope.
+ if (follow_context_chain && (flags & STOP_AT_DECLARATION_SCOPE) == 0 &&
+ context->IsFunctionContext()) {
+ int function_index = scope_info->FunctionContextSlotIndex(*name);
if (function_index >= 0) {
if (FLAG_trace_contexts) {
PrintF("=> found intermediate function in context slot %d\n",
@@ -318,9 +319,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
*index = function_index;
*attributes = READ_ONLY;
- DCHECK(mode == CONST_LEGACY || mode == CONST);
*init_flag = kCreatedInitialized;
- *variable_mode = mode;
+ *variable_mode = CONST;
return context;
}
}
« no previous file with comments | « src/compiler/js-global-object-specialization.cc ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698