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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 reinterpret_cast<Address>(that->next_)); | 560 reinterpret_cast<Address>(that->next_)); |
561 thread_local_top()->catcher_ = NULL; | 561 thread_local_top()->catcher_ = NULL; |
562 SimulatorStack::UnregisterCTryCatch(); | 562 SimulatorStack::UnregisterCTryCatch(); |
563 } | 563 } |
564 | 564 |
565 | 565 |
566 Handle<String> Isolate::StackTraceString() { | 566 Handle<String> Isolate::StackTraceString() { |
567 if (stack_trace_nesting_level_ == 0) { | 567 if (stack_trace_nesting_level_ == 0) { |
568 stack_trace_nesting_level_++; | 568 stack_trace_nesting_level_++; |
569 HeapStringAllocator allocator; | 569 HeapStringAllocator allocator; |
570 StringStream::ClearMentionedObjectCache(); | 570 StringStream::ClearMentionedObjectCache(this); |
571 StringStream accumulator(&allocator); | 571 StringStream accumulator(&allocator); |
572 incomplete_message_ = &accumulator; | 572 incomplete_message_ = &accumulator; |
573 PrintStack(&accumulator); | 573 PrintStack(&accumulator); |
574 Handle<String> stack_trace = accumulator.ToString(); | 574 Handle<String> stack_trace = accumulator.ToString(this); |
575 incomplete_message_ = NULL; | 575 incomplete_message_ = NULL; |
576 stack_trace_nesting_level_ = 0; | 576 stack_trace_nesting_level_ = 0; |
577 return stack_trace; | 577 return stack_trace; |
578 } else if (stack_trace_nesting_level_ == 1) { | 578 } else if (stack_trace_nesting_level_ == 1) { |
579 stack_trace_nesting_level_++; | 579 stack_trace_nesting_level_++; |
580 OS::PrintError( | 580 OS::PrintError( |
581 "\n\nAttempt to print stack while printing stack (double fault)\n"); | 581 "\n\nAttempt to print stack while printing stack (double fault)\n"); |
582 OS::PrintError( | 582 OS::PrintError( |
583 "If you are lucky you may find a partial stack dump on stdout.\n\n"); | 583 "If you are lucky you may find a partial stack dump on stdout.\n\n"); |
584 incomplete_message_->OutputToStdOut(); | 584 incomplete_message_->OutputToStdOut(); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 if (stack_trace_nesting_level_ == 0) { | 864 if (stack_trace_nesting_level_ == 0) { |
865 stack_trace_nesting_level_++; | 865 stack_trace_nesting_level_++; |
866 | 866 |
867 StringAllocator* allocator; | 867 StringAllocator* allocator; |
868 if (preallocated_message_space_ == NULL) { | 868 if (preallocated_message_space_ == NULL) { |
869 allocator = new HeapStringAllocator(); | 869 allocator = new HeapStringAllocator(); |
870 } else { | 870 } else { |
871 allocator = preallocated_message_space_; | 871 allocator = preallocated_message_space_; |
872 } | 872 } |
873 | 873 |
874 StringStream::ClearMentionedObjectCache(); | 874 StringStream::ClearMentionedObjectCache(this); |
875 StringStream accumulator(allocator); | 875 StringStream accumulator(allocator); |
876 incomplete_message_ = &accumulator; | 876 incomplete_message_ = &accumulator; |
877 PrintStack(&accumulator); | 877 PrintStack(&accumulator); |
878 accumulator.OutputToFile(out); | 878 accumulator.OutputToFile(out); |
879 InitializeLoggingAndCounters(); | 879 InitializeLoggingAndCounters(); |
880 accumulator.Log(); | 880 accumulator.Log(); |
881 incomplete_message_ = NULL; | 881 incomplete_message_ = NULL; |
882 stack_trace_nesting_level_ = 0; | 882 stack_trace_nesting_level_ = 0; |
883 if (preallocated_message_space_ == NULL) { | 883 if (preallocated_message_space_ == NULL) { |
884 // Remove the HeapStringAllocator created above. | 884 // Remove the HeapStringAllocator created above. |
(...skipping 23 matching lines...) Expand all Loading... |
908 void Isolate::PrintStack(StringStream* accumulator) { | 908 void Isolate::PrintStack(StringStream* accumulator) { |
909 if (!IsInitialized()) { | 909 if (!IsInitialized()) { |
910 accumulator->Add( | 910 accumulator->Add( |
911 "\n==== JS stack trace is not available =======================\n\n"); | 911 "\n==== JS stack trace is not available =======================\n\n"); |
912 accumulator->Add( | 912 accumulator->Add( |
913 "\n==== Isolate for the thread is not initialized =============\n\n"); | 913 "\n==== Isolate for the thread is not initialized =============\n\n"); |
914 return; | 914 return; |
915 } | 915 } |
916 // The MentionedObjectCache is not GC-proof at the moment. | 916 // The MentionedObjectCache is not GC-proof at the moment. |
917 DisallowHeapAllocation no_gc; | 917 DisallowHeapAllocation no_gc; |
918 ASSERT(StringStream::IsMentionedObjectCacheClear()); | 918 ASSERT(StringStream::IsMentionedObjectCacheClear(this)); |
919 | 919 |
920 // Avoid printing anything if there are no frames. | 920 // Avoid printing anything if there are no frames. |
921 if (c_entry_fp(thread_local_top()) == 0) return; | 921 if (c_entry_fp(thread_local_top()) == 0) return; |
922 | 922 |
923 accumulator->Add( | 923 accumulator->Add( |
924 "\n==== JS stack trace =========================================\n\n"); | 924 "\n==== JS stack trace =========================================\n\n"); |
925 PrintFrames(this, accumulator, StackFrame::OVERVIEW); | 925 PrintFrames(this, accumulator, StackFrame::OVERVIEW); |
926 | 926 |
927 accumulator->Add( | 927 accumulator->Add( |
928 "\n==== Details ================================================\n\n"); | 928 "\n==== Details ================================================\n\n"); |
929 PrintFrames(this, accumulator, StackFrame::DETAILS); | 929 PrintFrames(this, accumulator, StackFrame::DETAILS); |
930 | 930 |
931 accumulator->PrintMentionedObjectCache(); | 931 accumulator->PrintMentionedObjectCache(this); |
932 accumulator->Add("=====================\n\n"); | 932 accumulator->Add("=====================\n\n"); |
933 } | 933 } |
934 | 934 |
935 | 935 |
936 void Isolate::SetFailedAccessCheckCallback( | 936 void Isolate::SetFailedAccessCheckCallback( |
937 v8::FailedAccessCheckCallback callback) { | 937 v8::FailedAccessCheckCallback callback) { |
938 thread_local_top()->failed_access_check_callback_ = callback; | 938 thread_local_top()->failed_access_check_callback_ = callback; |
939 } | 939 } |
940 | 940 |
941 | 941 |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 v8::Locker locker(reinterpret_cast<v8::Isolate*>(this)); | 2257 v8::Locker locker(reinterpret_cast<v8::Isolate*>(this)); |
2258 v8::Locker::StartPreemption(100); | 2258 v8::Locker::StartPreemption(100); |
2259 } | 2259 } |
2260 | 2260 |
2261 #ifdef ENABLE_DEBUGGER_SUPPORT | 2261 #ifdef ENABLE_DEBUGGER_SUPPORT |
2262 debug_->SetUp(create_heap_objects); | 2262 debug_->SetUp(create_heap_objects); |
2263 #endif | 2263 #endif |
2264 | 2264 |
2265 // If we are deserializing, read the state into the now-empty heap. | 2265 // If we are deserializing, read the state into the now-empty heap. |
2266 if (!create_heap_objects) { | 2266 if (!create_heap_objects) { |
2267 des->Deserialize(); | 2267 des->Deserialize(this); |
2268 } | 2268 } |
2269 stub_cache_->Initialize(); | 2269 stub_cache_->Initialize(); |
2270 | 2270 |
2271 // Finish initialization of ThreadLocal after deserialization is done. | 2271 // Finish initialization of ThreadLocal after deserialization is done. |
2272 clear_pending_exception(); | 2272 clear_pending_exception(); |
2273 clear_pending_message(); | 2273 clear_pending_message(); |
2274 clear_scheduled_exception(); | 2274 clear_scheduled_exception(); |
2275 | 2275 |
2276 // Deserializing may put strange things in the root array's copy of the | 2276 // Deserializing may put strange things in the root array's copy of the |
2277 // stack guard. | 2277 // stack guard. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 | 2528 |
2529 #ifdef DEBUG | 2529 #ifdef DEBUG |
2530 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2530 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2531 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2531 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2532 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2532 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2533 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2533 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2534 #undef ISOLATE_FIELD_OFFSET | 2534 #undef ISOLATE_FIELD_OFFSET |
2535 #endif | 2535 #endif |
2536 | 2536 |
2537 } } // namespace v8::internal | 2537 } } // namespace v8::internal |
OLD | NEW |