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 script = v8::Script::Compile(script_source, script_name); | 241 v8::ScriptOrigin origin(script_name); |
| 242 script = v8::Script::Compile(script_source, &origin); |
242 if (script.IsEmpty()) { | 243 if (script.IsEmpty()) { |
243 // Print errors that happened during compilation. | 244 // Print errors that happened during compilation. |
244 if (report_exceptions) | 245 if (report_exceptions) |
245 ReportException(isolate, &try_catch); | 246 ReportException(isolate, &try_catch); |
246 return 1; | 247 return 1; |
247 } | 248 } |
248 } | 249 } |
249 | 250 |
250 { | 251 { |
251 v8::TryCatch try_catch; | 252 v8::TryCatch try_catch; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 447 } |
447 // Remove newline char | 448 // Remove newline char |
448 for (char* pos = buffer; *pos != '\0'; pos++) { | 449 for (char* pos = buffer; *pos != '\0'; pos++) { |
449 if (*pos == '\n') { | 450 if (*pos == '\n') { |
450 *pos = '\0'; | 451 *pos = '\0'; |
451 break; | 452 break; |
452 } | 453 } |
453 } | 454 } |
454 return v8::String::NewFromUtf8(isolate, buffer); | 455 return v8::String::NewFromUtf8(isolate, buffer); |
455 } | 456 } |
OLD | NEW |