| Index: src/runtime.cc
|
| ===================================================================
|
| --- src/runtime.cc (revision 5059)
|
| +++ src/runtime.cc (working copy)
|
| @@ -6869,8 +6869,7 @@
|
| ASSERT(args.length() == 1);
|
|
|
| CONVERT_CHECKED(JSFunction, function, args[0]);
|
| - int length =
|
| - ScopeInfo<>::NumberOfContextSlots(function->shared()->scope_info());
|
| + int length = function->shared()->scope_info()->NumberOfContextSlots();
|
| Object* result = Heap::AllocateFunctionContext(length, function);
|
| if (result->IsFailure()) return result;
|
|
|
| @@ -8492,7 +8491,7 @@
|
|
|
| // Get scope info and read from it for local variable information.
|
| Handle<JSFunction> function(JSFunction::cast(it.frame()->function()));
|
| - Handle<Object> scope_info(function->shared()->scope_info());
|
| + Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
|
| ScopeInfo<> info(*scope_info);
|
|
|
| // Get the context.
|
| @@ -8521,9 +8520,7 @@
|
| }
|
| ASSERT(context->is_function_context());
|
| locals->set(i * 2 + 1,
|
| - context->get(ScopeInfo<>::ContextSlotIndex(*scope_info,
|
| - *name,
|
| - NULL)));
|
| + context->get(scope_info->ContextSlotIndex(*name, NULL)));
|
| }
|
| }
|
|
|
| @@ -8663,18 +8660,17 @@
|
|
|
|
|
| // Copy all the context locals into an object used to materialize a scope.
|
| -static void CopyContextLocalsToScopeObject(Handle<SharedFunctionInfo> shared,
|
| - ScopeInfo<>& scope_info,
|
| - Handle<Context> context,
|
| - Handle<JSObject> scope_object) {
|
| +static void CopyContextLocalsToScopeObject(
|
| + Handle<SerializedScopeInfo> serialized_scope_info,
|
| + ScopeInfo<>& scope_info,
|
| + Handle<Context> context,
|
| + Handle<JSObject> scope_object) {
|
| // Fill all context locals to the context extension.
|
| for (int i = Context::MIN_CONTEXT_SLOTS;
|
| i < scope_info.number_of_context_slots();
|
| i++) {
|
| - int context_index =
|
| - ScopeInfo<>::ContextSlotIndex(shared->scope_info(),
|
| - *scope_info.context_slot_name(i),
|
| - NULL);
|
| + int context_index = serialized_scope_info->ContextSlotIndex(
|
| + *scope_info.context_slot_name(i), NULL);
|
|
|
| // Don't include the arguments shadow (.arguments) context variable.
|
| if (*scope_info.context_slot_name(i) != Heap::arguments_shadow_symbol()) {
|
| @@ -8691,7 +8687,8 @@
|
| static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) {
|
| Handle<JSFunction> function(JSFunction::cast(frame->function()));
|
| Handle<SharedFunctionInfo> shared(function->shared());
|
| - ScopeInfo<> scope_info(shared->scope_info());
|
| + Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info());
|
| + ScopeInfo<> scope_info(*serialized_scope_info);
|
|
|
| // Allocate and initialize a JSObject with all the arguments, stack locals
|
| // heap locals and extension properties of the debugged function.
|
| @@ -8714,7 +8711,7 @@
|
| // Third fill all context locals.
|
| Handle<Context> frame_context(Context::cast(frame->context()));
|
| Handle<Context> function_context(frame_context->fcontext());
|
| - CopyContextLocalsToScopeObject(shared, scope_info,
|
| + CopyContextLocalsToScopeObject(serialized_scope_info, scope_info,
|
| function_context, local_scope);
|
|
|
| // Finally copy any properties from the function context extension. This will
|
| @@ -8742,7 +8739,8 @@
|
| ASSERT(context->is_function_context());
|
|
|
| Handle<SharedFunctionInfo> shared(context->closure()->shared());
|
| - ScopeInfo<> scope_info(shared->scope_info());
|
| + Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info());
|
| + ScopeInfo<> scope_info(*serialized_scope_info);
|
|
|
| // Allocate and initialize a JSObject with all the content of theis function
|
| // closure.
|
| @@ -8750,9 +8748,8 @@
|
|
|
| // Check whether the arguments shadow object exists.
|
| int arguments_shadow_index =
|
| - ScopeInfo<>::ContextSlotIndex(shared->scope_info(),
|
| - Heap::arguments_shadow_symbol(),
|
| - NULL);
|
| + shared->scope_info()->ContextSlotIndex(Heap::arguments_shadow_symbol(),
|
| + NULL);
|
| if (arguments_shadow_index >= 0) {
|
| // In this case all the arguments are available in the arguments shadow
|
| // object.
|
| @@ -8766,7 +8763,8 @@
|
| }
|
|
|
| // Fill all context locals to the context extension.
|
| - CopyContextLocalsToScopeObject(shared, scope_info, context, closure_scope);
|
| + CopyContextLocalsToScopeObject(serialized_scope_info, scope_info,
|
| + context, closure_scope);
|
|
|
| // Finally copy any properties from the function context extension. This will
|
| // be variables introduced by eval.
|
| @@ -8815,8 +8813,8 @@
|
| // created for evaluating top level code and it is not a real local scope.
|
| // Checking for the existence of .result seems fragile, but the scope info
|
| // saved with the code object does not otherwise have that information.
|
| - int index = ScopeInfo<>::StackSlotIndex(function_->shared()->scope_info(),
|
| - Heap::result_symbol());
|
| + int index = function_->shared()->scope_info()->
|
| + StackSlotIndex(Heap::result_symbol());
|
| at_local_ = index < 0;
|
| } else if (context_->is_function_context()) {
|
| at_local_ = true;
|
| @@ -9454,7 +9452,7 @@
|
| // Runtime_DebugEvaluate.
|
| static Handle<Object> GetArgumentsObject(JavaScriptFrame* frame,
|
| Handle<JSFunction> function,
|
| - Handle<Object> scope_info,
|
| + Handle<SerializedScopeInfo> scope_info,
|
| const ScopeInfo<>* sinfo,
|
| Handle<Context> function_context) {
|
| // Try to find the value of 'arguments' to pass as parameter. If it is not
|
| @@ -9462,15 +9460,14 @@
|
| // does not support eval) then create an 'arguments' object.
|
| int index;
|
| if (sinfo->number_of_stack_slots() > 0) {
|
| - index = ScopeInfo<>::StackSlotIndex(*scope_info, Heap::arguments_symbol());
|
| + index = scope_info->StackSlotIndex(Heap::arguments_symbol());
|
| if (index != -1) {
|
| return Handle<Object>(frame->GetExpression(index));
|
| }
|
| }
|
|
|
| if (sinfo->number_of_context_slots() > Context::MIN_CONTEXT_SLOTS) {
|
| - index = ScopeInfo<>::ContextSlotIndex(*scope_info, Heap::arguments_symbol(),
|
| - NULL);
|
| + index = scope_info->ContextSlotIndex(Heap::arguments_symbol(), NULL);
|
| if (index != -1) {
|
| return Handle<Object>(function_context->get(index));
|
| }
|
| @@ -9521,7 +9518,7 @@
|
| JavaScriptFrameIterator it(id);
|
| JavaScriptFrame* frame = it.frame();
|
| Handle<JSFunction> function(JSFunction::cast(frame->function()));
|
| - Handle<Object> scope_info(function->shared()->scope_info());
|
| + Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
|
| ScopeInfo<> sinfo(*scope_info);
|
|
|
| // Traverse the saved contexts chain to find the active context for the
|
|
|