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