| OLD | NEW | 
|---|
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 99                           bool report_exceptions) { | 99                           bool report_exceptions) { | 
| 100   HandleScope handle_scope; | 100   HandleScope handle_scope; | 
| 101   TryCatch try_catch; | 101   TryCatch try_catch; | 
| 102   if (i::FLAG_debugger) { | 102   if (i::FLAG_debugger) { | 
| 103     // When debugging make exceptions appear to be uncaught. | 103     // When debugging make exceptions appear to be uncaught. | 
| 104     try_catch.SetVerbose(true); | 104     try_catch.SetVerbose(true); | 
| 105   } | 105   } | 
| 106   Handle<Script> script = Script::Compile(source, name); | 106   Handle<Script> script = Script::Compile(source, name); | 
| 107   if (script.IsEmpty()) { | 107   if (script.IsEmpty()) { | 
| 108     // Print errors that happened during compilation. | 108     // Print errors that happened during compilation. | 
| 109     if (report_exceptions) | 109     if (report_exceptions && !i::FLAG_debugger) | 
| 110       ReportException(&try_catch); | 110       ReportException(&try_catch); | 
| 111     return false; | 111     return false; | 
| 112   } else { | 112   } else { | 
| 113     Handle<Value> result = script->Run(); | 113     Handle<Value> result = script->Run(); | 
| 114     if (result.IsEmpty()) { | 114     if (result.IsEmpty()) { | 
| 115       // Print errors that happened during execution. | 115       // Print errors that happened during execution. | 
| 116       if (report_exceptions) | 116       if (report_exceptions && !i::FLAG_debugger) | 
| 117         ReportException(&try_catch); | 117         ReportException(&try_catch); | 
| 118       return false; | 118       return false; | 
| 119     } else { | 119     } else { | 
| 120       if (print_result && !result->IsUndefined()) { | 120       if (print_result && !result->IsUndefined()) { | 
| 121         // If all went well and the result wasn't undefined then print | 121         // If all went well and the result wasn't undefined then print | 
| 122         // the returned value. | 122         // the returned value. | 
| 123         String::Utf8Value str(result); | 123         String::Utf8Value str(result); | 
| 124         printf("%s\n", *str); | 124         printf("%s\n", *str); | 
| 125       } | 125       } | 
| 126       return true; | 126       return true; | 
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 470   return 0; | 470   return 0; | 
| 471 } | 471 } | 
| 472 | 472 | 
| 473 | 473 | 
| 474 }  // namespace v8 | 474 }  // namespace v8 | 
| 475 | 475 | 
| 476 | 476 | 
| 477 int main(int argc, char* argv[]) { | 477 int main(int argc, char* argv[]) { | 
| 478   return v8::Shell::Main(argc, argv); | 478   return v8::Shell::Main(argc, argv); | 
| 479 } | 479 } | 
| OLD | NEW | 
|---|