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

Unified Diff: src/scopeinfo.cc

Issue 7992005: Block scoped const variables. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 9 years, 2 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
« src/parser.cc ('K') | « src/runtime.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index 1aa51603dbdd59be3819e27adaf7342307190284..48585eba6fde9d74a5b25e201ddc210d9ca2dba1 100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -138,7 +138,7 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
ASSERT(proxy->var()->index() - Context::MIN_CONTEXT_SLOTS ==
context_modes_.length());
context_slots_.Add(FACTORY->empty_symbol());
- context_modes_.Add(INTERNAL);
+ context_modes_.Add(proxy->var()->mode());
}
}
}
@@ -181,8 +181,9 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
// present)
-static inline Object** ReadInt(Object** p, int* x) {
- *x = (reinterpret_cast<Smi*>(*p++))->value();
+template <class T>
+static inline Object** ReadInt(Object** p, T* x) {
+ *x = static_cast<T>((reinterpret_cast<Smi*>(*p++))->value());
return p;
}
@@ -513,16 +514,24 @@ int SerializedScopeInfo::ParameterIndex(String* name) {
}
-int SerializedScopeInfo::FunctionContextSlotIndex(String* name) {
+int SerializedScopeInfo::FunctionContextSlotIndex(String* name,
+ VariableMode* mode) {
ASSERT(name->IsSymbol());
if (length() > 0) {
Object** p = data_start();
if (*p == name) {
p = ContextEntriesAddr();
int number_of_context_slots;
- ReadInt(p, &number_of_context_slots);
+ p = ReadInt(p, &number_of_context_slots);
ASSERT(number_of_context_slots != 0);
// The function context slot is the last entry.
+ if (mode != NULL) {
+ // Seek to context slot entry.
+ p += (number_of_context_slots - 1) * 2;
+ // Seek to mode.
+ ++p;
+ ReadInt(p, mode);
+ }
return number_of_context_slots + Context::MIN_CONTEXT_SLOTS - 1;
}
}
« src/parser.cc ('K') | « src/runtime.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698