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 5777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5788 #endif | 5788 #endif |
5789 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); | 5789 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); |
5790 __ pop(pc); | 5790 __ pop(pc); |
5791 } | 5791 } |
5792 | 5792 |
5793 | 5793 |
5794 void CEntryStub::GenerateCore(MacroAssembler* masm, | 5794 void CEntryStub::GenerateCore(MacroAssembler* masm, |
5795 Label* throw_normal_exception, | 5795 Label* throw_normal_exception, |
5796 Label* throw_termination_exception, | 5796 Label* throw_termination_exception, |
5797 Label* throw_out_of_memory_exception, | 5797 Label* throw_out_of_memory_exception, |
5798 StackFrame::Type frame_type, | 5798 ExitFrame::Mode mode, |
5799 bool do_gc, | 5799 bool do_gc, |
5800 bool always_allocate) { | 5800 bool always_allocate) { |
5801 // r0: result parameter for PerformGC, if any | 5801 // r0: result parameter for PerformGC, if any |
5802 // r4: number of arguments including receiver (C callee-saved) | 5802 // r4: number of arguments including receiver (C callee-saved) |
5803 // r5: pointer to builtin function (C callee-saved) | 5803 // r5: pointer to builtin function (C callee-saved) |
5804 // r6: pointer to the first argument (C callee-saved) | 5804 // r6: pointer to the first argument (C callee-saved) |
5805 | 5805 |
5806 if (do_gc) { | 5806 if (do_gc) { |
5807 // Passing r0. | 5807 // Passing r0. |
5808 ExternalReference gc_reference = ExternalReference::perform_gc_function(); | 5808 ExternalReference gc_reference = ExternalReference::perform_gc_function(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5848 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 5848 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
5849 // Lower 2 bits of r2 are 0 iff r0 has failure tag. | 5849 // Lower 2 bits of r2 are 0 iff r0 has failure tag. |
5850 __ add(r2, r0, Operand(1)); | 5850 __ add(r2, r0, Operand(1)); |
5851 __ tst(r2, Operand(kFailureTagMask)); | 5851 __ tst(r2, Operand(kFailureTagMask)); |
5852 __ b(eq, &failure_returned); | 5852 __ b(eq, &failure_returned); |
5853 | 5853 |
5854 // Exit C frame and return. | 5854 // Exit C frame and return. |
5855 // r0:r1: result | 5855 // r0:r1: result |
5856 // sp: stack pointer | 5856 // sp: stack pointer |
5857 // fp: frame pointer | 5857 // fp: frame pointer |
5858 __ LeaveExitFrame(frame_type); | 5858 __ LeaveExitFrame(mode); |
5859 | 5859 |
5860 // check if we should retry or throw exception | 5860 // check if we should retry or throw exception |
5861 Label retry; | 5861 Label retry; |
5862 __ bind(&failure_returned); | 5862 __ bind(&failure_returned); |
5863 ASSERT(Failure::RETRY_AFTER_GC == 0); | 5863 ASSERT(Failure::RETRY_AFTER_GC == 0); |
5864 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 5864 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
5865 __ b(eq, &retry); | 5865 __ b(eq, &retry); |
5866 | 5866 |
5867 // Special handling of out of memory exceptions. | 5867 // Special handling of out of memory exceptions. |
5868 Failure* out_of_memory = Failure::OutOfMemoryException(); | 5868 Failure* out_of_memory = Failure::OutOfMemoryException(); |
(...skipping 25 matching lines...) Expand all Loading... |
5894 // r1: pointer to builtin function | 5894 // r1: pointer to builtin function |
5895 // fp: frame pointer (restored after C call) | 5895 // fp: frame pointer (restored after C call) |
5896 // sp: stack pointer (restored as callee's sp after C call) | 5896 // sp: stack pointer (restored as callee's sp after C call) |
5897 // cp: current context (C callee-saved) | 5897 // cp: current context (C callee-saved) |
5898 | 5898 |
5899 // NOTE: Invocations of builtins may return failure objects | 5899 // NOTE: Invocations of builtins may return failure objects |
5900 // instead of a proper result. The builtin entry handles | 5900 // instead of a proper result. The builtin entry handles |
5901 // this by performing a garbage collection and retrying the | 5901 // this by performing a garbage collection and retrying the |
5902 // builtin once. | 5902 // builtin once. |
5903 | 5903 |
5904 StackFrame::Type frame_type = is_debug_break | 5904 ExitFrame::Mode mode = is_debug_break |
5905 ? StackFrame::EXIT_DEBUG | 5905 ? ExitFrame::MODE_DEBUG |
5906 : StackFrame::EXIT; | 5906 : ExitFrame::MODE_NORMAL; |
5907 | 5907 |
5908 // Enter the exit frame that transitions from JavaScript to C++. | 5908 // Enter the exit frame that transitions from JavaScript to C++. |
5909 __ EnterExitFrame(frame_type); | 5909 __ EnterExitFrame(mode); |
5910 | 5910 |
5911 // r4: number of arguments (C callee-saved) | 5911 // r4: number of arguments (C callee-saved) |
5912 // r5: pointer to builtin function (C callee-saved) | 5912 // r5: pointer to builtin function (C callee-saved) |
5913 // r6: pointer to first argument (C callee-saved) | 5913 // r6: pointer to first argument (C callee-saved) |
5914 | 5914 |
5915 Label throw_normal_exception; | 5915 Label throw_normal_exception; |
5916 Label throw_termination_exception; | 5916 Label throw_termination_exception; |
5917 Label throw_out_of_memory_exception; | 5917 Label throw_out_of_memory_exception; |
5918 | 5918 |
5919 // Call into the runtime system. | 5919 // Call into the runtime system. |
5920 GenerateCore(masm, | 5920 GenerateCore(masm, |
5921 &throw_normal_exception, | 5921 &throw_normal_exception, |
5922 &throw_termination_exception, | 5922 &throw_termination_exception, |
5923 &throw_out_of_memory_exception, | 5923 &throw_out_of_memory_exception, |
5924 frame_type, | 5924 mode, |
5925 false, | 5925 false, |
5926 false); | 5926 false); |
5927 | 5927 |
5928 // Do space-specific GC and retry runtime call. | 5928 // Do space-specific GC and retry runtime call. |
5929 GenerateCore(masm, | 5929 GenerateCore(masm, |
5930 &throw_normal_exception, | 5930 &throw_normal_exception, |
5931 &throw_termination_exception, | 5931 &throw_termination_exception, |
5932 &throw_out_of_memory_exception, | 5932 &throw_out_of_memory_exception, |
5933 frame_type, | 5933 mode, |
5934 true, | 5934 true, |
5935 false); | 5935 false); |
5936 | 5936 |
5937 // Do full GC and retry runtime call one final time. | 5937 // Do full GC and retry runtime call one final time. |
5938 Failure* failure = Failure::InternalError(); | 5938 Failure* failure = Failure::InternalError(); |
5939 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); | 5939 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); |
5940 GenerateCore(masm, | 5940 GenerateCore(masm, |
5941 &throw_normal_exception, | 5941 &throw_normal_exception, |
5942 &throw_termination_exception, | 5942 &throw_termination_exception, |
5943 &throw_out_of_memory_exception, | 5943 &throw_out_of_memory_exception, |
5944 frame_type, | 5944 mode, |
5945 true, | 5945 true, |
5946 true); | 5946 true); |
5947 | 5947 |
5948 __ bind(&throw_out_of_memory_exception); | 5948 __ bind(&throw_out_of_memory_exception); |
5949 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 5949 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); |
5950 | 5950 |
5951 __ bind(&throw_termination_exception); | 5951 __ bind(&throw_termination_exception); |
5952 GenerateThrowUncatchable(masm, TERMINATION); | 5952 GenerateThrowUncatchable(masm, TERMINATION); |
5953 | 5953 |
5954 __ bind(&throw_normal_exception); | 5954 __ bind(&throw_normal_exception); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6261 int CompareStub::MinorKey() { | 6261 int CompareStub::MinorKey() { |
6262 // Encode the two parameters in a unique 16 bit value. | 6262 // Encode the two parameters in a unique 16 bit value. |
6263 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 6263 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
6264 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 6264 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
6265 } | 6265 } |
6266 | 6266 |
6267 | 6267 |
6268 #undef __ | 6268 #undef __ |
6269 | 6269 |
6270 } } // namespace v8::internal | 6270 } } // namespace v8::internal |
OLD | NEW |