OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5767 #endif | 5767 #endif |
5768 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); | 5768 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); |
5769 __ pop(pc); | 5769 __ pop(pc); |
5770 } | 5770 } |
5771 | 5771 |
5772 | 5772 |
5773 void CEntryStub::GenerateCore(MacroAssembler* masm, | 5773 void CEntryStub::GenerateCore(MacroAssembler* masm, |
5774 Label* throw_normal_exception, | 5774 Label* throw_normal_exception, |
5775 Label* throw_termination_exception, | 5775 Label* throw_termination_exception, |
5776 Label* throw_out_of_memory_exception, | 5776 Label* throw_out_of_memory_exception, |
5777 StackFrame::Type frame_type, | 5777 ExitFrame::Mode mode, |
5778 bool do_gc, | 5778 bool do_gc, |
5779 bool always_allocate) { | 5779 bool always_allocate) { |
5780 // r0: result parameter for PerformGC, if any | 5780 // r0: result parameter for PerformGC, if any |
5781 // r4: number of arguments including receiver (C callee-saved) | 5781 // r4: number of arguments including receiver (C callee-saved) |
5782 // r5: pointer to builtin function (C callee-saved) | 5782 // r5: pointer to builtin function (C callee-saved) |
5783 // r6: pointer to the first argument (C callee-saved) | 5783 // r6: pointer to the first argument (C callee-saved) |
5784 | 5784 |
5785 if (do_gc) { | 5785 if (do_gc) { |
5786 // Passing r0. | 5786 // Passing r0. |
5787 ExternalReference gc_reference = ExternalReference::perform_gc_function(); | 5787 ExternalReference gc_reference = ExternalReference::perform_gc_function(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5827 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 5827 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
5828 // Lower 2 bits of r2 are 0 iff r0 has failure tag. | 5828 // Lower 2 bits of r2 are 0 iff r0 has failure tag. |
5829 __ add(r2, r0, Operand(1)); | 5829 __ add(r2, r0, Operand(1)); |
5830 __ tst(r2, Operand(kFailureTagMask)); | 5830 __ tst(r2, Operand(kFailureTagMask)); |
5831 __ b(eq, &failure_returned); | 5831 __ b(eq, &failure_returned); |
5832 | 5832 |
5833 // Exit C frame and return. | 5833 // Exit C frame and return. |
5834 // r0:r1: result | 5834 // r0:r1: result |
5835 // sp: stack pointer | 5835 // sp: stack pointer |
5836 // fp: frame pointer | 5836 // fp: frame pointer |
5837 __ LeaveExitFrame(frame_type); | 5837 __ LeaveExitFrame(mode); |
5838 | 5838 |
5839 // check if we should retry or throw exception | 5839 // check if we should retry or throw exception |
5840 Label retry; | 5840 Label retry; |
5841 __ bind(&failure_returned); | 5841 __ bind(&failure_returned); |
5842 ASSERT(Failure::RETRY_AFTER_GC == 0); | 5842 ASSERT(Failure::RETRY_AFTER_GC == 0); |
5843 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 5843 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
5844 __ b(eq, &retry); | 5844 __ b(eq, &retry); |
5845 | 5845 |
5846 // Special handling of out of memory exceptions. | 5846 // Special handling of out of memory exceptions. |
5847 Failure* out_of_memory = Failure::OutOfMemoryException(); | 5847 Failure* out_of_memory = Failure::OutOfMemoryException(); |
(...skipping 25 matching lines...) Expand all Loading... |
5873 // r1: pointer to builtin function | 5873 // r1: pointer to builtin function |
5874 // fp: frame pointer (restored after C call) | 5874 // fp: frame pointer (restored after C call) |
5875 // sp: stack pointer (restored as callee's sp after C call) | 5875 // sp: stack pointer (restored as callee's sp after C call) |
5876 // cp: current context (C callee-saved) | 5876 // cp: current context (C callee-saved) |
5877 | 5877 |
5878 // NOTE: Invocations of builtins may return failure objects | 5878 // NOTE: Invocations of builtins may return failure objects |
5879 // instead of a proper result. The builtin entry handles | 5879 // instead of a proper result. The builtin entry handles |
5880 // this by performing a garbage collection and retrying the | 5880 // this by performing a garbage collection and retrying the |
5881 // builtin once. | 5881 // builtin once. |
5882 | 5882 |
5883 StackFrame::Type frame_type = is_debug_break | 5883 ExitFrame::Mode mode = is_debug_break |
5884 ? StackFrame::EXIT_DEBUG | 5884 ? ExitFrame::MODE_DEBUG |
5885 : StackFrame::EXIT; | 5885 : ExitFrame::MODE_NORMAL; |
5886 | 5886 |
5887 // Enter the exit frame that transitions from JavaScript to C++. | 5887 // Enter the exit frame that transitions from JavaScript to C++. |
5888 __ EnterExitFrame(frame_type); | 5888 __ EnterExitFrame(mode); |
5889 | 5889 |
5890 // r4: number of arguments (C callee-saved) | 5890 // r4: number of arguments (C callee-saved) |
5891 // r5: pointer to builtin function (C callee-saved) | 5891 // r5: pointer to builtin function (C callee-saved) |
5892 // r6: pointer to first argument (C callee-saved) | 5892 // r6: pointer to first argument (C callee-saved) |
5893 | 5893 |
5894 Label throw_normal_exception; | 5894 Label throw_normal_exception; |
5895 Label throw_termination_exception; | 5895 Label throw_termination_exception; |
5896 Label throw_out_of_memory_exception; | 5896 Label throw_out_of_memory_exception; |
5897 | 5897 |
5898 // Call into the runtime system. | 5898 // Call into the runtime system. |
5899 GenerateCore(masm, | 5899 GenerateCore(masm, |
5900 &throw_normal_exception, | 5900 &throw_normal_exception, |
5901 &throw_termination_exception, | 5901 &throw_termination_exception, |
5902 &throw_out_of_memory_exception, | 5902 &throw_out_of_memory_exception, |
5903 frame_type, | 5903 mode, |
5904 false, | 5904 false, |
5905 false); | 5905 false); |
5906 | 5906 |
5907 // Do space-specific GC and retry runtime call. | 5907 // Do space-specific GC and retry runtime call. |
5908 GenerateCore(masm, | 5908 GenerateCore(masm, |
5909 &throw_normal_exception, | 5909 &throw_normal_exception, |
5910 &throw_termination_exception, | 5910 &throw_termination_exception, |
5911 &throw_out_of_memory_exception, | 5911 &throw_out_of_memory_exception, |
5912 frame_type, | 5912 mode, |
5913 true, | 5913 true, |
5914 false); | 5914 false); |
5915 | 5915 |
5916 // Do full GC and retry runtime call one final time. | 5916 // Do full GC and retry runtime call one final time. |
5917 Failure* failure = Failure::InternalError(); | 5917 Failure* failure = Failure::InternalError(); |
5918 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); | 5918 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); |
5919 GenerateCore(masm, | 5919 GenerateCore(masm, |
5920 &throw_normal_exception, | 5920 &throw_normal_exception, |
5921 &throw_termination_exception, | 5921 &throw_termination_exception, |
5922 &throw_out_of_memory_exception, | 5922 &throw_out_of_memory_exception, |
5923 frame_type, | 5923 mode, |
5924 true, | 5924 true, |
5925 true); | 5925 true); |
5926 | 5926 |
5927 __ bind(&throw_out_of_memory_exception); | 5927 __ bind(&throw_out_of_memory_exception); |
5928 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 5928 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); |
5929 | 5929 |
5930 __ bind(&throw_termination_exception); | 5930 __ bind(&throw_termination_exception); |
5931 GenerateThrowUncatchable(masm, TERMINATION); | 5931 GenerateThrowUncatchable(masm, TERMINATION); |
5932 | 5932 |
5933 __ bind(&throw_normal_exception); | 5933 __ bind(&throw_normal_exception); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6240 int CompareStub::MinorKey() { | 6240 int CompareStub::MinorKey() { |
6241 // Encode the two parameters in a unique 16 bit value. | 6241 // Encode the two parameters in a unique 16 bit value. |
6242 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 6242 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
6243 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 6243 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
6244 } | 6244 } |
6245 | 6245 |
6246 | 6246 |
6247 #undef __ | 6247 #undef __ |
6248 | 6248 |
6249 } } // namespace v8::internal | 6249 } } // namespace v8::internal |
OLD | NEW |