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 5910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5921 } | 5921 } |
5922 | 5922 |
5923 | 5923 |
5924 static Object* Runtime_GetCFrames(Arguments args) { | 5924 static Object* Runtime_GetCFrames(Arguments args) { |
5925 HandleScope scope; | 5925 HandleScope scope; |
5926 ASSERT(args.length() == 1); | 5926 ASSERT(args.length() == 1); |
5927 Object* result = Runtime_CheckExecutionState(args); | 5927 Object* result = Runtime_CheckExecutionState(args); |
5928 if (result->IsFailure()) return result; | 5928 if (result->IsFailure()) return result; |
5929 | 5929 |
5930 static const int kMaxCFramesSize = 200; | 5930 static const int kMaxCFramesSize = 200; |
5931 OS::StackFrame frames[kMaxCFramesSize]; | 5931 ScopedVector<OS::StackFrame> frames(kMaxCFramesSize); |
5932 int frames_count = OS::StackWalk(frames, kMaxCFramesSize); | 5932 int frames_count = OS::StackWalk(frames); |
5933 if (frames_count == OS::kStackWalkError) { | 5933 if (frames_count == OS::kStackWalkError) { |
5934 return Heap::undefined_value(); | 5934 return Heap::undefined_value(); |
5935 } | 5935 } |
5936 | 5936 |
5937 Handle<String> address_str = Factory::LookupAsciiSymbol("address"); | 5937 Handle<String> address_str = Factory::LookupAsciiSymbol("address"); |
5938 Handle<String> text_str = Factory::LookupAsciiSymbol("text"); | 5938 Handle<String> text_str = Factory::LookupAsciiSymbol("text"); |
5939 Handle<FixedArray> frames_array = Factory::NewFixedArray(frames_count); | 5939 Handle<FixedArray> frames_array = Factory::NewFixedArray(frames_count); |
5940 for (int i = 0; i < frames_count; i++) { | 5940 for (int i = 0; i < frames_count; i++) { |
5941 Handle<JSObject> frame_value = Factory::NewJSObject(Top::object_function()); | 5941 Handle<JSObject> frame_value = Factory::NewJSObject(Top::object_function()); |
5942 frame_value->SetProperty( | 5942 frame_value->SetProperty( |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6952 } else { | 6952 } else { |
6953 // Handle last resort GC and make sure to allow future allocations | 6953 // Handle last resort GC and make sure to allow future allocations |
6954 // to grow the heap without causing GCs (if possible). | 6954 // to grow the heap without causing GCs (if possible). |
6955 Counters::gc_last_resort_from_js.Increment(); | 6955 Counters::gc_last_resort_from_js.Increment(); |
6956 Heap::CollectAllGarbage(); | 6956 Heap::CollectAllGarbage(); |
6957 } | 6957 } |
6958 } | 6958 } |
6959 | 6959 |
6960 | 6960 |
6961 } } // namespace v8::internal | 6961 } } // namespace v8::internal |
OLD | NEW |