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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 201573007: Revert "Remove Failure::OutOfMemory propagation and V8::IgnoreOutOfMemoryException." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/heap-inl.h ('k') | src/isolate.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 } 2576 }
2577 } 2577 }
2578 2578
2579 2579
2580 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { 2580 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
2581 CEntryStub stub(1, kDontSaveFPRegs); 2581 CEntryStub stub(1, kDontSaveFPRegs);
2582 stub.GetCode(isolate); 2582 stub.GetCode(isolate);
2583 } 2583 }
2584 2584
2585 2585
2586 static void JumpIfOOM(MacroAssembler* masm,
2587 Register value,
2588 Register scratch,
2589 Label* oom_label) {
2590 __ mov(scratch, value);
2591 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3);
2592 STATIC_ASSERT(kFailureTag == 3);
2593 __ and_(scratch, 0xf);
2594 __ cmp(scratch, 0xf);
2595 __ j(equal, oom_label);
2596 }
2597
2598
2586 void CEntryStub::GenerateCore(MacroAssembler* masm, 2599 void CEntryStub::GenerateCore(MacroAssembler* masm,
2587 Label* throw_normal_exception, 2600 Label* throw_normal_exception,
2588 Label* throw_termination_exception, 2601 Label* throw_termination_exception,
2602 Label* throw_out_of_memory_exception,
2589 bool do_gc, 2603 bool do_gc,
2590 bool always_allocate_scope) { 2604 bool always_allocate_scope) {
2591 // eax: result parameter for PerformGC, if any 2605 // eax: result parameter for PerformGC, if any
2592 // ebx: pointer to C function (C callee-saved) 2606 // ebx: pointer to C function (C callee-saved)
2593 // ebp: frame pointer (restored after C call) 2607 // ebp: frame pointer (restored after C call)
2594 // esp: stack pointer (restored after C call) 2608 // esp: stack pointer (restored after C call)
2595 // edi: number of arguments including receiver (C callee-saved) 2609 // edi: number of arguments including receiver (C callee-saved)
2596 // esi: pointer to the first argument (C callee-saved) 2610 // esi: pointer to the first argument (C callee-saved)
2597 2611
2598 // Result returned in eax, or eax+edx if result_size_ is 2. 2612 // Result returned in eax, or eax+edx if result_size_ is 2.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 2687
2674 // Handling of failure. 2688 // Handling of failure.
2675 __ bind(&failure_returned); 2689 __ bind(&failure_returned);
2676 2690
2677 Label retry; 2691 Label retry;
2678 // If the returned exception is RETRY_AFTER_GC continue at retry label 2692 // If the returned exception is RETRY_AFTER_GC continue at retry label
2679 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); 2693 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0);
2680 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 2694 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
2681 __ j(zero, &retry, Label::kNear); 2695 __ j(zero, &retry, Label::kNear);
2682 2696
2697 // Special handling of out of memory exceptions.
2698 JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
2699
2683 // Retrieve the pending exception. 2700 // Retrieve the pending exception.
2684 __ mov(eax, Operand::StaticVariable(pending_exception_address)); 2701 __ mov(eax, Operand::StaticVariable(pending_exception_address));
2685 2702
2703 // See if we just retrieved an OOM exception.
2704 JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
2705
2686 // Clear the pending exception. 2706 // Clear the pending exception.
2687 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); 2707 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value()));
2688 __ mov(Operand::StaticVariable(pending_exception_address), edx); 2708 __ mov(Operand::StaticVariable(pending_exception_address), edx);
2689 2709
2690 // Special handling of termination exceptions which are uncatchable 2710 // Special handling of termination exceptions which are uncatchable
2691 // by javascript code. 2711 // by javascript code.
2692 __ cmp(eax, masm->isolate()->factory()->termination_exception()); 2712 __ cmp(eax, masm->isolate()->factory()->termination_exception());
2693 __ j(equal, throw_termination_exception); 2713 __ j(equal, throw_termination_exception);
2694 2714
2695 // Handle normal exception. 2715 // Handle normal exception.
(...skipping 23 matching lines...) Expand all
2719 2739
2720 // eax: result parameter for PerformGC, if any (setup below) 2740 // eax: result parameter for PerformGC, if any (setup below)
2721 // ebx: pointer to builtin function (C callee-saved) 2741 // ebx: pointer to builtin function (C callee-saved)
2722 // ebp: frame pointer (restored after C call) 2742 // ebp: frame pointer (restored after C call)
2723 // esp: stack pointer (restored after C call) 2743 // esp: stack pointer (restored after C call)
2724 // edi: number of arguments including receiver (C callee-saved) 2744 // edi: number of arguments including receiver (C callee-saved)
2725 // esi: argv pointer (C callee-saved) 2745 // esi: argv pointer (C callee-saved)
2726 2746
2727 Label throw_normal_exception; 2747 Label throw_normal_exception;
2728 Label throw_termination_exception; 2748 Label throw_termination_exception;
2749 Label throw_out_of_memory_exception;
2729 2750
2730 // Call into the runtime system. 2751 // Call into the runtime system.
2731 GenerateCore(masm, 2752 GenerateCore(masm,
2732 &throw_normal_exception, 2753 &throw_normal_exception,
2733 &throw_termination_exception, 2754 &throw_termination_exception,
2755 &throw_out_of_memory_exception,
2734 false, 2756 false,
2735 false); 2757 false);
2736 2758
2737 // Do space-specific GC and retry runtime call. 2759 // Do space-specific GC and retry runtime call.
2738 GenerateCore(masm, 2760 GenerateCore(masm,
2739 &throw_normal_exception, 2761 &throw_normal_exception,
2740 &throw_termination_exception, 2762 &throw_termination_exception,
2763 &throw_out_of_memory_exception,
2741 true, 2764 true,
2742 false); 2765 false);
2743 2766
2744 // Do full GC and retry runtime call one final time. 2767 // Do full GC and retry runtime call one final time.
2745 Failure* failure = Failure::InternalError(); 2768 Failure* failure = Failure::InternalError();
2746 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); 2769 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure)));
2747 GenerateCore(masm, 2770 GenerateCore(masm,
2748 &throw_normal_exception, 2771 &throw_normal_exception,
2749 &throw_termination_exception, 2772 &throw_termination_exception,
2773 &throw_out_of_memory_exception,
2750 true, 2774 true,
2751 true); 2775 true);
2752 2776
2777 __ bind(&throw_out_of_memory_exception);
2778 // Set external caught exception to false.
2779 Isolate* isolate = masm->isolate();
2780 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
2781 isolate);
2782 __ mov(Operand::StaticVariable(external_caught), Immediate(false));
2783
2784 // Set pending exception and eax to out of memory exception.
2785 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
2786 isolate);
2787 Label already_have_failure;
2788 JumpIfOOM(masm, eax, ecx, &already_have_failure);
2789 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException(0x1)));
2790 __ bind(&already_have_failure);
2791 __ mov(Operand::StaticVariable(pending_exception), eax);
2792 // Fall through to the next label.
2793
2753 __ bind(&throw_termination_exception); 2794 __ bind(&throw_termination_exception);
2754 __ ThrowUncatchable(eax); 2795 __ ThrowUncatchable(eax);
2755 2796
2756 __ bind(&throw_normal_exception); 2797 __ bind(&throw_normal_exception);
2757 __ Throw(eax); 2798 __ Throw(eax);
2758 } 2799 }
2759 2800
2760 2801
2761 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 2802 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
2762 Label invoke, handler_entry, exit; 2803 Label invoke, handler_entry, exit;
(...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after
5355 Operand(ebp, 7 * kPointerSize), 5396 Operand(ebp, 7 * kPointerSize),
5356 NULL); 5397 NULL);
5357 } 5398 }
5358 5399
5359 5400
5360 #undef __ 5401 #undef __
5361 5402
5362 } } // namespace v8::internal 5403 } } // namespace v8::internal
5363 5404
5364 #endif // V8_TARGET_ARCH_IA32 5405 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698