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

Side by Side Diff: src/d8.cc

Issue 1692133002: Reland of [interpreter] Make d8's TryCatch block be verbose. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return result; 368 return result;
369 } 369 }
370 370
371 371
372 // Executes a string within the current v8 context. 372 // Executes a string within the current v8 context.
373 bool Shell::ExecuteString(Isolate* isolate, Local<String> source, 373 bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
374 Local<Value> name, bool print_result, 374 Local<Value> name, bool print_result,
375 bool report_exceptions, SourceType source_type) { 375 bool report_exceptions, SourceType source_type) {
376 HandleScope handle_scope(isolate); 376 HandleScope handle_scope(isolate);
377 TryCatch try_catch(isolate); 377 TryCatch try_catch(isolate);
378 try_catch.SetVerbose(true);
378 379
379 MaybeLocal<Value> maybe_result; 380 MaybeLocal<Value> maybe_result;
380 { 381 {
381 PerIsolateData* data = PerIsolateData::Get(isolate); 382 PerIsolateData* data = PerIsolateData::Get(isolate);
382 Local<Context> realm = 383 Local<Context> realm =
383 Local<Context>::New(isolate, data->realms_[data->realm_current_]); 384 Local<Context>::New(isolate, data->realms_[data->realm_current_]);
384 Context::Scope context_scope(realm); 385 Context::Scope context_scope(realm);
385 Local<Script> script; 386 Local<Script> script;
386 if (!Shell::CompileString(isolate, source, name, options.compile_options, 387 if (!Shell::CompileString(isolate, source, name, options.compile_options,
387 source_type).ToLocal(&script)) { 388 source_type).ToLocal(&script)) {
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); 1241 Local<ObjectTemplate> os_templ = ObjectTemplate::New(isolate);
1241 AddOSMethods(isolate, os_templ); 1242 AddOSMethods(isolate, os_templ);
1242 global_template->Set( 1243 global_template->Set(
1243 String::NewFromUtf8(isolate, "os", NewStringType::kNormal) 1244 String::NewFromUtf8(isolate, "os", NewStringType::kNormal)
1244 .ToLocalChecked(), 1245 .ToLocalChecked(),
1245 os_templ); 1246 os_templ);
1246 1247
1247 return global_template; 1248 return global_template;
1248 } 1249 }
1249 1250
1251 static void EmptyMessageCallback(Local<Message> message, Local<Value> error) {
1252 // Nothing to be done here, exceptions thrown up to the shell will be reported
1253 // separately by {Shell::ReportException} after they are caught.
1254 }
1250 1255
1251 void Shell::Initialize(Isolate* isolate) { 1256 void Shell::Initialize(Isolate* isolate) {
1252 #ifndef V8_SHARED 1257 #ifndef V8_SHARED
1253 // Set up counters 1258 // Set up counters
1254 if (i::StrLength(i::FLAG_map_counters) != 0) 1259 if (i::StrLength(i::FLAG_map_counters) != 0)
1255 MapCounters(isolate, i::FLAG_map_counters); 1260 MapCounters(isolate, i::FLAG_map_counters);
1256 #endif // !V8_SHARED 1261 #endif // !V8_SHARED
1262 // Disable default message reporting.
1263 isolate->AddMessageListener(EmptyMessageCallback);
1257 } 1264 }
1258 1265
1259 1266
1260 Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { 1267 Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
1261 #ifndef V8_SHARED 1268 #ifndef V8_SHARED
1262 // This needs to be a critical section since this is not thread-safe 1269 // This needs to be a critical section since this is not thread-safe
1263 base::LockGuard<base::Mutex> lock_guard(context_mutex_.Pointer()); 1270 base::LockGuard<base::Mutex> lock_guard(context_mutex_.Pointer());
1264 #endif // !V8_SHARED 1271 #endif // !V8_SHARED
1265 // Initialize the global objects 1272 // Initialize the global objects
1266 Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); 1273 Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 } 2562 }
2556 2563
2557 } // namespace v8 2564 } // namespace v8
2558 2565
2559 2566
2560 #ifndef GOOGLE3 2567 #ifndef GOOGLE3
2561 int main(int argc, char* argv[]) { 2568 int main(int argc, char* argv[]) {
2562 return v8::Shell::Main(argc, argv); 2569 return v8::Shell::Main(argc, argv);
2563 } 2570 }
2564 #endif 2571 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698