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

Side by Side Diff: samples/shell.cc

Issue 196793013: Revert "New Compilation API, part 1" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « samples/lineprocessor.cc ('k') | src/api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 298
299 // Executes a string within the current v8 context. 299 // Executes a string within the current v8 context.
300 bool ExecuteString(v8::Isolate* isolate, 300 bool ExecuteString(v8::Isolate* isolate,
301 v8::Handle<v8::String> source, 301 v8::Handle<v8::String> source,
302 v8::Handle<v8::Value> name, 302 v8::Handle<v8::Value> name,
303 bool print_result, 303 bool print_result,
304 bool report_exceptions) { 304 bool report_exceptions) {
305 v8::HandleScope handle_scope(isolate); 305 v8::HandleScope handle_scope(isolate);
306 v8::TryCatch try_catch; 306 v8::TryCatch try_catch;
307 v8::ScriptOrigin origin(name); 307 v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
308 v8::Handle<v8::Script> script = v8::Script::Compile(source, &origin);
309 if (script.IsEmpty()) { 308 if (script.IsEmpty()) {
310 // Print errors that happened during compilation. 309 // Print errors that happened during compilation.
311 if (report_exceptions) 310 if (report_exceptions)
312 ReportException(isolate, &try_catch); 311 ReportException(isolate, &try_catch);
313 return false; 312 return false;
314 } else { 313 } else {
315 v8::Handle<v8::Value> result = script->Run(); 314 v8::Handle<v8::Value> result = script->Run();
316 if (result.IsEmpty()) { 315 if (result.IsEmpty()) {
317 assert(try_catch.HasCaught()); 316 assert(try_catch.HasCaught());
318 // Print errors that happened during execution. 317 // Print errors that happened during execution.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 fprintf(stderr, "^"); 362 fprintf(stderr, "^");
364 } 363 }
365 fprintf(stderr, "\n"); 364 fprintf(stderr, "\n");
366 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); 365 v8::String::Utf8Value stack_trace(try_catch->StackTrace());
367 if (stack_trace.length() > 0) { 366 if (stack_trace.length() > 0) {
368 const char* stack_trace_string = ToCString(stack_trace); 367 const char* stack_trace_string = ToCString(stack_trace);
369 fprintf(stderr, "%s\n", stack_trace_string); 368 fprintf(stderr, "%s\n", stack_trace_string);
370 } 369 }
371 } 370 }
372 } 371 }
OLDNEW
« no previous file with comments | « samples/lineprocessor.cc ('k') | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698