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