| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 10729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10740 Object* GetParameter(int index) { | 10740 Object* GetParameter(int index) { |
| 10741 return is_optimized_ | 10741 return is_optimized_ |
| 10742 ? deoptimized_frame_->GetParameter(index) | 10742 ? deoptimized_frame_->GetParameter(index) |
| 10743 : frame_->GetParameter(index); | 10743 : frame_->GetParameter(index); |
| 10744 } | 10744 } |
| 10745 Object* GetExpression(int index) { | 10745 Object* GetExpression(int index) { |
| 10746 return is_optimized_ | 10746 return is_optimized_ |
| 10747 ? deoptimized_frame_->GetExpression(index) | 10747 ? deoptimized_frame_->GetExpression(index) |
| 10748 : frame_->GetExpression(index); | 10748 : frame_->GetExpression(index); |
| 10749 } | 10749 } |
| 10750 Address GetPc() { |
| 10751 return is_optimized_ |
| 10752 ? deoptimized_frame_->GetPc() |
| 10753 : frame_->pc(); |
| 10754 } |
| 10750 | 10755 |
| 10751 // To inspect all the provided arguments the frame might need to be | 10756 // To inspect all the provided arguments the frame might need to be |
| 10752 // replaced with the arguments frame. | 10757 // replaced with the arguments frame. |
| 10753 void SetArgumentsFrame(JavaScriptFrame* frame) { | 10758 void SetArgumentsFrame(JavaScriptFrame* frame) { |
| 10754 ASSERT(has_adapted_arguments_); | 10759 ASSERT(has_adapted_arguments_); |
| 10755 frame_ = frame; | 10760 frame_ = frame; |
| 10756 is_optimized_ = frame_->is_optimized(); | 10761 is_optimized_ = frame_->is_optimized(); |
| 10757 ASSERT(!is_optimized_); | 10762 ASSERT(!is_optimized_); |
| 10758 } | 10763 } |
| 10759 | 10764 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10845 } | 10850 } |
| 10846 FrameInspector frame_inspector(it.frame(), inlined_jsframe_index, isolate); | 10851 FrameInspector frame_inspector(it.frame(), inlined_jsframe_index, isolate); |
| 10847 | 10852 |
| 10848 // Traverse the saved contexts chain to find the active context for the | 10853 // Traverse the saved contexts chain to find the active context for the |
| 10849 // selected frame. | 10854 // selected frame. |
| 10850 SaveContext* save = FindSavedContextForFrame(isolate, it.frame()); | 10855 SaveContext* save = FindSavedContextForFrame(isolate, it.frame()); |
| 10851 | 10856 |
| 10852 // Get the frame id. | 10857 // Get the frame id. |
| 10853 Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate); | 10858 Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate); |
| 10854 | 10859 |
| 10855 // Find source position. | 10860 // Find source position in unoptimized code. |
| 10856 int position = | 10861 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); |
| 10857 it.frame()->LookupCode()->SourcePosition(it.frame()->pc()); | 10862 Handle<SharedFunctionInfo> shared(function->shared()); |
| 10863 int position = shared->code()->SourcePosition(frame_inspector.GetPc()); |
| 10858 | 10864 |
| 10859 // Check for constructor frame. Inlined frames cannot be construct calls. | 10865 // Check for constructor frame. Inlined frames cannot be construct calls. |
| 10860 bool inlined_frame = is_optimized && inlined_jsframe_index != 0; | 10866 bool inlined_frame = is_optimized && inlined_jsframe_index != 0; |
| 10861 bool constructor = !inlined_frame && it.frame()->IsConstructor(); | 10867 bool constructor = !inlined_frame && it.frame()->IsConstructor(); |
| 10862 | 10868 |
| 10863 // Get scope info and read from it for local variable information. | 10869 // Get scope info and read from it for local variable information. |
| 10864 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); | |
| 10865 Handle<SharedFunctionInfo> shared(function->shared()); | |
| 10866 Handle<ScopeInfo> scope_info(shared->scope_info()); | 10870 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 10867 ASSERT(*scope_info != ScopeInfo::Empty()); | 10871 ASSERT(*scope_info != ScopeInfo::Empty()); |
| 10868 | 10872 |
| 10869 // Get the locals names and values into a temporary array. | 10873 // Get the locals names and values into a temporary array. |
| 10870 // | 10874 // |
| 10871 // TODO(1240907): Hide compiler-introduced stack variables | 10875 // TODO(1240907): Hide compiler-introduced stack variables |
| 10872 // (e.g. .result)? For users of the debugger, they will probably be | 10876 // (e.g. .result)? For users of the debugger, they will probably be |
| 10873 // confusing. | 10877 // confusing. |
| 10874 Handle<FixedArray> locals = | 10878 Handle<FixedArray> locals = |
| 10875 isolate->factory()->NewFixedArray(scope_info->LocalCount() * 2); | 10879 isolate->factory()->NewFixedArray(scope_info->LocalCount() * 2); |
| (...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13645 } else { | 13649 } else { |
| 13646 // Handle last resort GC and make sure to allow future allocations | 13650 // Handle last resort GC and make sure to allow future allocations |
| 13647 // to grow the heap without causing GCs (if possible). | 13651 // to grow the heap without causing GCs (if possible). |
| 13648 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13652 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13649 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13653 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 13650 } | 13654 } |
| 13651 } | 13655 } |
| 13652 | 13656 |
| 13653 | 13657 |
| 13654 } } // namespace v8::internal | 13658 } } // namespace v8::internal |
| OLD | NEW |