Reviewers: Vyacheslav Egorov,
Message:
Should we pass a handle in the constructor, or do you think this is OK (all
the
work in SetDefault is GC safe, as FACTORY->empty_symbol() cannot cause
allocation).
Description:
Add a missing handle for serialized scope info
[email protected]
BUG=v8:1252
TEST=none
Please review this at http://codereview.chromium.org/6805013/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/scopes.h
M src/scopes.cc
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index
70e11ed4399138d418f1f00c50772481ce7a3bca..75047f23f94a8b2887827610a59208f6065ae83c
100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -181,6 +181,37 @@ Scope::Scope(Scope* inner_scope, SerializedScopeInfo*
scope_info)
}
+void Scope::SetDefaults(Type type,
+ Scope* outer_scope,
+ 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;
+ if (scope_info != NULL) {
+ scope_info_ = Handle<SerializedScopeInfo>(scope_info);
+ } else {
+ scope_info_ = Handle<SerializedScopeInfo>::null();
+ }
+}
+
+
Scope* Scope::DeserializeScopeChain(CompilationInfo* info,
Scope* global_scope) {
ASSERT(!info->closure().is_null());
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index
5f031ed6db84e3eefb0dcb2e4500cd05bdb7f9f8..8da20d68bc767afd7edd7bcb2e712dff30ada523
100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -378,8 +378,8 @@ class Scope: public ZoneObject {
int num_heap_slots_;
// Serialized scopes support.
- SerializedScopeInfo* scope_info_;
- bool resolved() { return scope_info_ != NULL; }
+ Handle<SerializedScopeInfo> scope_info_;
+ bool resolved() { return !scope_info_.is_null(); }
// Create a non-local variable with a given name.
// These variables are looked up dynamically at runtime.
@@ -425,29 +425,7 @@ class Scope: public ZoneObject {
void SetDefaults(Type type,
Scope* outer_scope,
- 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;
- }
+ SerializedScopeInfo* scope_info);
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev