OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6862 RUNTIME_ASSERT(!args[0]->IsJSFunction()); | 6862 RUNTIME_ASSERT(!args[0]->IsJSFunction()); |
6863 return *Execution::GetConstructorDelegate(args.at<Object>(0)); | 6863 return *Execution::GetConstructorDelegate(args.at<Object>(0)); |
6864 } | 6864 } |
6865 | 6865 |
6866 | 6866 |
6867 static Object* Runtime_NewContext(Arguments args) { | 6867 static Object* Runtime_NewContext(Arguments args) { |
6868 NoHandleAllocation ha; | 6868 NoHandleAllocation ha; |
6869 ASSERT(args.length() == 1); | 6869 ASSERT(args.length() == 1); |
6870 | 6870 |
6871 CONVERT_CHECKED(JSFunction, function, args[0]); | 6871 CONVERT_CHECKED(JSFunction, function, args[0]); |
6872 int length = | 6872 int length = function->shared()->scope_info()->NumberOfContextSlots(); |
6873 ScopeInfo<>::NumberOfContextSlots(function->shared()->scope_info()); | |
6874 Object* result = Heap::AllocateFunctionContext(length, function); | 6873 Object* result = Heap::AllocateFunctionContext(length, function); |
6875 if (result->IsFailure()) return result; | 6874 if (result->IsFailure()) return result; |
6876 | 6875 |
6877 Top::set_context(Context::cast(result)); | 6876 Top::set_context(Context::cast(result)); |
6878 | 6877 |
6879 return result; // non-failure | 6878 return result; // non-failure |
6880 } | 6879 } |
6881 | 6880 |
6882 static Object* PushContextHelper(Object* object, bool is_catch_context) { | 6881 static Object* PushContextHelper(Object* object, bool is_catch_context) { |
6883 // Convert the object to a proper JavaScript object. | 6882 // Convert the object to a proper JavaScript object. |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8485 Handle<Object> frame_id(WrapFrameId(it.frame()->id())); | 8484 Handle<Object> frame_id(WrapFrameId(it.frame()->id())); |
8486 | 8485 |
8487 // Find source position. | 8486 // Find source position. |
8488 int position = it.frame()->code()->SourcePosition(it.frame()->pc()); | 8487 int position = it.frame()->code()->SourcePosition(it.frame()->pc()); |
8489 | 8488 |
8490 // Check for constructor frame. | 8489 // Check for constructor frame. |
8491 bool constructor = it.frame()->IsConstructor(); | 8490 bool constructor = it.frame()->IsConstructor(); |
8492 | 8491 |
8493 // Get scope info and read from it for local variable information. | 8492 // Get scope info and read from it for local variable information. |
8494 Handle<JSFunction> function(JSFunction::cast(it.frame()->function())); | 8493 Handle<JSFunction> function(JSFunction::cast(it.frame()->function())); |
8495 Handle<Object> scope_info(function->shared()->scope_info()); | 8494 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); |
8496 ScopeInfo<> info(*scope_info); | 8495 ScopeInfo<> info(*scope_info); |
8497 | 8496 |
8498 // Get the context. | 8497 // Get the context. |
8499 Handle<Context> context(Context::cast(it.frame()->context())); | 8498 Handle<Context> context(Context::cast(it.frame()->context())); |
8500 | 8499 |
8501 // Get the locals names and values into a temporary array. | 8500 // Get the locals names and values into a temporary array. |
8502 // | 8501 // |
8503 // TODO(1240907): Hide compiler-introduced stack variables | 8502 // TODO(1240907): Hide compiler-introduced stack variables |
8504 // (e.g. .result)? For users of the debugger, they will probably be | 8503 // (e.g. .result)? For users of the debugger, they will probably be |
8505 // confusing. | 8504 // confusing. |
8506 Handle<FixedArray> locals = Factory::NewFixedArray(info.NumberOfLocals() * 2); | 8505 Handle<FixedArray> locals = Factory::NewFixedArray(info.NumberOfLocals() * 2); |
8507 for (int i = 0; i < info.NumberOfLocals(); i++) { | 8506 for (int i = 0; i < info.NumberOfLocals(); i++) { |
8508 // Name of the local. | 8507 // Name of the local. |
8509 locals->set(i * 2, *info.LocalName(i)); | 8508 locals->set(i * 2, *info.LocalName(i)); |
8510 | 8509 |
8511 // Fetch the value of the local - either from the stack or from a | 8510 // Fetch the value of the local - either from the stack or from a |
8512 // heap-allocated context. | 8511 // heap-allocated context. |
8513 if (i < info.number_of_stack_slots()) { | 8512 if (i < info.number_of_stack_slots()) { |
8514 locals->set(i * 2 + 1, it.frame()->GetExpression(i)); | 8513 locals->set(i * 2 + 1, it.frame()->GetExpression(i)); |
8515 } else { | 8514 } else { |
8516 Handle<String> name = info.LocalName(i); | 8515 Handle<String> name = info.LocalName(i); |
8517 // Traverse the context chain to the function context as all local | 8516 // Traverse the context chain to the function context as all local |
8518 // variables stored in the context will be on the function context. | 8517 // variables stored in the context will be on the function context. |
8519 while (!context->is_function_context()) { | 8518 while (!context->is_function_context()) { |
8520 context = Handle<Context>(context->previous()); | 8519 context = Handle<Context>(context->previous()); |
8521 } | 8520 } |
8522 ASSERT(context->is_function_context()); | 8521 ASSERT(context->is_function_context()); |
8523 locals->set(i * 2 + 1, | 8522 locals->set(i * 2 + 1, |
8524 context->get(ScopeInfo<>::ContextSlotIndex(*scope_info, | 8523 context->get(scope_info->ContextSlotIndex(*name, NULL))); |
8525 *name, | |
8526 NULL))); | |
8527 } | 8524 } |
8528 } | 8525 } |
8529 | 8526 |
8530 // Check whether this frame is positioned at return. | 8527 // Check whether this frame is positioned at return. |
8531 int at_return = (index == 0) ? Debug::IsBreakAtReturn(it.frame()) : false; | 8528 int at_return = (index == 0) ? Debug::IsBreakAtReturn(it.frame()) : false; |
8532 | 8529 |
8533 // If positioned just before return find the value to be returned and add it | 8530 // If positioned just before return find the value to be returned and add it |
8534 // to the frame information. | 8531 // to the frame information. |
8535 Handle<Object> return_value = Factory::undefined_value(); | 8532 Handle<Object> return_value = Factory::undefined_value(); |
8536 if (at_return) { | 8533 if (at_return) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8656 receiver = Factory::ToObject(receiver, calling_frames_global_context); | 8653 receiver = Factory::ToObject(receiver, calling_frames_global_context); |
8657 } | 8654 } |
8658 details->set(kFrameDetailsReceiverIndex, *receiver); | 8655 details->set(kFrameDetailsReceiverIndex, *receiver); |
8659 | 8656 |
8660 ASSERT_EQ(details_size, details_index); | 8657 ASSERT_EQ(details_size, details_index); |
8661 return *Factory::NewJSArrayWithElements(details); | 8658 return *Factory::NewJSArrayWithElements(details); |
8662 } | 8659 } |
8663 | 8660 |
8664 | 8661 |
8665 // Copy all the context locals into an object used to materialize a scope. | 8662 // Copy all the context locals into an object used to materialize a scope. |
8666 static void CopyContextLocalsToScopeObject(Handle<SharedFunctionInfo> shared, | 8663 static void CopyContextLocalsToScopeObject( |
8667 ScopeInfo<>& scope_info, | 8664 Handle<SerializedScopeInfo> serialized_scope_info, |
8668 Handle<Context> context, | 8665 ScopeInfo<>& scope_info, |
8669 Handle<JSObject> scope_object) { | 8666 Handle<Context> context, |
| 8667 Handle<JSObject> scope_object) { |
8670 // Fill all context locals to the context extension. | 8668 // Fill all context locals to the context extension. |
8671 for (int i = Context::MIN_CONTEXT_SLOTS; | 8669 for (int i = Context::MIN_CONTEXT_SLOTS; |
8672 i < scope_info.number_of_context_slots(); | 8670 i < scope_info.number_of_context_slots(); |
8673 i++) { | 8671 i++) { |
8674 int context_index = | 8672 int context_index = serialized_scope_info->ContextSlotIndex( |
8675 ScopeInfo<>::ContextSlotIndex(shared->scope_info(), | 8673 *scope_info.context_slot_name(i), NULL); |
8676 *scope_info.context_slot_name(i), | |
8677 NULL); | |
8678 | 8674 |
8679 // Don't include the arguments shadow (.arguments) context variable. | 8675 // Don't include the arguments shadow (.arguments) context variable. |
8680 if (*scope_info.context_slot_name(i) != Heap::arguments_shadow_symbol()) { | 8676 if (*scope_info.context_slot_name(i) != Heap::arguments_shadow_symbol()) { |
8681 SetProperty(scope_object, | 8677 SetProperty(scope_object, |
8682 scope_info.context_slot_name(i), | 8678 scope_info.context_slot_name(i), |
8683 Handle<Object>(context->get(context_index)), NONE); | 8679 Handle<Object>(context->get(context_index)), NONE); |
8684 } | 8680 } |
8685 } | 8681 } |
8686 } | 8682 } |
8687 | 8683 |
8688 | 8684 |
8689 // Create a plain JSObject which materializes the local scope for the specified | 8685 // Create a plain JSObject which materializes the local scope for the specified |
8690 // frame. | 8686 // frame. |
8691 static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) { | 8687 static Handle<JSObject> MaterializeLocalScope(JavaScriptFrame* frame) { |
8692 Handle<JSFunction> function(JSFunction::cast(frame->function())); | 8688 Handle<JSFunction> function(JSFunction::cast(frame->function())); |
8693 Handle<SharedFunctionInfo> shared(function->shared()); | 8689 Handle<SharedFunctionInfo> shared(function->shared()); |
8694 ScopeInfo<> scope_info(shared->scope_info()); | 8690 Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info()); |
| 8691 ScopeInfo<> scope_info(*serialized_scope_info); |
8695 | 8692 |
8696 // Allocate and initialize a JSObject with all the arguments, stack locals | 8693 // Allocate and initialize a JSObject with all the arguments, stack locals |
8697 // heap locals and extension properties of the debugged function. | 8694 // heap locals and extension properties of the debugged function. |
8698 Handle<JSObject> local_scope = Factory::NewJSObject(Top::object_function()); | 8695 Handle<JSObject> local_scope = Factory::NewJSObject(Top::object_function()); |
8699 | 8696 |
8700 // First fill all parameters. | 8697 // First fill all parameters. |
8701 for (int i = 0; i < scope_info.number_of_parameters(); ++i) { | 8698 for (int i = 0; i < scope_info.number_of_parameters(); ++i) { |
8702 SetProperty(local_scope, | 8699 SetProperty(local_scope, |
8703 scope_info.parameter_name(i), | 8700 scope_info.parameter_name(i), |
8704 Handle<Object>(frame->GetParameter(i)), NONE); | 8701 Handle<Object>(frame->GetParameter(i)), NONE); |
8705 } | 8702 } |
8706 | 8703 |
8707 // Second fill all stack locals. | 8704 // Second fill all stack locals. |
8708 for (int i = 0; i < scope_info.number_of_stack_slots(); i++) { | 8705 for (int i = 0; i < scope_info.number_of_stack_slots(); i++) { |
8709 SetProperty(local_scope, | 8706 SetProperty(local_scope, |
8710 scope_info.stack_slot_name(i), | 8707 scope_info.stack_slot_name(i), |
8711 Handle<Object>(frame->GetExpression(i)), NONE); | 8708 Handle<Object>(frame->GetExpression(i)), NONE); |
8712 } | 8709 } |
8713 | 8710 |
8714 // Third fill all context locals. | 8711 // Third fill all context locals. |
8715 Handle<Context> frame_context(Context::cast(frame->context())); | 8712 Handle<Context> frame_context(Context::cast(frame->context())); |
8716 Handle<Context> function_context(frame_context->fcontext()); | 8713 Handle<Context> function_context(frame_context->fcontext()); |
8717 CopyContextLocalsToScopeObject(shared, scope_info, | 8714 CopyContextLocalsToScopeObject(serialized_scope_info, scope_info, |
8718 function_context, local_scope); | 8715 function_context, local_scope); |
8719 | 8716 |
8720 // Finally copy any properties from the function context extension. This will | 8717 // Finally copy any properties from the function context extension. This will |
8721 // be variables introduced by eval. | 8718 // be variables introduced by eval. |
8722 if (function_context->closure() == *function) { | 8719 if (function_context->closure() == *function) { |
8723 if (function_context->has_extension() && | 8720 if (function_context->has_extension() && |
8724 !function_context->IsGlobalContext()) { | 8721 !function_context->IsGlobalContext()) { |
8725 Handle<JSObject> ext(JSObject::cast(function_context->extension())); | 8722 Handle<JSObject> ext(JSObject::cast(function_context->extension())); |
8726 Handle<FixedArray> keys = GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS); | 8723 Handle<FixedArray> keys = GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS); |
8727 for (int i = 0; i < keys->length(); i++) { | 8724 for (int i = 0; i < keys->length(); i++) { |
8728 // Names of variables introduced by eval are strings. | 8725 // Names of variables introduced by eval are strings. |
8729 ASSERT(keys->get(i)->IsString()); | 8726 ASSERT(keys->get(i)->IsString()); |
8730 Handle<String> key(String::cast(keys->get(i))); | 8727 Handle<String> key(String::cast(keys->get(i))); |
8731 SetProperty(local_scope, key, GetProperty(ext, key), NONE); | 8728 SetProperty(local_scope, key, GetProperty(ext, key), NONE); |
8732 } | 8729 } |
8733 } | 8730 } |
8734 } | 8731 } |
8735 return local_scope; | 8732 return local_scope; |
8736 } | 8733 } |
8737 | 8734 |
8738 | 8735 |
8739 // Create a plain JSObject which materializes the closure content for the | 8736 // Create a plain JSObject which materializes the closure content for the |
8740 // context. | 8737 // context. |
8741 static Handle<JSObject> MaterializeClosure(Handle<Context> context) { | 8738 static Handle<JSObject> MaterializeClosure(Handle<Context> context) { |
8742 ASSERT(context->is_function_context()); | 8739 ASSERT(context->is_function_context()); |
8743 | 8740 |
8744 Handle<SharedFunctionInfo> shared(context->closure()->shared()); | 8741 Handle<SharedFunctionInfo> shared(context->closure()->shared()); |
8745 ScopeInfo<> scope_info(shared->scope_info()); | 8742 Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info()); |
| 8743 ScopeInfo<> scope_info(*serialized_scope_info); |
8746 | 8744 |
8747 // Allocate and initialize a JSObject with all the content of theis function | 8745 // Allocate and initialize a JSObject with all the content of theis function |
8748 // closure. | 8746 // closure. |
8749 Handle<JSObject> closure_scope = Factory::NewJSObject(Top::object_function()); | 8747 Handle<JSObject> closure_scope = Factory::NewJSObject(Top::object_function()); |
8750 | 8748 |
8751 // Check whether the arguments shadow object exists. | 8749 // Check whether the arguments shadow object exists. |
8752 int arguments_shadow_index = | 8750 int arguments_shadow_index = |
8753 ScopeInfo<>::ContextSlotIndex(shared->scope_info(), | 8751 shared->scope_info()->ContextSlotIndex(Heap::arguments_shadow_symbol(), |
8754 Heap::arguments_shadow_symbol(), | 8752 NULL); |
8755 NULL); | |
8756 if (arguments_shadow_index >= 0) { | 8753 if (arguments_shadow_index >= 0) { |
8757 // In this case all the arguments are available in the arguments shadow | 8754 // In this case all the arguments are available in the arguments shadow |
8758 // object. | 8755 // object. |
8759 Handle<JSObject> arguments_shadow( | 8756 Handle<JSObject> arguments_shadow( |
8760 JSObject::cast(context->get(arguments_shadow_index))); | 8757 JSObject::cast(context->get(arguments_shadow_index))); |
8761 for (int i = 0; i < scope_info.number_of_parameters(); ++i) { | 8758 for (int i = 0; i < scope_info.number_of_parameters(); ++i) { |
8762 SetProperty(closure_scope, | 8759 SetProperty(closure_scope, |
8763 scope_info.parameter_name(i), | 8760 scope_info.parameter_name(i), |
8764 Handle<Object>(arguments_shadow->GetElement(i)), NONE); | 8761 Handle<Object>(arguments_shadow->GetElement(i)), NONE); |
8765 } | 8762 } |
8766 } | 8763 } |
8767 | 8764 |
8768 // Fill all context locals to the context extension. | 8765 // Fill all context locals to the context extension. |
8769 CopyContextLocalsToScopeObject(shared, scope_info, context, closure_scope); | 8766 CopyContextLocalsToScopeObject(serialized_scope_info, scope_info, |
| 8767 context, closure_scope); |
8770 | 8768 |
8771 // Finally copy any properties from the function context extension. This will | 8769 // Finally copy any properties from the function context extension. This will |
8772 // be variables introduced by eval. | 8770 // be variables introduced by eval. |
8773 if (context->has_extension()) { | 8771 if (context->has_extension()) { |
8774 Handle<JSObject> ext(JSObject::cast(context->extension())); | 8772 Handle<JSObject> ext(JSObject::cast(context->extension())); |
8775 Handle<FixedArray> keys = GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS); | 8773 Handle<FixedArray> keys = GetKeysInFixedArrayFor(ext, INCLUDE_PROTOS); |
8776 for (int i = 0; i < keys->length(); i++) { | 8774 for (int i = 0; i < keys->length(); i++) { |
8777 // Names of variables introduced by eval are strings. | 8775 // Names of variables introduced by eval are strings. |
8778 ASSERT(keys->get(i)->IsString()); | 8776 ASSERT(keys->get(i)->IsString()); |
8779 Handle<String> key(String::cast(keys->get(i))); | 8777 Handle<String> key(String::cast(keys->get(i))); |
(...skipping 28 matching lines...) Expand all Loading... |
8808 context_(Context::cast(frame->context())), | 8806 context_(Context::cast(frame->context())), |
8809 local_done_(false), | 8807 local_done_(false), |
8810 at_local_(false) { | 8808 at_local_(false) { |
8811 | 8809 |
8812 // Check whether the first scope is actually a local scope. | 8810 // Check whether the first scope is actually a local scope. |
8813 if (context_->IsGlobalContext()) { | 8811 if (context_->IsGlobalContext()) { |
8814 // If there is a stack slot for .result then this local scope has been | 8812 // If there is a stack slot for .result then this local scope has been |
8815 // created for evaluating top level code and it is not a real local scope. | 8813 // created for evaluating top level code and it is not a real local scope. |
8816 // Checking for the existence of .result seems fragile, but the scope info | 8814 // Checking for the existence of .result seems fragile, but the scope info |
8817 // saved with the code object does not otherwise have that information. | 8815 // saved with the code object does not otherwise have that information. |
8818 int index = ScopeInfo<>::StackSlotIndex(function_->shared()->scope_info(), | 8816 int index = function_->shared()->scope_info()-> |
8819 Heap::result_symbol()); | 8817 StackSlotIndex(Heap::result_symbol()); |
8820 at_local_ = index < 0; | 8818 at_local_ = index < 0; |
8821 } else if (context_->is_function_context()) { | 8819 } else if (context_->is_function_context()) { |
8822 at_local_ = true; | 8820 at_local_ = true; |
8823 } | 8821 } |
8824 } | 8822 } |
8825 | 8823 |
8826 // More scopes? | 8824 // More scopes? |
8827 bool Done() { return context_.is_null(); } | 8825 bool Done() { return context_.is_null(); } |
8828 | 8826 |
8829 // Move to the next scope. | 8827 // Move to the next scope. |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9447 CopyWithContextChain(function_context, previous), | 9445 CopyWithContextChain(function_context, previous), |
9448 extension, | 9446 extension, |
9449 context_chain->IsCatchContext()); | 9447 context_chain->IsCatchContext()); |
9450 } | 9448 } |
9451 | 9449 |
9452 | 9450 |
9453 // Helper function to find or create the arguments object for | 9451 // Helper function to find or create the arguments object for |
9454 // Runtime_DebugEvaluate. | 9452 // Runtime_DebugEvaluate. |
9455 static Handle<Object> GetArgumentsObject(JavaScriptFrame* frame, | 9453 static Handle<Object> GetArgumentsObject(JavaScriptFrame* frame, |
9456 Handle<JSFunction> function, | 9454 Handle<JSFunction> function, |
9457 Handle<Object> scope_info, | 9455 Handle<SerializedScopeInfo> scope_info, |
9458 const ScopeInfo<>* sinfo, | 9456 const ScopeInfo<>* sinfo, |
9459 Handle<Context> function_context) { | 9457 Handle<Context> function_context) { |
9460 // Try to find the value of 'arguments' to pass as parameter. If it is not | 9458 // Try to find the value of 'arguments' to pass as parameter. If it is not |
9461 // found (that is the debugged function does not reference 'arguments' and | 9459 // found (that is the debugged function does not reference 'arguments' and |
9462 // does not support eval) then create an 'arguments' object. | 9460 // does not support eval) then create an 'arguments' object. |
9463 int index; | 9461 int index; |
9464 if (sinfo->number_of_stack_slots() > 0) { | 9462 if (sinfo->number_of_stack_slots() > 0) { |
9465 index = ScopeInfo<>::StackSlotIndex(*scope_info, Heap::arguments_symbol()); | 9463 index = scope_info->StackSlotIndex(Heap::arguments_symbol()); |
9466 if (index != -1) { | 9464 if (index != -1) { |
9467 return Handle<Object>(frame->GetExpression(index)); | 9465 return Handle<Object>(frame->GetExpression(index)); |
9468 } | 9466 } |
9469 } | 9467 } |
9470 | 9468 |
9471 if (sinfo->number_of_context_slots() > Context::MIN_CONTEXT_SLOTS) { | 9469 if (sinfo->number_of_context_slots() > Context::MIN_CONTEXT_SLOTS) { |
9472 index = ScopeInfo<>::ContextSlotIndex(*scope_info, Heap::arguments_symbol(), | 9470 index = scope_info->ContextSlotIndex(Heap::arguments_symbol(), NULL); |
9473 NULL); | |
9474 if (index != -1) { | 9471 if (index != -1) { |
9475 return Handle<Object>(function_context->get(index)); | 9472 return Handle<Object>(function_context->get(index)); |
9476 } | 9473 } |
9477 } | 9474 } |
9478 | 9475 |
9479 const int length = frame->GetProvidedParametersCount(); | 9476 const int length = frame->GetProvidedParametersCount(); |
9480 Handle<JSObject> arguments = Factory::NewArgumentsObject(function, length); | 9477 Handle<JSObject> arguments = Factory::NewArgumentsObject(function, length); |
9481 Handle<FixedArray> array = Factory::NewFixedArray(length); | 9478 Handle<FixedArray> array = Factory::NewFixedArray(length); |
9482 | 9479 |
9483 AssertNoAllocation no_gc; | 9480 AssertNoAllocation no_gc; |
(...skipping 30 matching lines...) Expand all Loading... |
9514 CONVERT_BOOLEAN_CHECKED(disable_break, args[3]); | 9511 CONVERT_BOOLEAN_CHECKED(disable_break, args[3]); |
9515 | 9512 |
9516 // Handle the processing of break. | 9513 // Handle the processing of break. |
9517 DisableBreak disable_break_save(disable_break); | 9514 DisableBreak disable_break_save(disable_break); |
9518 | 9515 |
9519 // Get the frame where the debugging is performed. | 9516 // Get the frame where the debugging is performed. |
9520 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 9517 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
9521 JavaScriptFrameIterator it(id); | 9518 JavaScriptFrameIterator it(id); |
9522 JavaScriptFrame* frame = it.frame(); | 9519 JavaScriptFrame* frame = it.frame(); |
9523 Handle<JSFunction> function(JSFunction::cast(frame->function())); | 9520 Handle<JSFunction> function(JSFunction::cast(frame->function())); |
9524 Handle<Object> scope_info(function->shared()->scope_info()); | 9521 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); |
9525 ScopeInfo<> sinfo(*scope_info); | 9522 ScopeInfo<> sinfo(*scope_info); |
9526 | 9523 |
9527 // Traverse the saved contexts chain to find the active context for the | 9524 // Traverse the saved contexts chain to find the active context for the |
9528 // selected frame. | 9525 // selected frame. |
9529 SaveContext* save = Top::save_context(); | 9526 SaveContext* save = Top::save_context(); |
9530 while (save != NULL && !save->below(frame)) { | 9527 while (save != NULL && !save->below(frame)) { |
9531 save = save->prev(); | 9528 save = save->prev(); |
9532 } | 9529 } |
9533 ASSERT(save != NULL); | 9530 ASSERT(save != NULL); |
9534 SaveContext savex; | 9531 SaveContext savex; |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10547 } else { | 10544 } else { |
10548 // Handle last resort GC and make sure to allow future allocations | 10545 // Handle last resort GC and make sure to allow future allocations |
10549 // to grow the heap without causing GCs (if possible). | 10546 // to grow the heap without causing GCs (if possible). |
10550 Counters::gc_last_resort_from_js.Increment(); | 10547 Counters::gc_last_resort_from_js.Increment(); |
10551 Heap::CollectAllGarbage(false); | 10548 Heap::CollectAllGarbage(false); |
10552 } | 10549 } |
10553 } | 10550 } |
10554 | 10551 |
10555 | 10552 |
10556 } } // namespace v8::internal | 10553 } } // namespace v8::internal |
OLD | NEW |