Commit 72f93382 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Correctly handlify CopyContextLocalsToScopeObject.

Handlified functions that expect allocation must be static, i.e. not allow to
use 'this', since 'this' is not relocated by potential GC.

R=ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/25704002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17068 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent be8f8ceb
...@@ -4103,9 +4103,9 @@ class ScopeInfo : public FixedArray { ...@@ -4103,9 +4103,9 @@ class ScopeInfo : public FixedArray {
// Copies all the context locals into an object used to materialize a scope. // Copies all the context locals into an object used to materialize a scope.
bool CopyContextLocalsToScopeObject(Isolate* isolate, static bool CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
Handle<Context> context, Handle<Context> context,
Handle<JSObject> scope_object); Handle<JSObject> scope_object);
static Handle<ScopeInfo> Create(Scope* scope, Zone* zone); static Handle<ScopeInfo> Create(Scope* scope, Zone* zone);
......
...@@ -11395,8 +11395,8 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate, ...@@ -11395,8 +11395,8 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
// Third fill all context locals. // Third fill all context locals.
Handle<Context> frame_context(Context::cast(frame->context())); Handle<Context> frame_context(Context::cast(frame->context()));
Handle<Context> function_context(frame_context->declaration_context()); Handle<Context> function_context(frame_context->declaration_context());
if (!scope_info->CopyContextLocalsToScopeObject( if (!ScopeInfo::CopyContextLocalsToScopeObject(
isolate, function_context, target)) { scope_info, function_context, target)) {
return Handle<JSObject>(); return Handle<JSObject>();
} }
...@@ -11553,8 +11553,8 @@ static Handle<JSObject> MaterializeClosure(Isolate* isolate, ...@@ -11553,8 +11553,8 @@ static Handle<JSObject> MaterializeClosure(Isolate* isolate,
isolate->factory()->NewJSObject(isolate->object_function()); isolate->factory()->NewJSObject(isolate->object_function());
// Fill all context locals to the context extension. // Fill all context locals to the context extension.
if (!scope_info->CopyContextLocalsToScopeObject( if (!ScopeInfo::CopyContextLocalsToScopeObject(
isolate, context, closure_scope)) { scope_info, context, closure_scope)) {
return Handle<JSObject>(); return Handle<JSObject>();
} }
...@@ -11674,8 +11674,8 @@ static Handle<JSObject> MaterializeBlockScope( ...@@ -11674,8 +11674,8 @@ static Handle<JSObject> MaterializeBlockScope(
isolate->factory()->NewJSObject(isolate->object_function()); isolate->factory()->NewJSObject(isolate->object_function());
// Fill all context locals. // Fill all context locals.
if (!scope_info->CopyContextLocalsToScopeObject( if (!ScopeInfo::CopyContextLocalsToScopeObject(
isolate, context, block_scope)) { scope_info, context, block_scope)) {
return Handle<JSObject>(); return Handle<JSObject>();
} }
...@@ -11697,8 +11697,8 @@ static Handle<JSObject> MaterializeModuleScope( ...@@ -11697,8 +11697,8 @@ static Handle<JSObject> MaterializeModuleScope(
isolate->factory()->NewJSObject(isolate->object_function()); isolate->factory()->NewJSObject(isolate->object_function());
// Fill all context locals. // Fill all context locals.
if (!scope_info->CopyContextLocalsToScopeObject( if (!ScopeInfo::CopyContextLocalsToScopeObject(
isolate, context, module_scope)) { scope_info, context, module_scope)) {
return Handle<JSObject>(); return Handle<JSObject>();
} }
......
...@@ -363,14 +363,14 @@ int ScopeInfo::FunctionContextSlotIndex(String* name, VariableMode* mode) { ...@@ -363,14 +363,14 @@ int ScopeInfo::FunctionContextSlotIndex(String* name, VariableMode* mode) {
} }
bool ScopeInfo::CopyContextLocalsToScopeObject( bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
Isolate* isolate, Handle<Context> context,
Handle<Context> context, Handle<JSObject> scope_object) {
Handle<JSObject> scope_object) { Isolate* isolate = scope_info->GetIsolate();
int local_count = ContextLocalCount(); int local_count = scope_info->ContextLocalCount();
if (local_count == 0) return true; if (local_count == 0) return true;
// Fill all context locals to the context extension. // Fill all context locals to the context extension.
int start = ContextLocalNameEntriesIndex(); int start = scope_info->ContextLocalNameEntriesIndex();
int end = start + local_count; int end = start + local_count;
for (int i = start; i < end; ++i) { for (int i = start; i < end; ++i) {
int context_index = Context::MIN_CONTEXT_SLOTS + i - start; int context_index = Context::MIN_CONTEXT_SLOTS + i - start;
...@@ -378,7 +378,7 @@ bool ScopeInfo::CopyContextLocalsToScopeObject( ...@@ -378,7 +378,7 @@ bool ScopeInfo::CopyContextLocalsToScopeObject(
isolate, isolate,
SetProperty(isolate, SetProperty(isolate,
scope_object, scope_object,
Handle<String>(String::cast(get(i))), Handle<String>(String::cast(scope_info->get(i))),
Handle<Object>(context->get(context_index), isolate), Handle<Object>(context->get(context_index), isolate),
::NONE, ::NONE,
kNonStrictMode), kNonStrictMode),
......
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