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

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

Issue 208263002: 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
2599 void CEntryStub::GenerateCore(MacroAssembler* masm, 2586 void CEntryStub::GenerateCore(MacroAssembler* masm,
2600 Label* throw_normal_exception, 2587 Label* throw_normal_exception,
2601 Label* throw_termination_exception, 2588 Label* throw_termination_exception,
2602 Label* throw_out_of_memory_exception,
2603 bool do_gc, 2589 bool do_gc,
2604 bool always_allocate_scope) { 2590 bool always_allocate_scope) {
2605 // eax: result parameter for PerformGC, if any 2591 // eax: result parameter for PerformGC, if any
2606 // ebx: pointer to C function (C callee-saved) 2592 // ebx: pointer to C function (C callee-saved)
2607 // ebp: frame pointer (restored after C call) 2593 // ebp: frame pointer (restored after C call)
2608 // esp: stack pointer (restored after C call) 2594 // esp: stack pointer (restored after C call)
2609 // edi: number of arguments including receiver (C callee-saved) 2595 // edi: number of arguments including receiver (C callee-saved)
2610 // esi: pointer to the first argument (C callee-saved) 2596 // esi: pointer to the first argument (C callee-saved)
2611 2597
2612 // Result returned in eax, or eax+edx if result_size_ is 2. 2598 // Result returned in eax, or eax+edx if result_size_ is 2.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 2673
2688 // Handling of failure. 2674 // Handling of failure.
2689 __ bind(&failure_returned); 2675 __ bind(&failure_returned);
2690 2676
2691 Label retry; 2677 Label retry;
2692 // If the returned exception is RETRY_AFTER_GC continue at retry label 2678 // If the returned exception is RETRY_AFTER_GC continue at retry label
2693 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); 2679 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0);
2694 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 2680 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
2695 __ j(zero, &retry, Label::kNear); 2681 __ j(zero, &retry, Label::kNear);
2696 2682
2697 // Special handling of out of memory exceptions.
2698 JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
2699
2700 // Retrieve the pending exception. 2683 // Retrieve the pending exception.
2701 __ mov(eax, Operand::StaticVariable(pending_exception_address)); 2684 __ mov(eax, Operand::StaticVariable(pending_exception_address));
2702 2685
2703 // See if we just retrieved an OOM exception.
2704 JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
2705
2706 // Clear the pending exception. 2686 // Clear the pending exception.
2707 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); 2687 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value()));
2708 __ mov(Operand::StaticVariable(pending_exception_address), edx); 2688 __ mov(Operand::StaticVariable(pending_exception_address), edx);
2709 2689
2710 // Special handling of termination exceptions which are uncatchable 2690 // Special handling of termination exceptions which are uncatchable
2711 // by javascript code. 2691 // by javascript code.
2712 __ cmp(eax, masm->isolate()->factory()->termination_exception()); 2692 __ cmp(eax, masm->isolate()->factory()->termination_exception());
2713 __ j(equal, throw_termination_exception); 2693 __ j(equal, throw_termination_exception);
2714 2694
2715 // Handle normal exception. 2695 // Handle normal exception.
(...skipping 23 matching lines...) Expand all
2739 2719
2740 // eax: result parameter for PerformGC, if any (setup below) 2720 // eax: result parameter for PerformGC, if any (setup below)
2741 // ebx: pointer to builtin function (C callee-saved) 2721 // ebx: pointer to builtin function (C callee-saved)
2742 // ebp: frame pointer (restored after C call) 2722 // ebp: frame pointer (restored after C call)
2743 // esp: stack pointer (restored after C call) 2723 // esp: stack pointer (restored after C call)
2744 // edi: number of arguments including receiver (C callee-saved) 2724 // edi: number of arguments including receiver (C callee-saved)
2745 // esi: argv pointer (C callee-saved) 2725 // esi: argv pointer (C callee-saved)
2746 2726
2747 Label throw_normal_exception; 2727 Label throw_normal_exception;
2748 Label throw_termination_exception; 2728 Label throw_termination_exception;
2749 Label throw_out_of_memory_exception;
2750 2729
2751 // Call into the runtime system. 2730 // Call into the runtime system.
2752 GenerateCore(masm, 2731 GenerateCore(masm,
2753 &throw_normal_exception, 2732 &throw_normal_exception,
2754 &throw_termination_exception, 2733 &throw_termination_exception,
2755 &throw_out_of_memory_exception,
2756 false, 2734 false,
2757 false); 2735 false);
2758 2736
2759 // Do space-specific GC and retry runtime call. 2737 // Do space-specific GC and retry runtime call.
2760 GenerateCore(masm, 2738 GenerateCore(masm,
2761 &throw_normal_exception, 2739 &throw_normal_exception,
2762 &throw_termination_exception, 2740 &throw_termination_exception,
2763 &throw_out_of_memory_exception,
2764 true, 2741 true,
2765 false); 2742 false);
2766 2743
2767 // Do full GC and retry runtime call one final time. 2744 // Do full GC and retry runtime call one final time.
2768 Failure* failure = Failure::InternalError(); 2745 Failure* failure = Failure::InternalError();
2769 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); 2746 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure)));
2770 GenerateCore(masm, 2747 GenerateCore(masm,
2771 &throw_normal_exception, 2748 &throw_normal_exception,
2772 &throw_termination_exception, 2749 &throw_termination_exception,
2773 &throw_out_of_memory_exception,
2774 true, 2750 true,
2775 true); 2751 true);
2776 2752
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
2794 __ bind(&throw_termination_exception); 2753 __ bind(&throw_termination_exception);
2795 __ ThrowUncatchable(eax); 2754 __ ThrowUncatchable(eax);
2796 2755
2797 __ bind(&throw_normal_exception); 2756 __ bind(&throw_normal_exception);
2798 __ Throw(eax); 2757 __ Throw(eax);
2799 } 2758 }
2800 2759
2801 2760
2802 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 2761 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
2803 Label invoke, handler_entry, exit; 2762 Label invoke, handler_entry, exit;
(...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after
5396 Operand(ebp, 7 * kPointerSize), 5355 Operand(ebp, 7 * kPointerSize),
5397 NULL); 5356 NULL);
5398 } 5357 }
5399 5358
5400 5359
5401 #undef __ 5360 #undef __
5402 5361
5403 } } // namespace v8::internal 5362 } } // namespace v8::internal
5404 5363
5405 #endif // V8_TARGET_ARCH_IA32 5364 #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