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 3981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3992 details->set(kFrameDetailsFunctionIndex, it.frame()->function()); | 3992 details->set(kFrameDetailsFunctionIndex, it.frame()->function()); |
3993 | 3993 |
3994 // Add the arguments count. | 3994 // Add the arguments count. |
3995 details->set(kFrameDetailsArgumentCountIndex, Smi::FromInt(argument_count)); | 3995 details->set(kFrameDetailsArgumentCountIndex, Smi::FromInt(argument_count)); |
3996 | 3996 |
3997 // Add the locals count | 3997 // Add the locals count |
3998 details->set(kFrameDetailsLocalCountIndex, | 3998 details->set(kFrameDetailsLocalCountIndex, |
3999 Smi::FromInt(info.NumberOfLocals())); | 3999 Smi::FromInt(info.NumberOfLocals())); |
4000 | 4000 |
4001 // Add the source position. | 4001 // Add the source position. |
4002 if (position != kNoPosition) { | 4002 if (position != RelocInfo::kNoPosition) { |
4003 details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position)); | 4003 details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position)); |
4004 } else { | 4004 } else { |
4005 details->set(kFrameDetailsSourcePositionIndex, Heap::undefined_value()); | 4005 details->set(kFrameDetailsSourcePositionIndex, Heap::undefined_value()); |
4006 } | 4006 } |
4007 | 4007 |
4008 // Add the constructor information. | 4008 // Add the constructor information. |
4009 details->set(kFrameDetailsConstructCallIndex, Heap::ToBoolean(constructor)); | 4009 details->set(kFrameDetailsConstructCallIndex, Heap::ToBoolean(constructor)); |
4010 | 4010 |
4011 // Add information on whether this frame is invoked in the debugger context. | 4011 // Add information on whether this frame is invoked in the debugger context. |
4012 details->set(kFrameDetailsDebuggerFrameIndex, | 4012 details->set(kFrameDetailsDebuggerFrameIndex, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4139 // Iterate the heap looking for SharedFunctionInfo generated from the | 4139 // Iterate the heap looking for SharedFunctionInfo generated from the |
4140 // script. The inner most SharedFunctionInfo containing the source position | 4140 // script. The inner most SharedFunctionInfo containing the source position |
4141 // for the requested break point is found. | 4141 // for the requested break point is found. |
4142 // NOTE: This might reqire several heap iterations. If the SharedFunctionInfo | 4142 // NOTE: This might reqire several heap iterations. If the SharedFunctionInfo |
4143 // which is found is not compiled it is compiled and the heap is iterated | 4143 // which is found is not compiled it is compiled and the heap is iterated |
4144 // again as the compilation might create inner functions from the newly | 4144 // again as the compilation might create inner functions from the newly |
4145 // compiled function and the actual requested break point might be in one of | 4145 // compiled function and the actual requested break point might be in one of |
4146 // these functions. | 4146 // these functions. |
4147 bool done = false; | 4147 bool done = false; |
4148 // The current candidate for the source position: | 4148 // The current candidate for the source position: |
4149 int target_start_position = kNoPosition; | 4149 int target_start_position = RelocInfo::kNoPosition; |
4150 Handle<SharedFunctionInfo> target; | 4150 Handle<SharedFunctionInfo> target; |
4151 // The current candidate for the last function in script: | 4151 // The current candidate for the last function in script: |
4152 Handle<SharedFunctionInfo> last; | 4152 Handle<SharedFunctionInfo> last; |
4153 while (!done) { | 4153 while (!done) { |
4154 HeapIterator iterator; | 4154 HeapIterator iterator; |
4155 while (iterator.has_next()) { | 4155 while (iterator.has_next()) { |
4156 HeapObject* obj = iterator.next(); | 4156 HeapObject* obj = iterator.next(); |
4157 ASSERT(obj != NULL); | 4157 ASSERT(obj != NULL); |
4158 if (obj->IsSharedFunctionInfo()) { | 4158 if (obj->IsSharedFunctionInfo()) { |
4159 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(obj)); | 4159 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(obj)); |
4160 if (shared->script() == *script) { | 4160 if (shared->script() == *script) { |
4161 // If the SharedFunctionInfo found has the requested script data and | 4161 // If the SharedFunctionInfo found has the requested script data and |
4162 // contains the source position it is a candidate. | 4162 // contains the source position it is a candidate. |
4163 int start_position = shared->function_token_position(); | 4163 int start_position = shared->function_token_position(); |
4164 if (start_position == kNoPosition) { | 4164 if (start_position == RelocInfo::kNoPosition) { |
4165 start_position = shared->start_position(); | 4165 start_position = shared->start_position(); |
4166 } | 4166 } |
4167 if (start_position <= position && | 4167 if (start_position <= position && |
4168 position <= shared->end_position()) { | 4168 position <= shared->end_position()) { |
4169 // If there is no candidate or this function is within the currrent | 4169 // If there is no candidate or this function is within the currrent |
4170 // candidate this is the new candidate. | 4170 // candidate this is the new candidate. |
4171 if (target.is_null()) { | 4171 if (target.is_null()) { |
4172 target_start_position = start_position; | 4172 target_start_position = start_position; |
4173 target = shared; | 4173 target = shared; |
4174 } else { | 4174 } else { |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4976 | 4976 |
4977 void Runtime::PerformGC(Object* result) { | 4977 void Runtime::PerformGC(Object* result) { |
4978 Failure* failure = Failure::cast(result); | 4978 Failure* failure = Failure::cast(result); |
4979 // Try to do a garbage collection; ignore it if it fails. The C | 4979 // Try to do a garbage collection; ignore it if it fails. The C |
4980 // entry stub will throw an out-of-memory exception in that case. | 4980 // entry stub will throw an out-of-memory exception in that case. |
4981 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 4981 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
4982 } | 4982 } |
4983 | 4983 |
4984 | 4984 |
4985 } } // namespace v8::internal | 4985 } } // namespace v8::internal |
OLD | NEW |