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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); | 231 v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); |
232 } | 232 } |
233 #endif // ENABLE_DEBUGGER_SUPPORT | 233 #endif // ENABLE_DEBUGGER_SUPPORT |
234 | 234 |
235 bool report_exceptions = true; | 235 bool report_exceptions = true; |
236 | 236 |
237 v8::Handle<v8::Script> script; | 237 v8::Handle<v8::Script> script; |
238 { | 238 { |
239 // Compile script in try/catch context. | 239 // Compile script in try/catch context. |
240 v8::TryCatch try_catch; | 240 v8::TryCatch try_catch; |
241 v8::ScriptOrigin origin(script_name); | 241 script = v8::Script::Compile(script_source, script_name); |
242 script = v8::Script::Compile(script_source, &origin); | |
243 if (script.IsEmpty()) { | 242 if (script.IsEmpty()) { |
244 // Print errors that happened during compilation. | 243 // Print errors that happened during compilation. |
245 if (report_exceptions) | 244 if (report_exceptions) |
246 ReportException(isolate, &try_catch); | 245 ReportException(isolate, &try_catch); |
247 return 1; | 246 return 1; |
248 } | 247 } |
249 } | 248 } |
250 | 249 |
251 { | 250 { |
252 v8::TryCatch try_catch; | 251 v8::TryCatch try_catch; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 446 } |
448 // Remove newline char | 447 // Remove newline char |
449 for (char* pos = buffer; *pos != '\0'; pos++) { | 448 for (char* pos = buffer; *pos != '\0'; pos++) { |
450 if (*pos == '\n') { | 449 if (*pos == '\n') { |
451 *pos = '\0'; | 450 *pos = '\0'; |
452 break; | 451 break; |
453 } | 452 } |
454 } | 453 } |
455 return v8::String::NewFromUtf8(isolate, buffer); | 454 return v8::String::NewFromUtf8(isolate, buffer); |
456 } | 455 } |
OLD | NEW |