OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 18 matching lines...) Expand all Loading... |
29 #include <v8-testing.h> | 29 #include <v8-testing.h> |
30 #include <assert.h> | 30 #include <assert.h> |
31 #include <fcntl.h> | 31 #include <fcntl.h> |
32 #include <string.h> | 32 #include <string.h> |
33 #include <stdio.h> | 33 #include <stdio.h> |
34 #include <stdlib.h> | 34 #include <stdlib.h> |
35 | 35 |
36 // When building with V8 in a shared library we cannot use functions which | 36 // When building with V8 in a shared library we cannot use functions which |
37 // is not explicitly a part of the public V8 API. This extensive use of | 37 // is not explicitly a part of the public V8 API. This extensive use of |
38 // #ifndef USING_V8_SHARED/#endif is a hack until we can resolve whether to | 38 // #ifndef USING_V8_SHARED/#endif is a hack until we can resolve whether to |
39 // still use the shell sample for testing or change to use the and the | 39 // still use the shell sample for testing or change to use the developer |
40 // developer shell d8 TODO(1272). | 40 // shell d8 TODO(1272). |
41 #ifndef USING_V8_SHARED | 41 #ifndef USING_V8_SHARED |
42 #include "../src/v8.h" | 42 #include "../src/v8.h" |
43 #endif // USING_V8_SHARED | 43 #endif // USING_V8_SHARED |
44 | 44 |
45 #if !defined(_WIN32) && !defined(_WIN64) | 45 #if !defined(_WIN32) && !defined(_WIN64) |
46 #include <unistd.h> // NOLINT | 46 #include <unistd.h> // NOLINT |
47 #endif | 47 #endif |
48 | 48 |
49 static void ExitShell(int exit_code) { | 49 static void ExitShell(int exit_code) { |
50 // Use _exit instead of exit to avoid races between isolate | 50 // Use _exit instead of exit to avoid races between isolate |
(...skipping 15 matching lines...) Expand all Loading... |
66 v8::Handle<v8::Value> Quit(const v8::Arguments& args); | 66 v8::Handle<v8::Value> Quit(const v8::Arguments& args); |
67 v8::Handle<v8::Value> Version(const v8::Arguments& args); | 67 v8::Handle<v8::Value> Version(const v8::Arguments& args); |
68 v8::Handle<v8::String> ReadFile(const char* name); | 68 v8::Handle<v8::String> ReadFile(const char* name); |
69 void ReportException(v8::TryCatch* handler); | 69 void ReportException(v8::TryCatch* handler); |
70 | 70 |
71 | 71 |
72 static bool last_run = true; | 72 static bool last_run = true; |
73 | 73 |
74 class SourceGroup { | 74 class SourceGroup { |
75 public: | 75 public: |
76 SourceGroup() : | 76 SourceGroup() : |
77 #ifndef USING_V8_SHARED | 77 #ifndef USING_V8_SHARED |
78 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 78 next_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
79 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), | 79 done_semaphore_(v8::internal::OS::CreateSemaphore(0)), |
80 thread_(NULL), | 80 thread_(NULL), |
81 #endif // USING_V8_SHARED | 81 #endif // USING_V8_SHARED |
82 argv_(NULL), | 82 argv_(NULL), |
83 begin_offset_(0), | 83 begin_offset_(0), |
84 end_offset_(0) { } | 84 end_offset_(0) { } |
85 | 85 |
86 void Begin(char** argv, int offset) { | 86 void Begin(char** argv, int offset) { |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 printf("^"); | 525 printf("^"); |
526 } | 526 } |
527 printf("\n"); | 527 printf("\n"); |
528 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 528 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
529 if (stack_trace.length() > 0) { | 529 if (stack_trace.length() > 0) { |
530 const char* stack_trace_string = ToCString(stack_trace); | 530 const char* stack_trace_string = ToCString(stack_trace); |
531 printf("%s\n", stack_trace_string); | 531 printf("%s\n", stack_trace_string); |
532 } | 532 } |
533 } | 533 } |
534 } | 534 } |
OLD | NEW |