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

Side by Side Diff: src/d8.cc

Issue 1154423004: Update all callsites of the TryCatch ctor to pass an Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/api.cc ('k') | src/d8-debug.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // Executes a string within the current v8 context. 300 // Executes a string within the current v8 context.
301 bool Shell::ExecuteString(Isolate* isolate, Handle<String> source, 301 bool Shell::ExecuteString(Isolate* isolate, Handle<String> source,
302 Handle<Value> name, bool print_result, 302 Handle<Value> name, bool print_result,
303 bool report_exceptions, SourceType source_type) { 303 bool report_exceptions, SourceType source_type) {
304 #ifndef V8_SHARED 304 #ifndef V8_SHARED
305 bool FLAG_debugger = i::FLAG_debugger; 305 bool FLAG_debugger = i::FLAG_debugger;
306 #else 306 #else
307 bool FLAG_debugger = false; 307 bool FLAG_debugger = false;
308 #endif // !V8_SHARED 308 #endif // !V8_SHARED
309 HandleScope handle_scope(isolate); 309 HandleScope handle_scope(isolate);
310 TryCatch try_catch; 310 TryCatch try_catch(isolate);
311 options.script_executed = true; 311 options.script_executed = true;
312 if (FLAG_debugger) { 312 if (FLAG_debugger) {
313 // When debugging make exceptions appear to be uncaught. 313 // When debugging make exceptions appear to be uncaught.
314 try_catch.SetVerbose(true); 314 try_catch.SetVerbose(true);
315 } 315 }
316 316
317 Handle<Value> result; 317 Handle<Value> result;
318 { 318 {
319 PerIsolateData* data = PerIsolateData::Get(isolate); 319 PerIsolateData* data = PerIsolateData::Get(isolate);
320 Local<Context> realm = 320 Local<Context> realm =
(...skipping 24 matching lines...) Expand all
345 #endif 345 #endif
346 if (!result->IsUndefined()) { 346 if (!result->IsUndefined()) {
347 // If all went well and the result wasn't undefined then print 347 // If all went well and the result wasn't undefined then print
348 // the returned value. 348 // the returned value.
349 v8::String::Utf8Value str(result); 349 v8::String::Utf8Value str(result);
350 fwrite(*str, sizeof(**str), str.length(), stdout); 350 fwrite(*str, sizeof(**str), str.length(), stdout);
351 printf("\n"); 351 printf("\n");
352 } 352 }
353 #if !defined(V8_SHARED) 353 #if !defined(V8_SHARED)
354 } else { 354 } else {
355 v8::TryCatch try_catch; 355 v8::TryCatch try_catch(isolate);
356 v8::Local<v8::Context> context = 356 v8::Local<v8::Context> context =
357 v8::Local<v8::Context>::New(isolate, utility_context_); 357 v8::Local<v8::Context>::New(isolate, utility_context_);
358 v8::Context::Scope context_scope(context); 358 v8::Context::Scope context_scope(context);
359 Handle<Object> global = context->Global(); 359 Handle<Object> global = context->Global();
360 Handle<Value> fun = 360 Handle<Value> fun =
361 global->Get(String::NewFromUtf8(isolate, "Stringify")); 361 global->Get(String::NewFromUtf8(isolate, "Stringify"));
362 Handle<Value> argv[1] = {result}; 362 Handle<Value> argv[1] = {result};
363 Handle<Value> s = Handle<Function>::Cast(fun)->Call(global, 1, argv); 363 Handle<Value> s = Handle<Function>::Cast(fun)->Call(global, 1, argv);
364 if (try_catch.HasCaught()) return true; 364 if (try_catch.HasCaught()) return true;
365 v8::String::Utf8Value str(s); 365 v8::String::Utf8Value str(s);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 565
566 void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) { 566 void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) {
567 for (int i = 0; i < args.Length(); i++) { 567 for (int i = 0; i < args.Length(); i++) {
568 HandleScope handle_scope(args.GetIsolate()); 568 HandleScope handle_scope(args.GetIsolate());
569 if (i != 0) { 569 if (i != 0) {
570 printf(" "); 570 printf(" ");
571 } 571 }
572 572
573 // Explicitly catch potential exceptions in toString(). 573 // Explicitly catch potential exceptions in toString().
574 v8::TryCatch try_catch; 574 v8::TryCatch try_catch(args.GetIsolate());
575 Handle<String> str_obj = args[i]->ToString(args.GetIsolate()); 575 Handle<String> str_obj = args[i]->ToString(args.GetIsolate());
576 if (try_catch.HasCaught()) { 576 if (try_catch.HasCaught()) {
577 try_catch.ReThrow(); 577 try_catch.ReThrow();
578 return; 578 return;
579 } 579 }
580 580
581 v8::String::Utf8Value str(str_obj); 581 v8::String::Utf8Value str(str_obj);
582 int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout)); 582 int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout));
583 if (n != str.length()) { 583 if (n != str.length()) {
584 printf("Error in fwrite\n"); 584 printf("Error in fwrite\n");
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 } 1748 }
1749 1749
1750 } // namespace v8 1750 } // namespace v8
1751 1751
1752 1752
1753 #ifndef GOOGLE3 1753 #ifndef GOOGLE3
1754 int main(int argc, char* argv[]) { 1754 int main(int argc, char* argv[]) {
1755 return v8::Shell::Main(argc, argv); 1755 return v8::Shell::Main(argc, argv);
1756 } 1756 }
1757 #endif 1757 #endif
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/d8-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698