| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| 189 Handle<JSArray> Isolate::CaptureCurrentStackTrace( | 189 Handle<JSArray> Isolate::CaptureCurrentStackTrace( |
| 190 int frame_limit, StackTrace::StackTraceOptions options) { | 190 int frame_limit, StackTrace::StackTraceOptions options) { |
| 191 // Ensure no negative values. | 191 // Ensure no negative values. |
| 192 int limit = Max(frame_limit, 0); | 192 int limit = Max(frame_limit, 0); |
| 193 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); | 193 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); |
| 194 | 194 |
| 195 Handle<String> column_key = factory()->LookupAsciiSymbol("column"); | 195 Handle<String> column_key = factory()->LookupAsciiSymbol("column"); |
| 196 Handle<String> line_key = factory()->LookupAsciiSymbol("lineNumber"); | 196 Handle<String> line_key = factory()->LookupAsciiSymbol("lineNumber"); |
| 197 Handle<String> script_key = factory()->LookupAsciiSymbol("scriptName"); | 197 Handle<String> script_key = factory()->LookupAsciiSymbol("scriptName"); |
| 198 Handle<String> name_or_source_url_key = | 198 Handle<String> name_or_source_url_key = |
| 199 factory()->LookupAsciiSymbol("nameOrSourceURL"); | 199 factory()->LookupAsciiSymbol("nameOrSourceURL"); |
| 200 Handle<String> script_name_or_source_url_key = | 200 Handle<String> script_name_or_source_url_key = |
| 201 factory()->LookupAsciiSymbol("scriptNameOrSourceURL"); | 201 factory()->LookupAsciiSymbol("scriptNameOrSourceURL"); |
| 202 Handle<String> function_key = factory()->LookupAsciiSymbol("functionName"); | 202 Handle<String> function_key = factory()->LookupAsciiSymbol("functionName"); |
| 203 Handle<String> eval_key = factory()->LookupAsciiSymbol("isEval"); | 203 Handle<String> eval_key = factory()->LookupAsciiSymbol("isEval"); |
| 204 Handle<String> constructor_key = | 204 Handle<String> constructor_key = |
| 205 factory()->LookupAsciiSymbol("isConstructor"); | 205 factory()->LookupAsciiSymbol("isConstructor"); |
| 206 | 206 |
| 207 StackTraceFrameIterator it; | 207 StackTraceFrameIterator it; |
| 208 int frames_seen = 0; | 208 int frames_seen = 0; |
| 209 while (!it.done() && (frames_seen < limit)) { | 209 while (!it.done() && (frames_seen < limit)) { |
| 210 JavaScriptFrame* frame = it.frame(); | 210 JavaScriptFrame* frame = it.frame(); |
| 211 | 211 |
| 212 List<FrameSummary> frames(3); // Max 2 levels of inlining. | 212 List<FrameSummary> frames(3); // Max 2 levels of inlining. |
| 213 frame->Summarize(&frames); | 213 frame->Summarize(&frames); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 227 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { | 227 if (options & StackTrace::kColumnOffset && relative_line_number >= 0) { |
| 228 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); | 228 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
| 229 int start = (relative_line_number == 0) ? 0 : | 229 int start = (relative_line_number == 0) ? 0 : |
| 230 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; | 230 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; |
| 231 int column_offset = position - start; | 231 int column_offset = position - start; |
| 232 if (relative_line_number == 0) { | 232 if (relative_line_number == 0) { |
| 233 // For the case where the code is on the same line as the script | 233 // For the case where the code is on the same line as the script |
| 234 // tag. | 234 // tag. |
| 235 column_offset += script->column_offset()->value(); | 235 column_offset += script->column_offset()->value(); |
| 236 } | 236 } |
| 237 SetProperty(stackFrame, column_key, | 237 SetLocalPropertyNoThrow(stackFrame, column_key, |
| 238 Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE); | 238 Handle<Smi>(Smi::FromInt(column_offset + 1))); |
| 239 } | 239 } |
| 240 SetProperty(stackFrame, line_key, | 240 SetLocalPropertyNoThrow(stackFrame, line_key, |
| 241 Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE); | 241 Handle<Smi>(Smi::FromInt(line_number + 1))); |
| 242 } | 242 } |
| 243 | 243 |
| 244 if (options & StackTrace::kScriptName) { | 244 if (options & StackTrace::kScriptName) { |
| 245 Handle<Object> script_name(script->name(), this); | 245 Handle<Object> script_name(script->name(), this); |
| 246 SetProperty(stackFrame, script_key, script_name, NONE); | 246 SetLocalPropertyNoThrow(stackFrame, script_key, script_name); |
| 247 } | 247 } |
| 248 | 248 |
| 249 if (options & StackTrace::kScriptNameOrSourceURL) { | 249 if (options & StackTrace::kScriptNameOrSourceURL) { |
| 250 Handle<Object> script_name(script->name(), this); | 250 Handle<Object> script_name(script->name(), this); |
| 251 Handle<JSValue> script_wrapper = GetScriptWrapper(script); | 251 Handle<JSValue> script_wrapper = GetScriptWrapper(script); |
| 252 Handle<Object> property = GetProperty(script_wrapper, | 252 Handle<Object> property = GetProperty(script_wrapper, |
| 253 name_or_source_url_key); | 253 name_or_source_url_key); |
| 254 ASSERT(property->IsJSFunction()); | 254 ASSERT(property->IsJSFunction()); |
| 255 Handle<JSFunction> method = Handle<JSFunction>::cast(property); | 255 Handle<JSFunction> method = Handle<JSFunction>::cast(property); |
| 256 bool caught_exception; | 256 bool caught_exception; |
| 257 Handle<Object> result = Execution::TryCall(method, script_wrapper, 0, | 257 Handle<Object> result = Execution::TryCall(method, script_wrapper, 0, |
| 258 NULL, &caught_exception); | 258 NULL, &caught_exception); |
| 259 if (caught_exception) { | 259 if (caught_exception) { |
| 260 result = factory()->undefined_value(); | 260 result = factory()->undefined_value(); |
| 261 } | 261 } |
| 262 SetProperty(stackFrame, script_name_or_source_url_key, result, NONE); | 262 SetLocalPropertyNoThrow(stackFrame, script_name_or_source_url_key, |
| 263 result); |
| 263 } | 264 } |
| 264 | 265 |
| 265 if (options & StackTrace::kFunctionName) { | 266 if (options & StackTrace::kFunctionName) { |
| 266 Handle<Object> fun_name(fun->shared()->name(), this); | 267 Handle<Object> fun_name(fun->shared()->name(), this); |
| 267 if (fun_name->ToBoolean()->IsFalse()) { | 268 if (fun_name->ToBoolean()->IsFalse()) { |
| 268 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); | 269 fun_name = Handle<Object>(fun->shared()->inferred_name(), this); |
| 269 } | 270 } |
| 270 SetProperty(stackFrame, function_key, fun_name, NONE); | 271 SetLocalPropertyNoThrow(stackFrame, function_key, fun_name); |
| 271 } | 272 } |
| 272 | 273 |
| 273 if (options & StackTrace::kIsEval) { | 274 if (options & StackTrace::kIsEval) { |
| 274 int type = Smi::cast(script->compilation_type())->value(); | 275 int type = Smi::cast(script->compilation_type())->value(); |
| 275 Handle<Object> is_eval = (type == Script::COMPILATION_TYPE_EVAL) ? | 276 Handle<Object> is_eval = (type == Script::COMPILATION_TYPE_EVAL) ? |
| 276 factory()->true_value() : factory()->false_value(); | 277 factory()->true_value() : factory()->false_value(); |
| 277 SetProperty(stackFrame, eval_key, is_eval, NONE); | 278 SetLocalPropertyNoThrow(stackFrame, eval_key, is_eval); |
| 278 } | 279 } |
| 279 | 280 |
| 280 if (options & StackTrace::kIsConstructor) { | 281 if (options & StackTrace::kIsConstructor) { |
| 281 Handle<Object> is_constructor = (frames[i].is_constructor()) ? | 282 Handle<Object> is_constructor = (frames[i].is_constructor()) ? |
| 282 factory()->true_value() : factory()->false_value(); | 283 factory()->true_value() : factory()->false_value(); |
| 283 SetProperty(stackFrame, constructor_key, is_constructor, NONE); | 284 SetLocalPropertyNoThrow(stackFrame, constructor_key, is_constructor); |
| 284 } | 285 } |
| 285 | 286 |
| 286 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stackFrame); | 287 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stackFrame); |
| 287 frames_seen++; | 288 frames_seen++; |
| 288 } | 289 } |
| 289 it.Advance(); | 290 it.Advance(); |
| 290 } | 291 } |
| 291 | 292 |
| 292 stack_trace->set_length(Smi::FromInt(frames_seen)); | 293 stack_trace->set_length(Smi::FromInt(frames_seen)); |
| 293 return stack_trace; | 294 return stack_trace; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 539 } |
| 539 | 540 |
| 540 | 541 |
| 541 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { | 542 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { |
| 542 DoThrow(exception, location, NULL); | 543 DoThrow(exception, location, NULL); |
| 543 return Failure::Exception(); | 544 return Failure::Exception(); |
| 544 } | 545 } |
| 545 | 546 |
| 546 | 547 |
| 547 Failure* Isolate::ReThrow(MaybeObject* exception, MessageLocation* location) { | 548 Failure* Isolate::ReThrow(MaybeObject* exception, MessageLocation* location) { |
| 549 bool can_be_caught_externally = false; |
| 550 ShouldReportException(&can_be_caught_externally, |
| 551 is_catchable_by_javascript(exception)); |
| 552 thread_local_top()->catcher_ = can_be_caught_externally ? |
| 553 try_catch_handler() : NULL; |
| 554 |
| 548 // Set the exception being re-thrown. | 555 // Set the exception being re-thrown. |
| 549 set_pending_exception(exception); | 556 set_pending_exception(exception); |
| 550 return Failure::Exception(); | 557 return Failure::Exception(); |
| 551 } | 558 } |
| 552 | 559 |
| 553 | 560 |
| 554 Failure* Isolate::ThrowIllegalOperation() { | 561 Failure* Isolate::ThrowIllegalOperation() { |
| 555 return Throw(heap_.illegal_access_symbol()); | 562 return Throw(heap_.illegal_access_symbol()); |
| 556 } | 563 } |
| 557 | 564 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 !(Script::cast(script)->source()->IsUndefined())) { | 620 !(Script::cast(script)->source()->IsUndefined())) { |
| 614 int pos = frame->LookupCode(this)->SourcePosition(frame->pc()); | 621 int pos = frame->LookupCode(this)->SourcePosition(frame->pc()); |
| 615 // Compute the location from the function and the reloc info. | 622 // Compute the location from the function and the reloc info. |
| 616 Handle<Script> casted_script(Script::cast(script)); | 623 Handle<Script> casted_script(Script::cast(script)); |
| 617 *target = MessageLocation(casted_script, pos, pos + 1); | 624 *target = MessageLocation(casted_script, pos, pos + 1); |
| 618 } | 625 } |
| 619 } | 626 } |
| 620 } | 627 } |
| 621 | 628 |
| 622 | 629 |
| 623 bool Isolate::ShouldReportException(bool* is_caught_externally, | 630 bool Isolate::ShouldReportException(bool* can_be_caught_externally, |
| 624 bool catchable_by_javascript) { | 631 bool catchable_by_javascript) { |
| 625 // Find the top-most try-catch handler. | 632 // Find the top-most try-catch handler. |
| 626 StackHandler* handler = | 633 StackHandler* handler = |
| 627 StackHandler::FromAddress(Isolate::handler(thread_local_top())); | 634 StackHandler::FromAddress(Isolate::handler(thread_local_top())); |
| 628 while (handler != NULL && !handler->is_try_catch()) { | 635 while (handler != NULL && !handler->is_try_catch()) { |
| 629 handler = handler->next(); | 636 handler = handler->next(); |
| 630 } | 637 } |
| 631 | 638 |
| 632 // Get the address of the external handler so we can compare the address to | 639 // Get the address of the external handler so we can compare the address to |
| 633 // determine which one is closer to the top of the stack. | 640 // determine which one is closer to the top of the stack. |
| 634 Address external_handler_address = | 641 Address external_handler_address = |
| 635 thread_local_top()->try_catch_handler_address(); | 642 thread_local_top()->try_catch_handler_address(); |
| 636 | 643 |
| 637 // The exception has been externally caught if and only if there is | 644 // The exception has been externally caught if and only if there is |
| 638 // an external handler which is on top of the top-most try-catch | 645 // an external handler which is on top of the top-most try-catch |
| 639 // handler. | 646 // handler. |
| 640 *is_caught_externally = external_handler_address != NULL && | 647 *can_be_caught_externally = external_handler_address != NULL && |
| 641 (handler == NULL || handler->address() > external_handler_address || | 648 (handler == NULL || handler->address() > external_handler_address || |
| 642 !catchable_by_javascript); | 649 !catchable_by_javascript); |
| 643 | 650 |
| 644 if (*is_caught_externally) { | 651 if (*can_be_caught_externally) { |
| 645 // Only report the exception if the external handler is verbose. | 652 // Only report the exception if the external handler is verbose. |
| 646 return thread_local_top()->TryCatchHandler()->is_verbose_; | 653 return try_catch_handler()->is_verbose_; |
| 647 } else { | 654 } else { |
| 648 // Report the exception if it isn't caught by JavaScript code. | 655 // Report the exception if it isn't caught by JavaScript code. |
| 649 return handler == NULL; | 656 return handler == NULL; |
| 650 } | 657 } |
| 651 } | 658 } |
| 652 | 659 |
| 653 | 660 |
| 654 void Isolate::DoThrow(MaybeObject* exception, | 661 void Isolate::DoThrow(MaybeObject* exception, |
| 655 MessageLocation* location, | 662 MessageLocation* location, |
| 656 const char* message) { | 663 const char* message) { |
| 657 ASSERT(!has_pending_exception()); | 664 ASSERT(!has_pending_exception()); |
| 658 | 665 |
| 659 HandleScope scope; | 666 HandleScope scope; |
| 660 Object* exception_object = Smi::FromInt(0); | 667 Object* exception_object = Smi::FromInt(0); |
| 661 bool is_object = exception->ToObject(&exception_object); | 668 bool is_object = exception->ToObject(&exception_object); |
| 662 Handle<Object> exception_handle(exception_object); | 669 Handle<Object> exception_handle(exception_object); |
| 663 | 670 |
| 664 // Determine reporting and whether the exception is caught externally. | 671 // Determine reporting and whether the exception is caught externally. |
| 665 bool is_out_of_memory = exception == Failure::OutOfMemoryException(); | 672 bool catchable_by_javascript = is_catchable_by_javascript(exception); |
| 666 bool is_termination_exception = exception == heap_.termination_exception(); | |
| 667 bool catchable_by_javascript = !is_termination_exception && !is_out_of_memory; | |
| 668 // Only real objects can be caught by JS. | 673 // Only real objects can be caught by JS. |
| 669 ASSERT(!catchable_by_javascript || is_object); | 674 ASSERT(!catchable_by_javascript || is_object); |
| 670 bool is_caught_externally = false; | 675 bool can_be_caught_externally = false; |
| 671 bool should_report_exception = | 676 bool should_report_exception = |
| 672 ShouldReportException(&is_caught_externally, catchable_by_javascript); | 677 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); |
| 673 bool report_exception = catchable_by_javascript && should_report_exception; | 678 bool report_exception = catchable_by_javascript && should_report_exception; |
| 674 | 679 |
| 675 #ifdef ENABLE_DEBUGGER_SUPPORT | 680 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 676 // Notify debugger of exception. | 681 // Notify debugger of exception. |
| 677 if (catchable_by_javascript) { | 682 if (catchable_by_javascript) { |
| 678 debugger_->OnException(exception_handle, report_exception); | 683 debugger_->OnException(exception_handle, report_exception); |
| 679 } | 684 } |
| 680 #endif | 685 #endif |
| 681 | 686 |
| 682 // Generate the message. | 687 // Generate the message. |
| 683 Handle<Object> message_obj; | 688 Handle<Object> message_obj; |
| 684 MessageLocation potential_computed_location; | 689 MessageLocation potential_computed_location; |
| 685 bool try_catch_needs_message = | 690 bool try_catch_needs_message = |
| 686 is_caught_externally && | 691 can_be_caught_externally && |
| 687 thread_local_top()->TryCatchHandler()->capture_message_; | 692 try_catch_handler()->capture_message_; |
| 688 if (report_exception || try_catch_needs_message) { | 693 if (report_exception || try_catch_needs_message) { |
| 689 if (location == NULL) { | 694 if (location == NULL) { |
| 690 // If no location was specified we use a computed one instead | 695 // If no location was specified we use a computed one instead |
| 691 ComputeLocation(&potential_computed_location); | 696 ComputeLocation(&potential_computed_location); |
| 692 location = &potential_computed_location; | 697 location = &potential_computed_location; |
| 693 } | 698 } |
| 694 if (!bootstrapper()->IsActive()) { | 699 if (!bootstrapper()->IsActive()) { |
| 695 // It's not safe to try to make message objects or collect stack | 700 // It's not safe to try to make message objects or collect stack |
| 696 // traces while the bootstrapper is active since the infrastructure | 701 // traces while the bootstrapper is active since the infrastructure |
| 697 // may not have been properly initialized. | 702 // may not have been properly initialized. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 715 thread_local_top()->pending_message_ = message; | 720 thread_local_top()->pending_message_ = message; |
| 716 if (!message_obj.is_null()) { | 721 if (!message_obj.is_null()) { |
| 717 thread_local_top()->pending_message_obj_ = *message_obj; | 722 thread_local_top()->pending_message_obj_ = *message_obj; |
| 718 if (location != NULL) { | 723 if (location != NULL) { |
| 719 thread_local_top()->pending_message_script_ = *location->script(); | 724 thread_local_top()->pending_message_script_ = *location->script(); |
| 720 thread_local_top()->pending_message_start_pos_ = location->start_pos(); | 725 thread_local_top()->pending_message_start_pos_ = location->start_pos(); |
| 721 thread_local_top()->pending_message_end_pos_ = location->end_pos(); | 726 thread_local_top()->pending_message_end_pos_ = location->end_pos(); |
| 722 } | 727 } |
| 723 } | 728 } |
| 724 | 729 |
| 725 if (is_caught_externally) { | 730 // Do not forget to clean catcher_ if currently thrown exception cannot |
| 726 thread_local_top()->catcher_ = thread_local_top()->TryCatchHandler(); | 731 // be caught. If necessary, ReThrow will update the catcher. |
| 727 } | 732 thread_local_top()->catcher_ = can_be_caught_externally ? |
| 733 try_catch_handler() : NULL; |
| 728 | 734 |
| 729 // NOTE: Notifying the debugger or generating the message | 735 // NOTE: Notifying the debugger or generating the message |
| 730 // may have caused new exceptions. For now, we just ignore | 736 // may have caused new exceptions. For now, we just ignore |
| 731 // that and set the pending exception to the original one. | 737 // that and set the pending exception to the original one. |
| 732 if (is_object) { | 738 if (is_object) { |
| 733 set_pending_exception(*exception_handle); | 739 set_pending_exception(*exception_handle); |
| 734 } else { | 740 } else { |
| 735 // Failures are not on the heap so they neither need nor work with handles. | 741 // Failures are not on the heap so they neither need nor work with handles. |
| 736 ASSERT(exception_handle->IsFailure()); | 742 ASSERT(exception_handle->IsFailure()); |
| 737 set_pending_exception(exception); | 743 set_pending_exception(exception); |
| 738 } | 744 } |
| 739 } | 745 } |
| 740 | 746 |
| 741 | 747 |
| 748 bool Isolate::IsExternallyCaught() { |
| 749 ASSERT(has_pending_exception()); |
| 750 |
| 751 if ((thread_local_top()->catcher_ == NULL) || |
| 752 (try_catch_handler() != thread_local_top()->catcher_)) { |
| 753 // When throwing the exception, we found no v8::TryCatch |
| 754 // which should care about this exception. |
| 755 return false; |
| 756 } |
| 757 |
| 758 if (!is_catchable_by_javascript(pending_exception())) { |
| 759 return true; |
| 760 } |
| 761 |
| 762 // Get the address of the external handler so we can compare the address to |
| 763 // determine which one is closer to the top of the stack. |
| 764 Address external_handler_address = |
| 765 thread_local_top()->try_catch_handler_address(); |
| 766 ASSERT(external_handler_address != NULL); |
| 767 |
| 768 // The exception has been externally caught if and only if there is |
| 769 // an external handler which is on top of the top-most try-finally |
| 770 // handler. |
| 771 // There should be no try-catch blocks as they would prohibit us from |
| 772 // finding external catcher in the first place (see catcher_ check above). |
| 773 // |
| 774 // Note, that finally clause would rethrow an exception unless it's |
| 775 // aborted by jumps in control flow like return, break, etc. and we'll |
| 776 // have another chances to set proper v8::TryCatch. |
| 777 StackHandler* handler = |
| 778 StackHandler::FromAddress(Isolate::handler(thread_local_top())); |
| 779 while (handler != NULL && handler->address() < external_handler_address) { |
| 780 ASSERT(!handler->is_try_catch()); |
| 781 if (handler->is_try_finally()) return false; |
| 782 |
| 783 handler = handler->next(); |
| 784 } |
| 785 |
| 786 return true; |
| 787 } |
| 788 |
| 789 |
| 742 void Isolate::ReportPendingMessages() { | 790 void Isolate::ReportPendingMessages() { |
| 743 ASSERT(has_pending_exception()); | 791 ASSERT(has_pending_exception()); |
| 744 setup_external_caught(); | |
| 745 // If the pending exception is OutOfMemoryException set out_of_memory in | 792 // If the pending exception is OutOfMemoryException set out_of_memory in |
| 746 // the global context. Note: We have to mark the global context here | 793 // the global context. Note: We have to mark the global context here |
| 747 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to | 794 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to |
| 748 // set it. | 795 // set it. |
| 749 bool external_caught = thread_local_top()->external_caught_exception_; | 796 bool external_caught = IsExternallyCaught(); |
| 750 HandleScope scope; | 797 thread_local_top()->external_caught_exception_ = external_caught; |
| 798 HandleScope scope(this); |
| 751 if (thread_local_top()->pending_exception_ == | 799 if (thread_local_top()->pending_exception_ == |
| 752 Failure::OutOfMemoryException()) { | 800 Failure::OutOfMemoryException()) { |
| 753 context()->mark_out_of_memory(); | 801 context()->mark_out_of_memory(); |
| 754 } else if (thread_local_top()->pending_exception_ == | 802 } else if (thread_local_top()->pending_exception_ == |
| 755 heap_.termination_exception()) { | 803 heap_.termination_exception()) { |
| 756 if (external_caught) { | 804 if (external_caught) { |
| 757 thread_local_top()->TryCatchHandler()->can_continue_ = false; | 805 try_catch_handler()->can_continue_ = false; |
| 758 thread_local_top()->TryCatchHandler()->exception_ = heap_.null_value(); | 806 try_catch_handler()->exception_ = heap_.null_value(); |
| 759 } | 807 } |
| 760 } else { | 808 } else { |
| 761 // At this point all non-object (failure) exceptions have | 809 // At this point all non-object (failure) exceptions have |
| 762 // been dealt with so this shouldn't fail. | 810 // been dealt with so this shouldn't fail. |
| 763 Object* pending_exception_object = pending_exception()->ToObjectUnchecked(); | 811 Object* pending_exception_object = pending_exception()->ToObjectUnchecked(); |
| 764 Handle<Object> exception(pending_exception_object); | 812 Handle<Object> exception(pending_exception_object); |
| 765 thread_local_top()->external_caught_exception_ = false; | 813 thread_local_top()->external_caught_exception_ = false; |
| 766 if (external_caught) { | 814 if (external_caught) { |
| 767 thread_local_top()->TryCatchHandler()->can_continue_ = true; | 815 try_catch_handler()->can_continue_ = true; |
| 768 thread_local_top()->TryCatchHandler()->exception_ = | 816 try_catch_handler()->exception_ = thread_local_top()->pending_exception_; |
| 769 thread_local_top()->pending_exception_; | |
| 770 if (!thread_local_top()->pending_message_obj_->IsTheHole()) { | 817 if (!thread_local_top()->pending_message_obj_->IsTheHole()) { |
| 771 try_catch_handler()->message_ = | 818 try_catch_handler()->message_ = |
| 772 thread_local_top()->pending_message_obj_; | 819 thread_local_top()->pending_message_obj_; |
| 773 } | 820 } |
| 774 } | 821 } |
| 775 if (thread_local_top()->has_pending_message_) { | 822 if (thread_local_top()->has_pending_message_) { |
| 776 thread_local_top()->has_pending_message_ = false; | 823 thread_local_top()->has_pending_message_ = false; |
| 777 if (thread_local_top()->pending_message_ != NULL) { | 824 if (thread_local_top()->pending_message_ != NULL) { |
| 778 MessageHandler::ReportMessage(thread_local_top()->pending_message_); | 825 MessageHandler::ReportMessage(thread_local_top()->pending_message_); |
| 779 } else if (!thread_local_top()->pending_message_obj_->IsTheHole()) { | 826 } else if (!thread_local_top()->pending_message_obj_->IsTheHole()) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 thread_local_top()->simulator_ = Simulator::current(this); | 969 thread_local_top()->simulator_ = Simulator::current(this); |
| 923 #endif | 970 #endif |
| 924 #endif | 971 #endif |
| 925 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { | 972 if (RuntimeProfiler::IsEnabled() && current_vm_state() == JS) { |
| 926 RuntimeProfiler::IsolateEnteredJS(this); | 973 RuntimeProfiler::IsolateEnteredJS(this); |
| 927 } | 974 } |
| 928 return from + sizeof(ThreadLocalTop); | 975 return from + sizeof(ThreadLocalTop); |
| 929 } | 976 } |
| 930 | 977 |
| 931 } } // namespace v8::internal | 978 } } // namespace v8::internal |
| OLD | NEW |