Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: src/d8.cc

Issue 42415: Make sure that the d8 shell calls OnExit in case of exceptions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 // Ignore any -f flags for compatibility with other stand-alone 579 // Ignore any -f flags for compatibility with other stand-alone
580 // JavaScript engines. 580 // JavaScript engines.
581 continue; 581 continue;
582 } else if (strncmp(str, "--", 2) == 0) { 582 } else if (strncmp(str, "--", 2) == 0) {
583 printf("Warning: unknown flag %s.\nTry --help for options\n", str); 583 printf("Warning: unknown flag %s.\nTry --help for options\n", str);
584 } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { 584 } else if (strcmp(str, "-e") == 0 && i + 1 < argc) {
585 // Execute argument given to -e option directly. 585 // Execute argument given to -e option directly.
586 v8::HandleScope handle_scope; 586 v8::HandleScope handle_scope;
587 v8::Handle<v8::String> file_name = v8::String::New("unnamed"); 587 v8::Handle<v8::String> file_name = v8::String::New("unnamed");
588 v8::Handle<v8::String> source = v8::String::New(argv[i + 1]); 588 v8::Handle<v8::String> source = v8::String::New(argv[i + 1]);
589 if (!ExecuteString(source, file_name, false, true)) 589 if (!ExecuteString(source, file_name, false, true)) {
590 OnExit();
590 return 1; 591 return 1;
592 }
591 i++; 593 i++;
592 } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { 594 } else if (strcmp(str, "-p") == 0 && i + 1 < argc) {
593 int size = 0; 595 int size = 0;
594 const char *files = ReadChars(argv[++i], &size); 596 const char *files = ReadChars(argv[++i], &size);
595 if (files == NULL) return 1; 597 if (files == NULL) return 1;
596 ShellThread *thread = 598 ShellThread *thread =
597 new ShellThread(threads.length(), 599 new ShellThread(threads.length(),
598 i::Vector<const char>(files, size)); 600 i::Vector<const char>(files, size));
599 thread->Start(); 601 thread->Start();
600 threads.Add(thread); 602 threads.Add(thread);
601 } else { 603 } else {
602 // Use all other arguments as names of files to load and run. 604 // Use all other arguments as names of files to load and run.
603 HandleScope handle_scope; 605 HandleScope handle_scope;
604 Handle<String> file_name = v8::String::New(str); 606 Handle<String> file_name = v8::String::New(str);
605 Handle<String> source = ReadFile(str); 607 Handle<String> source = ReadFile(str);
606 if (source.IsEmpty()) { 608 if (source.IsEmpty()) {
607 printf("Error reading '%s'\n", str); 609 printf("Error reading '%s'\n", str);
608 return 1; 610 return 1;
609 } 611 }
610 if (!ExecuteString(source, file_name, false, true)) 612 if (!ExecuteString(source, file_name, false, true)) {
613 OnExit();
611 return 1; 614 return 1;
615 }
612 } 616 }
613 } 617 }
614 618
615 // Start preemption if threads have been created and preemption is enabled. 619 // Start preemption if threads have been created and preemption is enabled.
616 if (threads.length() > 0 && use_preemption) { 620 if (threads.length() > 0 && use_preemption) {
617 Locker::StartPreemption(preemption_interval); 621 Locker::StartPreemption(preemption_interval);
618 } 622 }
619 623
620 // Run the remote debugger if requested. 624 // Run the remote debugger if requested.
621 if (i::FLAG_remote_debugger) { 625 if (i::FLAG_remote_debugger) {
(...skipping 22 matching lines...) Expand all
644 return 0; 648 return 0;
645 } 649 }
646 650
647 651
648 } // namespace v8 652 } // namespace v8
649 653
650 654
651 int main(int argc, char* argv[]) { 655 int main(int argc, char* argv[]) {
652 return v8::Shell::Main(argc, argv); 656 return v8::Shell::Main(argc, argv);
653 } 657 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698