| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 enum MayAccessDecision { | 383 enum MayAccessDecision { |
| 384 YES, NO, UNKNOWN | 384 YES, NO, UNKNOWN |
| 385 }; | 385 }; |
| 386 | 386 |
| 387 | 387 |
| 388 static MayAccessDecision MayAccessPreCheck(Isolate* isolate, | 388 static MayAccessDecision MayAccessPreCheck(Isolate* isolate, |
| 389 JSObject* receiver, | 389 JSObject* receiver, |
| 390 v8::AccessType type) { | 390 v8::AccessType type) { |
| 391 // During bootstrapping, callback functions are not enabled yet. | 391 // During bootstrapping, callback functions are not enabled yet. |
| 392 if (Bootstrapper::IsActive()) return YES; | 392 if (isolate->bootstrapper()->IsActive()) return YES; |
| 393 | 393 |
| 394 if (receiver->IsJSGlobalProxy()) { | 394 if (receiver->IsJSGlobalProxy()) { |
| 395 Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); | 395 Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); |
| 396 if (!receiver_context->IsContext()) return NO; | 396 if (!receiver_context->IsContext()) return NO; |
| 397 | 397 |
| 398 // Get the global context of current top context. | 398 // Get the global context of current top context. |
| 399 // avoid using Isolate::global_context() because it uses Handle. | 399 // avoid using Isolate::global_context() because it uses Handle. |
| 400 Context* global_context = isolate->context()->global()->global_context(); | 400 Context* global_context = isolate->context()->global()->global_context(); |
| 401 if (receiver_context == global_context) return YES; | 401 if (receiver_context == global_context) return YES; |
| 402 | 402 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 *target = MessageLocation(casted_script, pos, pos + 1); | 610 *target = MessageLocation(casted_script, pos, pos + 1); |
| 611 } | 611 } |
| 612 } | 612 } |
| 613 } | 613 } |
| 614 | 614 |
| 615 | 615 |
| 616 void Isolate::ReportUncaughtException(Handle<Object> exception, | 616 void Isolate::ReportUncaughtException(Handle<Object> exception, |
| 617 MessageLocation* location, | 617 MessageLocation* location, |
| 618 Handle<String> stack_trace) { | 618 Handle<String> stack_trace) { |
| 619 Handle<Object> message; | 619 Handle<Object> message; |
| 620 if (!Bootstrapper::IsActive()) { | 620 if (!bootstrapper()->IsActive()) { |
| 621 // It's not safe to try to make message objects while the bootstrapper | 621 // It's not safe to try to make message objects while the bootstrapper |
| 622 // is active since the infrastructure may not have been properly | 622 // is active since the infrastructure may not have been properly |
| 623 // initialized. | 623 // initialized. |
| 624 message = | 624 message = |
| 625 MessageHandler::MakeMessageObject("uncaught_exception", | 625 MessageHandler::MakeMessageObject("uncaught_exception", |
| 626 location, | 626 location, |
| 627 HandleVector<Object>(&exception, 1), | 627 HandleVector<Object>(&exception, 1), |
| 628 stack_trace); | 628 stack_trace); |
| 629 } | 629 } |
| 630 // Report the uncaught exception. | 630 // Report the uncaught exception. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 MessageLocation potential_computed_location; | 692 MessageLocation potential_computed_location; |
| 693 bool try_catch_needs_message = | 693 bool try_catch_needs_message = |
| 694 is_caught_externally && | 694 is_caught_externally && |
| 695 thread_local_top()->TryCatchHandler()->capture_message_; | 695 thread_local_top()->TryCatchHandler()->capture_message_; |
| 696 if (report_exception || try_catch_needs_message) { | 696 if (report_exception || try_catch_needs_message) { |
| 697 if (location == NULL) { | 697 if (location == NULL) { |
| 698 // If no location was specified we use a computed one instead | 698 // If no location was specified we use a computed one instead |
| 699 ComputeLocation(&potential_computed_location); | 699 ComputeLocation(&potential_computed_location); |
| 700 location = &potential_computed_location; | 700 location = &potential_computed_location; |
| 701 } | 701 } |
| 702 if (!Bootstrapper::IsActive()) { | 702 if (!bootstrapper()->IsActive()) { |
| 703 // It's not safe to try to make message objects or collect stack | 703 // It's not safe to try to make message objects or collect stack |
| 704 // traces while the bootstrapper is active since the infrastructure | 704 // traces while the bootstrapper is active since the infrastructure |
| 705 // may not have been properly initialized. | 705 // may not have been properly initialized. |
| 706 Handle<String> stack_trace; | 706 Handle<String> stack_trace; |
| 707 if (FLAG_trace_exception) stack_trace = StackTraceString(); | 707 if (FLAG_trace_exception) stack_trace = StackTraceString(); |
| 708 message_obj = MessageHandler::MakeMessageObject("uncaught_exception", | 708 message_obj = MessageHandler::MakeMessageObject("uncaught_exception", |
| 709 location, HandleVector<Object>(&exception_handle, 1), stack_trace); | 709 location, HandleVector<Object>(&exception_handle, 1), stack_trace); |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 Isolate::Current()->break_access()->Lock(); | 899 Isolate::Current()->break_access()->Lock(); |
| 900 } | 900 } |
| 901 | 901 |
| 902 | 902 |
| 903 ExecutionAccess::~ExecutionAccess() { | 903 ExecutionAccess::~ExecutionAccess() { |
| 904 Isolate::Current()->break_access()->Unlock(); | 904 Isolate::Current()->break_access()->Unlock(); |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 } } // namespace v8::internal | 908 } } // namespace v8::internal |
| OLD | NEW |