OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 case Yield::kSuspend: | 1929 case Yield::kSuspend: |
1930 // Pop value from top-of-stack slot; box result into result register. | 1930 // Pop value from top-of-stack slot; box result into result register. |
1931 EmitCreateIteratorResult(false); | 1931 EmitCreateIteratorResult(false); |
1932 __ push(result_register()); | 1932 __ push(result_register()); |
1933 // Fall through. | 1933 // Fall through. |
1934 case Yield::kInitial: { | 1934 case Yield::kInitial: { |
1935 Label suspend, continuation, post_runtime, resume; | 1935 Label suspend, continuation, post_runtime, resume; |
1936 | 1936 |
1937 __ jmp(&suspend); | 1937 __ jmp(&suspend); |
1938 __ bind(&continuation); | 1938 __ bind(&continuation); |
| 1939 // When we arrive here, the stack top is the resume mode and |
| 1940 // result_register() holds the input value (the argument given to the |
| 1941 // respective resume operation). |
1939 __ RecordGeneratorContinuation(); | 1942 __ RecordGeneratorContinuation(); |
1940 __ jmp(&resume); | 1943 __ pop(a1); |
| 1944 __ Branch(&resume, ne, a1, |
| 1945 Operand(Smi::FromInt(JSGeneratorObject::RETURN))); |
| 1946 __ push(result_register()); |
| 1947 EmitCreateIteratorResult(true); |
| 1948 EmitUnwindBeforeReturn(); |
| 1949 EmitReturnSequence(); |
1941 | 1950 |
1942 __ bind(&suspend); | 1951 __ bind(&suspend); |
1943 VisitForAccumulatorValue(expr->generator_object()); | 1952 VisitForAccumulatorValue(expr->generator_object()); |
1944 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 1953 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
1945 __ li(a1, Operand(Smi::FromInt(continuation.pos()))); | 1954 __ li(a1, Operand(Smi::FromInt(continuation.pos()))); |
1946 __ sd(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset)); | 1955 __ sd(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset)); |
1947 __ sd(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset)); | 1956 __ sd(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset)); |
1948 __ mov(a1, cp); | 1957 __ mov(a1, cp); |
1949 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2, | 1958 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2, |
1950 kRAHasBeenSaved, kDontSaveFPRegs); | 1959 kRAHasBeenSaved, kDontSaveFPRegs); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 // in directly. | 2156 // in directly. |
2148 if (resume_mode == JSGeneratorObject::NEXT) { | 2157 if (resume_mode == JSGeneratorObject::NEXT) { |
2149 Label slow_resume; | 2158 Label slow_resume; |
2150 __ Branch(&slow_resume, ne, a3, Operand(zero_reg)); | 2159 __ Branch(&slow_resume, ne, a3, Operand(zero_reg)); |
2151 __ ld(a3, FieldMemOperand(a4, JSFunction::kCodeEntryOffset)); | 2160 __ ld(a3, FieldMemOperand(a4, JSFunction::kCodeEntryOffset)); |
2152 __ ld(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | 2161 __ ld(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
2153 __ SmiUntag(a2); | 2162 __ SmiUntag(a2); |
2154 __ Daddu(a3, a3, Operand(a2)); | 2163 __ Daddu(a3, a3, Operand(a2)); |
2155 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 2164 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
2156 __ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | 2165 __ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
| 2166 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation. |
2157 __ Jump(a3); | 2167 __ Jump(a3); |
2158 __ bind(&slow_resume); | 2168 __ bind(&slow_resume); |
2159 } | 2169 } |
2160 | 2170 |
2161 // Otherwise, we push holes for the operand stack and call the runtime to fix | 2171 // Otherwise, we push holes for the operand stack and call the runtime to fix |
2162 // up the stack and the handlers. | 2172 // up the stack and the handlers. |
2163 Label push_operand_holes, call_resume; | 2173 Label push_operand_holes, call_resume; |
2164 __ bind(&push_operand_holes); | 2174 __ bind(&push_operand_holes); |
2165 __ Dsubu(a3, a3, Operand(1)); | 2175 __ Dsubu(a3, a3, Operand(1)); |
2166 __ Branch(&call_resume, lt, a3, Operand(zero_reg)); | 2176 __ Branch(&call_resume, lt, a3, Operand(zero_reg)); |
2167 __ push(a2); | 2177 __ push(a2); |
2168 __ Branch(&push_operand_holes); | 2178 __ Branch(&push_operand_holes); |
2169 __ bind(&call_resume); | 2179 __ bind(&call_resume); |
| 2180 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation. |
2170 DCHECK(!result_register().is(a1)); | 2181 DCHECK(!result_register().is(a1)); |
2171 __ Push(a1, result_register()); | 2182 __ Push(a1, result_register()); |
2172 __ Push(Smi::FromInt(resume_mode)); | 2183 __ Push(Smi::FromInt(resume_mode)); |
2173 __ CallRuntime(Runtime::kResumeJSGeneratorObject); | 2184 __ CallRuntime(Runtime::kResumeJSGeneratorObject); |
2174 // Not reached: the runtime call returns elsewhere. | 2185 // Not reached: the runtime call returns elsewhere. |
2175 __ stop("not-reached"); | 2186 __ stop("not-reached"); |
2176 | 2187 |
2177 __ bind(&done); | 2188 __ bind(&done); |
2178 context()->Plug(result_register()); | 2189 context()->Plug(result_register()); |
2179 } | 2190 } |
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4808 reinterpret_cast<uint64_t>( | 4819 reinterpret_cast<uint64_t>( |
4809 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4820 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4810 return OSR_AFTER_STACK_CHECK; | 4821 return OSR_AFTER_STACK_CHECK; |
4811 } | 4822 } |
4812 | 4823 |
4813 | 4824 |
4814 } // namespace internal | 4825 } // namespace internal |
4815 } // namespace v8 | 4826 } // namespace v8 |
4816 | 4827 |
4817 #endif // V8_TARGET_ARCH_MIPS64 | 4828 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |