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

Side by Side Diff: src/isolate.cc

Issue 1121453003: Revert of Wrap v8natives.js into a function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/isolate.h ('k') | src/json.js » ('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 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 entry = api_interrupts_queue_.front(); 902 entry = api_interrupts_queue_.front();
903 api_interrupts_queue_.pop(); 903 api_interrupts_queue_.pop();
904 } 904 }
905 VMState<EXTERNAL> state(this); 905 VMState<EXTERNAL> state(this);
906 HandleScope handle_scope(this); 906 HandleScope handle_scope(this);
907 entry.first(reinterpret_cast<v8::Isolate*>(this), entry.second); 907 entry.first(reinterpret_cast<v8::Isolate*>(this), entry.second);
908 } 908 }
909 } 909 }
910 910
911 911
912 void Isolate::ReportBootstrappingException(Handle<Object> exception, 912 void ReportBootstrappingException(Handle<Object> exception,
913 MessageLocation* location) { 913 MessageLocation* location) {
914 base::OS::PrintError("Exception thrown during bootstrapping\n"); 914 base::OS::PrintError("Exception thrown during bootstrapping\n");
915 if (location == NULL || location->script().is_null()) { 915 if (location == NULL || location->script().is_null()) return;
916 exception->Print();
917 PrintStack(stdout);
918 return;
919 }
920 // We are bootstrapping and caught an error where the location is set 916 // We are bootstrapping and caught an error where the location is set
921 // and we have a script for the location. 917 // and we have a script for the location.
922 // In this case we could have an extension (or an internal error 918 // In this case we could have an extension (or an internal error
923 // somewhere) and we print out the line number at which the error occured 919 // somewhere) and we print out the line number at which the error occured
924 // to the console for easier debugging. 920 // to the console for easier debugging.
925 int line_number = 921 int line_number =
926 location->script()->GetLineNumber(location->start_pos()) + 1; 922 location->script()->GetLineNumber(location->start_pos()) + 1;
927 if (exception->IsString() && location->script()->name()->IsString()) { 923 if (exception->IsString() && location->script()->name()->IsString()) {
928 base::OS::PrintError( 924 base::OS::PrintError(
929 "Extension or internal compilation error: %s in %s at line %d.\n", 925 "Extension or internal compilation error: %s in %s at line %d.\n",
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 try_catch_handler()->capture_message_; 974 try_catch_handler()->capture_message_;
979 bool rethrowing_message = thread_local_top()->rethrowing_message_; 975 bool rethrowing_message = thread_local_top()->rethrowing_message_;
980 976
981 thread_local_top()->rethrowing_message_ = false; 977 thread_local_top()->rethrowing_message_ = false;
982 978
983 // Notify debugger of exception. 979 // Notify debugger of exception.
984 if (is_catchable_by_javascript(exception)) { 980 if (is_catchable_by_javascript(exception)) {
985 debug()->OnThrow(exception_handle); 981 debug()->OnThrow(exception_handle);
986 } 982 }
987 983
988 if (bootstrapper()->IsActive()) { 984 // Generate the message if required.
989 // It's not safe to try to make message objects or collect stack traces 985 if (requires_message && !rethrowing_message) {
990 // while the bootstrapper is active since the infrastructure may not have
991 // been properly initialized.
992 ReportBootstrappingException(exception_handle, location);
993 } else if (requires_message && !rethrowing_message) {
994 MessageLocation potential_computed_location; 986 MessageLocation potential_computed_location;
995 if (location == NULL) { 987 if (location == NULL) {
996 // If no location was specified we use a computed one instead. 988 // If no location was specified we use a computed one instead.
997 ComputeLocation(&potential_computed_location); 989 ComputeLocation(&potential_computed_location);
998 location = &potential_computed_location; 990 location = &potential_computed_location;
999 } 991 }
1000 992
1001 Handle<Object> message_obj = CreateMessage(exception_handle, location); 993 if (bootstrapper()->IsActive()) {
1002 thread_local_top()->pending_message_obj_ = *message_obj; 994 // It's not safe to try to make message objects or collect stack traces
995 // while the bootstrapper is active since the infrastructure may not have
996 // been properly initialized.
997 ReportBootstrappingException(exception_handle, location);
998 } else {
999 Handle<Object> message_obj = CreateMessage(exception_handle, location);
1000 thread_local_top()->pending_message_obj_ = *message_obj;
1003 1001
1004 // If the abort-on-uncaught-exception flag is specified, abort on any 1002 // If the abort-on-uncaught-exception flag is specified, abort on any
1005 // exception not caught by JavaScript, even when an external handler is 1003 // exception not caught by JavaScript, even when an external handler is
1006 // present. This flag is intended for use by JavaScript developers, so 1004 // present. This flag is intended for use by JavaScript developers, so
1007 // print a user-friendly stack trace (not an internal one). 1005 // print a user-friendly stack trace (not an internal one).
1008 if (FLAG_abort_on_uncaught_exception && 1006 if (FLAG_abort_on_uncaught_exception &&
1009 PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) { 1007 PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) {
1010 FLAG_abort_on_uncaught_exception = false; // Prevent endless recursion. 1008 FLAG_abort_on_uncaught_exception = false; // Prevent endless recursion.
1011 PrintF(stderr, "%s\n\nFROM\n", 1009 PrintF(stderr, "%s\n\nFROM\n",
1012 MessageHandler::GetLocalizedMessage(this, message_obj).get()); 1010 MessageHandler::GetLocalizedMessage(this, message_obj).get());
1013 PrintCurrentStackTrace(stderr); 1011 PrintCurrentStackTrace(stderr);
1014 base::OS::Abort(); 1012 base::OS::Abort();
1013 }
1015 } 1014 }
1016 } 1015 }
1017 1016
1018 // Set the exception being thrown. 1017 // Set the exception being thrown.
1019 set_pending_exception(*exception_handle); 1018 set_pending_exception(*exception_handle);
1020 return heap()->exception(); 1019 return heap()->exception();
1021 } 1020 }
1022 1021
1023 1022
1024 Object* Isolate::ReThrow(Object* exception) { 1023 Object* Isolate::ReThrow(Object* exception) {
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 if (prev_ && prev_->Intercept(flag)) return true; 2760 if (prev_ && prev_->Intercept(flag)) return true;
2762 // Then check whether this scope intercepts. 2761 // Then check whether this scope intercepts.
2763 if ((flag & intercept_mask_)) { 2762 if ((flag & intercept_mask_)) {
2764 intercepted_flags_ |= flag; 2763 intercepted_flags_ |= flag;
2765 return true; 2764 return true;
2766 } 2765 }
2767 return false; 2766 return false;
2768 } 2767 }
2769 2768
2770 } } // namespace v8::internal 2769 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698