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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 519 } |
520 | 520 |
521 | 521 |
522 Handle<Value> Shell::Version(const Arguments& args) { | 522 Handle<Value> Shell::Version(const Arguments& args) { |
523 return String::New(V8::GetVersion()); | 523 return String::New(V8::GetVersion()); |
524 } | 524 } |
525 | 525 |
526 | 526 |
527 void Shell::ReportException(v8::TryCatch* try_catch) { | 527 void Shell::ReportException(v8::TryCatch* try_catch) { |
528 HandleScope handle_scope; | 528 HandleScope handle_scope; |
| 529 #if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) |
529 bool enter_context = !Context::InContext(); | 530 bool enter_context = !Context::InContext(); |
530 if (enter_context) utility_context_->Enter(); | 531 if (enter_context) utility_context_->Enter(); |
| 532 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT |
531 v8::String::Utf8Value exception(try_catch->Exception()); | 533 v8::String::Utf8Value exception(try_catch->Exception()); |
532 const char* exception_string = ToCString(exception); | 534 const char* exception_string = ToCString(exception); |
533 Handle<Message> message = try_catch->Message(); | 535 Handle<Message> message = try_catch->Message(); |
534 if (message.IsEmpty()) { | 536 if (message.IsEmpty()) { |
535 // V8 didn't provide any extra information about this error; just | 537 // V8 didn't provide any extra information about this error; just |
536 // print the exception. | 538 // print the exception. |
537 printf("%s\n", exception_string); | 539 printf("%s\n", exception_string); |
538 } else { | 540 } else { |
539 // Print (filename):(line number): (message). | 541 // Print (filename):(line number): (message). |
540 v8::String::Utf8Value filename(message->GetScriptResourceName()); | 542 v8::String::Utf8Value filename(message->GetScriptResourceName()); |
(...skipping 14 matching lines...) Expand all Loading... |
555 printf("^"); | 557 printf("^"); |
556 } | 558 } |
557 printf("\n"); | 559 printf("\n"); |
558 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 560 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
559 if (stack_trace.length() > 0) { | 561 if (stack_trace.length() > 0) { |
560 const char* stack_trace_string = ToCString(stack_trace); | 562 const char* stack_trace_string = ToCString(stack_trace); |
561 printf("%s\n", stack_trace_string); | 563 printf("%s\n", stack_trace_string); |
562 } | 564 } |
563 } | 565 } |
564 printf("\n"); | 566 printf("\n"); |
| 567 #if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) |
565 if (enter_context) utility_context_->Exit(); | 568 if (enter_context) utility_context_->Exit(); |
| 569 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT |
566 } | 570 } |
567 | 571 |
568 | 572 |
569 #ifndef V8_SHARED | 573 #ifndef V8_SHARED |
570 Handle<Array> Shell::GetCompletions(Handle<String> text, Handle<String> full) { | 574 Handle<Array> Shell::GetCompletions(Handle<String> text, Handle<String> full) { |
571 HandleScope handle_scope; | 575 HandleScope handle_scope; |
572 Context::Scope context_scope(utility_context_); | 576 Context::Scope context_scope(utility_context_); |
573 Handle<Object> global = utility_context_->Global(); | 577 Handle<Object> global = utility_context_->Global(); |
574 Handle<Value> fun = global->Get(String::New("GetCompletions")); | 578 Handle<Value> fun = global->Get(String::New("GetCompletions")); |
575 static const int kArgc = 3; | 579 static const int kArgc = 3; |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1492 } |
1489 | 1493 |
1490 } // namespace v8 | 1494 } // namespace v8 |
1491 | 1495 |
1492 | 1496 |
1493 #ifndef GOOGLE3 | 1497 #ifndef GOOGLE3 |
1494 int main(int argc, char* argv[]) { | 1498 int main(int argc, char* argv[]) { |
1495 return v8::Shell::Main(argc, argv); | 1499 return v8::Shell::Main(argc, argv); |
1496 } | 1500 } |
1497 #endif | 1501 #endif |
OLD | NEW |