| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 4779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4790 JavaScriptFrameIterator it(id); | 4790 JavaScriptFrameIterator it(id); |
| 4791 for (; !it.done(); it.Advance()) { | 4791 for (; !it.done(); it.Advance()) { |
| 4792 if (count == index) break; | 4792 if (count == index) break; |
| 4793 count++; | 4793 count++; |
| 4794 } | 4794 } |
| 4795 if (it.done()) return Heap::undefined_value(); | 4795 if (it.done()) return Heap::undefined_value(); |
| 4796 | 4796 |
| 4797 // Traverse the saved contexts chain to find the active context for the | 4797 // Traverse the saved contexts chain to find the active context for the |
| 4798 // selected frame. | 4798 // selected frame. |
| 4799 SaveContext* save = Top::save_context(); | 4799 SaveContext* save = Top::save_context(); |
| 4800 while (save != NULL && reinterpret_cast<Address>(save) < it.frame()->sp()) { | 4800 while (save != NULL && !save->below(it.frame())) { |
| 4801 save = save->prev(); | 4801 save = save->prev(); |
| 4802 } | 4802 } |
| 4803 ASSERT(save != NULL); |
| 4803 | 4804 |
| 4804 // Get the frame id. | 4805 // Get the frame id. |
| 4805 Handle<Object> frame_id(WrapFrameId(it.frame()->id())); | 4806 Handle<Object> frame_id(WrapFrameId(it.frame()->id())); |
| 4806 | 4807 |
| 4807 // Find source position. | 4808 // Find source position. |
| 4808 int position = it.frame()->FindCode()->SourcePosition(it.frame()->pc()); | 4809 int position = it.frame()->FindCode()->SourcePosition(it.frame()->pc()); |
| 4809 | 4810 |
| 4810 // Check for constructor frame. | 4811 // Check for constructor frame. |
| 4811 bool constructor = it.frame()->IsConstructor(); | 4812 bool constructor = it.frame()->IsConstructor(); |
| 4812 | 4813 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5292 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 5293 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
| 5293 JavaScriptFrameIterator it(id); | 5294 JavaScriptFrameIterator it(id); |
| 5294 JavaScriptFrame* frame = it.frame(); | 5295 JavaScriptFrame* frame = it.frame(); |
| 5295 Handle<JSFunction> function(JSFunction::cast(frame->function())); | 5296 Handle<JSFunction> function(JSFunction::cast(frame->function())); |
| 5296 Handle<Code> code(function->code()); | 5297 Handle<Code> code(function->code()); |
| 5297 ScopeInfo<> sinfo(*code); | 5298 ScopeInfo<> sinfo(*code); |
| 5298 | 5299 |
| 5299 // Traverse the saved contexts chain to find the active context for the | 5300 // Traverse the saved contexts chain to find the active context for the |
| 5300 // selected frame. | 5301 // selected frame. |
| 5301 SaveContext* save = Top::save_context(); | 5302 SaveContext* save = Top::save_context(); |
| 5302 while (save != NULL && reinterpret_cast<Address>(save) < frame->sp()) { | 5303 while (save != NULL && !save->below(frame)) { |
| 5303 save = save->prev(); | 5304 save = save->prev(); |
| 5304 } | 5305 } |
| 5305 ASSERT(save != NULL); | 5306 ASSERT(save != NULL); |
| 5306 SaveContext savex; | 5307 SaveContext savex; |
| 5307 Top::set_context(*(save->context())); | 5308 Top::set_context(*(save->context())); |
| 5308 | 5309 |
| 5309 // Create the (empty) function replacing the function on the stack frame for | 5310 // Create the (empty) function replacing the function on the stack frame for |
| 5310 // the purpose of evaluating in the context created below. It is important | 5311 // the purpose of evaluating in the context created below. It is important |
| 5311 // that this function does not describe any parameters and local variables | 5312 // that this function does not describe any parameters and local variables |
| 5312 // in the context. If it does then this will cause problems with the lookup | 5313 // in the context. If it does then this will cause problems with the lookup |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5872 } else { | 5873 } else { |
| 5873 // Handle last resort GC and make sure to allow future allocations | 5874 // Handle last resort GC and make sure to allow future allocations |
| 5874 // to grow the heap without causing GCs (if possible). | 5875 // to grow the heap without causing GCs (if possible). |
| 5875 Counters::gc_last_resort_from_js.Increment(); | 5876 Counters::gc_last_resort_from_js.Increment(); |
| 5876 Heap::CollectAllGarbage(); | 5877 Heap::CollectAllGarbage(); |
| 5877 } | 5878 } |
| 5878 } | 5879 } |
| 5879 | 5880 |
| 5880 | 5881 |
| 5881 } } // namespace v8::internal | 5882 } } // namespace v8::internal |
| OLD | NEW |