Commit e600d564 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Add a missing handle for serialized scope info

R=vegorov@chromium.org

BUG=v8:1252
TEST=none

Review URL: http://codereview.chromium.org//6805013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7519 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c2e7beb9
...@@ -120,7 +120,7 @@ Scope::Scope(Type type) ...@@ -120,7 +120,7 @@ Scope::Scope(Type type)
params_(0), params_(0),
unresolved_(0), unresolved_(0),
decls_(0) { decls_(0) {
SetDefaults(type, NULL, NULL); SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null());
ASSERT(!resolved()); ASSERT(!resolved());
} }
...@@ -132,7 +132,7 @@ Scope::Scope(Scope* outer_scope, Type type) ...@@ -132,7 +132,7 @@ Scope::Scope(Scope* outer_scope, Type type)
params_(4), params_(4),
unresolved_(16), unresolved_(16),
decls_(4) { decls_(4) {
SetDefaults(type, outer_scope, NULL); SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null());
// At some point we might want to provide outer scopes to // At some point we might want to provide outer scopes to
// eval scopes (by walking the stack and reading the scope info). // eval scopes (by walking the stack and reading the scope info).
// In that case, the ASSERT below needs to be adjusted. // In that case, the ASSERT below needs to be adjusted.
...@@ -142,14 +142,14 @@ Scope::Scope(Scope* outer_scope, Type type) ...@@ -142,14 +142,14 @@ Scope::Scope(Scope* outer_scope, Type type)
} }
Scope::Scope(Scope* inner_scope, SerializedScopeInfo* scope_info) Scope::Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info)
: inner_scopes_(4), : inner_scopes_(4),
variables_(), variables_(),
temps_(4), temps_(4),
params_(4), params_(4),
unresolved_(16), unresolved_(16),
decls_(4) { decls_(4) {
ASSERT(scope_info != NULL); ASSERT(!scope_info.is_null());
SetDefaults(FUNCTION_SCOPE, NULL, scope_info); SetDefaults(FUNCTION_SCOPE, NULL, scope_info);
ASSERT(resolved()); ASSERT(resolved());
if (scope_info->HasHeapAllocatedLocals()) { if (scope_info->HasHeapAllocatedLocals()) {
...@@ -181,6 +181,33 @@ Scope::Scope(Scope* inner_scope, SerializedScopeInfo* scope_info) ...@@ -181,6 +181,33 @@ Scope::Scope(Scope* inner_scope, SerializedScopeInfo* scope_info)
} }
void Scope::SetDefaults(Type type,
Scope* outer_scope,
Handle<SerializedScopeInfo> scope_info) {
outer_scope_ = outer_scope;
type_ = type;
scope_name_ = FACTORY->empty_symbol();
dynamics_ = NULL;
receiver_ = NULL;
function_ = NULL;
arguments_ = NULL;
arguments_shadow_ = NULL;
illegal_redecl_ = NULL;
scope_inside_with_ = false;
scope_contains_with_ = false;
scope_calls_eval_ = false;
// Inherit the strict mode from the parent scope.
strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_;
outer_scope_calls_eval_ = false;
inner_scope_calls_eval_ = false;
outer_scope_is_eval_scope_ = false;
force_eager_compilation_ = false;
num_stack_slots_ = 0;
num_heap_slots_ = 0;
scope_info_ = scope_info;
}
Scope* Scope::DeserializeScopeChain(CompilationInfo* info, Scope* Scope::DeserializeScopeChain(CompilationInfo* info,
Scope* global_scope) { Scope* global_scope) {
ASSERT(!info->closure().is_null()); ASSERT(!info->closure().is_null());
...@@ -193,8 +220,8 @@ Scope* Scope::DeserializeScopeChain(CompilationInfo* info, ...@@ -193,8 +220,8 @@ Scope* Scope::DeserializeScopeChain(CompilationInfo* info,
JSFunction* current = *info->closure(); JSFunction* current = *info->closure();
do { do {
current = current->context()->closure(); current = current->context()->closure();
SerializedScopeInfo* scope_info = current->shared()->scope_info(); Handle<SerializedScopeInfo> scope_info(current->shared()->scope_info());
if (scope_info != SerializedScopeInfo::Empty()) { if (*scope_info != SerializedScopeInfo::Empty()) {
scope = new Scope(scope, scope_info); scope = new Scope(scope, scope_info);
if (innermost_scope == NULL) innermost_scope = scope; if (innermost_scope == NULL) innermost_scope = scope;
} else { } else {
......
...@@ -378,8 +378,8 @@ class Scope: public ZoneObject { ...@@ -378,8 +378,8 @@ class Scope: public ZoneObject {
int num_heap_slots_; int num_heap_slots_;
// Serialized scopes support. // Serialized scopes support.
SerializedScopeInfo* scope_info_; Handle<SerializedScopeInfo> scope_info_;
bool resolved() { return scope_info_ != NULL; } bool resolved() { return !scope_info_.is_null(); }
// Create a non-local variable with a given name. // Create a non-local variable with a given name.
// These variables are looked up dynamically at runtime. // These variables are looked up dynamically at runtime.
...@@ -414,7 +414,7 @@ class Scope: public ZoneObject { ...@@ -414,7 +414,7 @@ class Scope: public ZoneObject {
void AllocateVariablesRecursively(); void AllocateVariablesRecursively();
private: private:
Scope(Scope* inner_scope, SerializedScopeInfo* scope_info); Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info);
void AddInnerScope(Scope* inner_scope) { void AddInnerScope(Scope* inner_scope) {
if (inner_scope != NULL) { if (inner_scope != NULL) {
...@@ -425,29 +425,7 @@ class Scope: public ZoneObject { ...@@ -425,29 +425,7 @@ class Scope: public ZoneObject {
void SetDefaults(Type type, void SetDefaults(Type type,
Scope* outer_scope, Scope* outer_scope,
SerializedScopeInfo* scope_info) { Handle<SerializedScopeInfo> scope_info);
outer_scope_ = outer_scope;
type_ = type;
scope_name_ = FACTORY->empty_symbol();
dynamics_ = NULL;
receiver_ = NULL;
function_ = NULL;
arguments_ = NULL;
arguments_shadow_ = NULL;
illegal_redecl_ = NULL;
scope_inside_with_ = false;
scope_contains_with_ = false;
scope_calls_eval_ = false;
// Inherit the strict mode from the parent scope.
strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_;
outer_scope_calls_eval_ = false;
inner_scope_calls_eval_ = false;
outer_scope_is_eval_scope_ = false;
force_eager_compilation_ = false;
num_stack_slots_ = 0;
num_heap_slots_ = 0;
scope_info_ = scope_info;
}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment