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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 case Yield::kSuspend: | 1930 case Yield::kSuspend: |
1931 // Pop value from top-of-stack slot; box result into result register. | 1931 // Pop value from top-of-stack slot; box result into result register. |
1932 EmitCreateIteratorResult(false); | 1932 EmitCreateIteratorResult(false); |
1933 __ push(result_register()); | 1933 __ push(result_register()); |
1934 // Fall through. | 1934 // Fall through. |
1935 case Yield::kInitial: { | 1935 case Yield::kInitial: { |
1936 Label suspend, continuation, post_runtime, resume; | 1936 Label suspend, continuation, post_runtime, resume; |
1937 | 1937 |
1938 __ jmp(&suspend); | 1938 __ jmp(&suspend); |
1939 __ bind(&continuation); | 1939 __ bind(&continuation); |
| 1940 // When we arrive here, the stack top is the resume mode and |
| 1941 // result_register() holds the input value (the argument given to the |
| 1942 // respective resume operation). |
1940 __ RecordGeneratorContinuation(); | 1943 __ RecordGeneratorContinuation(); |
1941 __ jmp(&resume); | 1944 __ pop(r1); |
| 1945 __ cmp(r1, Operand(Smi::FromInt(JSGeneratorObject::RETURN))); |
| 1946 __ b(ne, &resume); |
| 1947 __ push(result_register()); |
| 1948 EmitCreateIteratorResult(true); |
| 1949 EmitUnwindBeforeReturn(); |
| 1950 EmitReturnSequence(); |
1942 | 1951 |
1943 __ bind(&suspend); | 1952 __ bind(&suspend); |
1944 VisitForAccumulatorValue(expr->generator_object()); | 1953 VisitForAccumulatorValue(expr->generator_object()); |
1945 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 1954 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
1946 __ mov(r1, Operand(Smi::FromInt(continuation.pos()))); | 1955 __ mov(r1, Operand(Smi::FromInt(continuation.pos()))); |
1947 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); | 1956 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); |
1948 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); | 1957 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); |
1949 __ mov(r1, cp); | 1958 __ mov(r1, cp); |
1950 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, | 1959 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, |
1951 kLRHasBeenSaved, kDontSaveFPRegs); | 1960 kLRHasBeenSaved, kDontSaveFPRegs); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 if (FLAG_enable_embedded_constant_pool) { | 2162 if (FLAG_enable_embedded_constant_pool) { |
2154 // Load the new code object's constant pool pointer. | 2163 // Load the new code object's constant pool pointer. |
2155 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r3); | 2164 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r3); |
2156 } | 2165 } |
2157 | 2166 |
2158 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2167 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
2159 __ SmiUntag(r2); | 2168 __ SmiUntag(r2); |
2160 __ add(r3, r3, r2); | 2169 __ add(r3, r3, r2); |
2161 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 2170 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
2162 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2171 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2172 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation. |
2163 __ Jump(r3); | 2173 __ Jump(r3); |
2164 } | 2174 } |
2165 __ bind(&slow_resume); | 2175 __ bind(&slow_resume); |
2166 } | 2176 } |
2167 | 2177 |
2168 // Otherwise, we push holes for the operand stack and call the runtime to fix | 2178 // Otherwise, we push holes for the operand stack and call the runtime to fix |
2169 // up the stack and the handlers. | 2179 // up the stack and the handlers. |
2170 Label push_operand_holes, call_resume; | 2180 Label push_operand_holes, call_resume; |
2171 __ bind(&push_operand_holes); | 2181 __ bind(&push_operand_holes); |
2172 __ sub(r3, r3, Operand(1), SetCC); | 2182 __ sub(r3, r3, Operand(1), SetCC); |
2173 __ b(mi, &call_resume); | 2183 __ b(mi, &call_resume); |
2174 __ push(r2); | 2184 __ push(r2); |
2175 __ b(&push_operand_holes); | 2185 __ b(&push_operand_holes); |
2176 __ bind(&call_resume); | 2186 __ bind(&call_resume); |
| 2187 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation. |
2177 DCHECK(!result_register().is(r1)); | 2188 DCHECK(!result_register().is(r1)); |
2178 __ Push(r1, result_register()); | 2189 __ Push(r1, result_register()); |
2179 __ Push(Smi::FromInt(resume_mode)); | 2190 __ Push(Smi::FromInt(resume_mode)); |
2180 __ CallRuntime(Runtime::kResumeJSGeneratorObject); | 2191 __ CallRuntime(Runtime::kResumeJSGeneratorObject); |
2181 // Not reached: the runtime call returns elsewhere. | 2192 // Not reached: the runtime call returns elsewhere. |
2182 __ stop("not-reached"); | 2193 __ stop("not-reached"); |
2183 | 2194 |
2184 __ bind(&done); | 2195 __ bind(&done); |
2185 context()->Plug(result_register()); | 2196 context()->Plug(result_register()); |
2186 } | 2197 } |
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4843 DCHECK(interrupt_address == | 4854 DCHECK(interrupt_address == |
4844 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4855 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4845 return OSR_AFTER_STACK_CHECK; | 4856 return OSR_AFTER_STACK_CHECK; |
4846 } | 4857 } |
4847 | 4858 |
4848 | 4859 |
4849 } // namespace internal | 4860 } // namespace internal |
4850 } // namespace v8 | 4861 } // namespace v8 |
4851 | 4862 |
4852 #endif // V8_TARGET_ARCH_ARM | 4863 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |