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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 v8::HandleScope handle_scope; | 72 v8::HandleScope handle_scope; |
73 v8::Persistent<v8::Context> context = CreateShellContext(); | 73 v8::Persistent<v8::Context> context = CreateShellContext(); |
74 if (context.IsEmpty()) { | 74 if (context.IsEmpty()) { |
75 fprintf(stderr, "Error creating context\n"); | 75 fprintf(stderr, "Error creating context\n"); |
76 return 1; | 76 return 1; |
77 } | 77 } |
78 context->Enter(); | 78 context->Enter(); |
79 result = RunMain(argc, argv); | 79 result = RunMain(argc, argv); |
80 if (run_shell) RunShell(context); | 80 if (run_shell) RunShell(context); |
81 context->Exit(); | 81 context->Exit(); |
82 context.Dispose(); | 82 context.Dispose(context->GetIsolate()); |
83 } | 83 } |
84 v8::V8::Dispose(); | 84 v8::V8::Dispose(); |
85 return result; | 85 return result; |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 // Extracts a C string from a V8 Utf8Value. | 89 // Extracts a C string from a V8 Utf8Value. |
90 const char* ToCString(const v8::String::Utf8Value& value) { | 90 const char* ToCString(const v8::String::Utf8Value& value) { |
91 return *value ? *value : "<string conversion failed>"; | 91 return *value ? *value : "<string conversion failed>"; |
92 } | 92 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 fprintf(stderr, "^"); | 332 fprintf(stderr, "^"); |
333 } | 333 } |
334 fprintf(stderr, "\n"); | 334 fprintf(stderr, "\n"); |
335 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 335 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
336 if (stack_trace.length() > 0) { | 336 if (stack_trace.length() > 0) { |
337 const char* stack_trace_string = ToCString(stack_trace); | 337 const char* stack_trace_string = ToCString(stack_trace); |
338 fprintf(stderr, "%s\n", stack_trace_string); | 338 fprintf(stderr, "%s\n", stack_trace_string); |
339 } | 339 } |
340 } | 340 } |
341 } | 341 } |
OLD | NEW |