OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 SourceGroup() : | 88 SourceGroup() : |
89 #if !(defined(USING_V8_SHARED) || defined(V8_SHARED)) | 89 #if !(defined(USING_V8_SHARED) || defined(V8_SHARED)) |
90 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 90 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
91 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 91 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
92 thread_(NULL), | 92 thread_(NULL), |
93 #endif // USING_V8_SHARED | 93 #endif // USING_V8_SHARED |
94 argv_(NULL), | 94 argv_(NULL), |
95 begin_offset_(0), | 95 begin_offset_(0), |
96 end_offset_(0) { } | 96 end_offset_(0) { } |
97 | 97 |
| 98 ~SourceGroup() { |
| 99 delete next_semaphore_; |
| 100 delete done_semaphore_; |
| 101 } |
| 102 |
98 void Begin(char** argv, int offset) { | 103 void Begin(char** argv, int offset) { |
99 argv_ = const_cast<const char**>(argv); | 104 argv_ = const_cast<const char**>(argv); |
100 begin_offset_ = offset; | 105 begin_offset_ = offset; |
101 } | 106 } |
102 | 107 |
103 void End(int offset) { end_offset_ = offset; } | 108 void End(int offset) { end_offset_ = offset; } |
104 | 109 |
105 void Execute() { | 110 void Execute() { |
106 for (int i = begin_offset_; i < end_offset_; ++i) { | 111 for (int i = begin_offset_; i < end_offset_; ++i) { |
107 const char* arg = argv_[i]; | 112 const char* arg = argv_[i]; |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 printf("^"); | 709 printf("^"); |
705 } | 710 } |
706 printf("\n"); | 711 printf("\n"); |
707 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 712 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
708 if (stack_trace.length() > 0) { | 713 if (stack_trace.length() > 0) { |
709 const char* stack_trace_string = ToCString(stack_trace); | 714 const char* stack_trace_string = ToCString(stack_trace); |
710 printf("%s\n", stack_trace_string); | 715 printf("%s\n", stack_trace_string); |
711 } | 716 } |
712 } | 717 } |
713 } | 718 } |
OLD | NEW |