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

Side by Side Diff: runtime/vm/exceptions.cc

Issue 1690903003: Remove support for Javascript warnings in the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.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 | « runtime/vm/exceptions.h ('k') | runtime/vm/flow_graph_builder.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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/exceptions.h" 5 #include "vm/exceptions.h"
6 6
7 #include "platform/address_sanitizer.h" 7 #include "platform/address_sanitizer.h"
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 class_name = &Symbols::UnsupportedError(); 628 class_name = &Symbols::UnsupportedError();
629 break; 629 break;
630 case kNullThrown: 630 case kNullThrown:
631 library = Library::CoreLibrary(); 631 library = Library::CoreLibrary();
632 class_name = &Symbols::NullThrownError(); 632 class_name = &Symbols::NullThrownError();
633 break; 633 break;
634 case kIsolateSpawn: 634 case kIsolateSpawn:
635 library = Library::IsolateLibrary(); 635 library = Library::IsolateLibrary();
636 class_name = &Symbols::IsolateSpawnException(); 636 class_name = &Symbols::IsolateSpawnException();
637 break; 637 break;
638 case kJavascriptIntegerOverflowError:
639 library = Library::CoreLibrary();
640 class_name = &Symbols::JavascriptIntegerOverflowError();
641 break;
642 case kJavascriptCompatibilityError:
643 library = Library::CoreLibrary();
644 class_name = &Symbols::JavascriptCompatibilityError();
645 break;
646 case kAssertion: 638 case kAssertion:
647 library = Library::CoreLibrary(); 639 library = Library::CoreLibrary();
648 class_name = &Symbols::AssertionError(); 640 class_name = &Symbols::AssertionError();
649 constructor_name = &Symbols::DotCreate(); 641 constructor_name = &Symbols::DotCreate();
650 break; 642 break;
651 case kCast: 643 case kCast:
652 library = Library::CoreLibrary(); 644 library = Library::CoreLibrary();
653 class_name = &Symbols::CastError(); 645 class_name = &Symbols::CastError();
654 constructor_name = &Symbols::DotCreate(); 646 constructor_name = &Symbols::DotCreate();
655 break; 647 break;
(...skipping 17 matching lines...) Expand all
673 class_name = &Symbols::CyclicInitializationError(); 665 class_name = &Symbols::CyclicInitializationError();
674 } 666 }
675 667
676 return DartLibraryCalls::InstanceCreate(library, 668 return DartLibraryCalls::InstanceCreate(library,
677 *class_name, 669 *class_name,
678 *constructor_name, 670 *constructor_name,
679 arguments); 671 arguments);
680 } 672 }
681 673
682 674
683 // Throw JavascriptCompatibilityError exception.
684 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) {
685 const Array& exc_args = Array::Handle(Array::New(1));
686 const String& msg_str = String::Handle(String::New(msg));
687 exc_args.SetAt(0, msg_str);
688 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args);
689 }
690
691
692 static bool IsLikelyInternalDart2JSCrash(const Stacktrace& stacktrace) { 675 static bool IsLikelyInternalDart2JSCrash(const Stacktrace& stacktrace) {
693 Function& function = Function::Handle(); 676 Function& function = Function::Handle();
694 String& name = String::Handle(); 677 String& name = String::Handle();
695 for (intptr_t i = 0, len = stacktrace.Length(); i < len; i++) { 678 for (intptr_t i = 0, len = stacktrace.Length(); i < len; i++) {
696 function = stacktrace.FunctionAtFrame(i); 679 function = stacktrace.FunctionAtFrame(i);
697 name = function.QualifiedPrettyName(); 680 name = function.QualifiedPrettyName();
698 if (name.Equals("_CompilerDiagnosticReporter.withCurrentElement")) { 681 if (name.Equals("_CompilerDiagnosticReporter.withCurrentElement")) {
699 return true; 682 return true;
700 } 683 }
701 } 684 }
702 return false; 685 return false;
703 } 686 }
704 687
705 688
706 void Exceptions::PrintStackTraceAndAbort(const char* reason) { 689 void Exceptions::PrintStackTraceAndAbort(const char* reason) {
707 const Stacktrace& stacktrace = Stacktrace::Handle(CurrentStacktrace()); 690 const Stacktrace& stacktrace = Stacktrace::Handle(CurrentStacktrace());
708 if (!IsLikelyInternalDart2JSCrash(stacktrace)) { 691 if (!IsLikelyInternalDart2JSCrash(stacktrace)) {
709 return; 692 return;
710 } 693 }
711 694
712 OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n", 695 OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n",
713 reason, 696 reason,
714 stacktrace.ToCString()); 697 stacktrace.ToCString());
715 OS::Abort(); 698 OS::Abort();
716 } 699 }
717 700
718 } // namespace dart 701 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698