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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return result; | 169 return result; |
170 | 170 |
171 #undef FRAME_TYPE_CASE | 171 #undef FRAME_TYPE_CASE |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 // ------------------------------------------------------------------------- | 175 // ------------------------------------------------------------------------- |
176 | 176 |
177 | 177 |
178 StackTraceFrameIterator::StackTraceFrameIterator() { | 178 StackTraceFrameIterator::StackTraceFrameIterator() { |
179 if (!done() && !frame()->function()->IsJSFunction()) Advance(); | 179 if (!done() && !IsValidFrame()) Advance(); |
180 } | 180 } |
181 | 181 |
182 | 182 |
183 void StackTraceFrameIterator::Advance() { | 183 void StackTraceFrameIterator::Advance() { |
184 while (true) { | 184 while (true) { |
185 JavaScriptFrameIterator::Advance(); | 185 JavaScriptFrameIterator::Advance(); |
186 if (done()) return; | 186 if (done()) return; |
187 if (frame()->function()->IsJSFunction()) return; | 187 if (IsValidFrame()) return; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
| 191 bool StackTraceFrameIterator::IsValidFrame() { |
| 192 if (!frame()->function()->IsJSFunction()) return false; |
| 193 Object* script = JSFunction::cast(frame()->function())->shared()->script(); |
| 194 // Don't show functions from native scripts to user. |
| 195 return (script->IsScript() && |
| 196 Script::TYPE_NATIVE != Script::cast(script)->type()->value()); |
| 197 } |
| 198 |
191 | 199 |
192 // ------------------------------------------------------------------------- | 200 // ------------------------------------------------------------------------- |
193 | 201 |
194 | 202 |
195 SafeStackFrameIterator::SafeStackFrameIterator( | 203 SafeStackFrameIterator::SafeStackFrameIterator( |
196 Address fp, Address sp, Address low_bound, Address high_bound) : | 204 Address fp, Address sp, Address low_bound, Address high_bound) : |
197 low_bound_(low_bound), high_bound_(high_bound), | 205 low_bound_(low_bound), high_bound_(high_bound), |
198 is_valid_top_( | 206 is_valid_top_( |
199 IsWithinBounds(low_bound, high_bound, | 207 IsWithinBounds(low_bound, high_bound, |
200 Top::c_entry_fp(Top::GetCurrentThread())) && | 208 Top::c_entry_fp(Top::GetCurrentThread())) && |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 reg_code[i++] = r; | 748 reg_code[i++] = r; |
741 | 749 |
742 ASSERT(i == kNumJSCallerSaved); | 750 ASSERT(i == kNumJSCallerSaved); |
743 } | 751 } |
744 ASSERT(0 <= n && n < kNumJSCallerSaved); | 752 ASSERT(0 <= n && n < kNumJSCallerSaved); |
745 return reg_code[n]; | 753 return reg_code[n]; |
746 } | 754 } |
747 | 755 |
748 | 756 |
749 } } // namespace v8::internal | 757 } } // namespace v8::internal |
OLD | NEW |