| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 break; | 2022 break; |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 case Yield::DELEGATING: { | 2025 case Yield::DELEGATING: { |
| 2026 VisitForStackValue(expr->generator_object()); | 2026 VisitForStackValue(expr->generator_object()); |
| 2027 | 2027 |
| 2028 // Initial stack layout is as follows: | 2028 // Initial stack layout is as follows: |
| 2029 // [sp + 1 * kPointerSize] iter | 2029 // [sp + 1 * kPointerSize] iter |
| 2030 // [sp + 0 * kPointerSize] g | 2030 // [sp + 0 * kPointerSize] g |
| 2031 | 2031 |
| 2032 Label l_catch, l_try, l_resume, l_send, l_call, l_loop; | 2032 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; |
| 2033 // Initial send value is undefined. | 2033 // Initial send value is undefined. |
| 2034 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 2034 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 2035 __ b(&l_send); | 2035 __ b(&l_next); |
| 2036 | 2036 |
| 2037 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } | 2037 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } |
| 2038 __ bind(&l_catch); | 2038 __ bind(&l_catch); |
| 2039 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); | 2039 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); |
| 2040 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2040 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2041 __ push(r3); // iter | 2041 __ push(r3); // iter |
| 2042 __ push(r0); // exception | 2042 __ push(r0); // exception |
| 2043 __ mov(r0, r3); // iter | 2043 __ mov(r0, r3); // iter |
| 2044 __ LoadRoot(r2, Heap::kthrow_stringRootIndex); // "throw" | 2044 __ LoadRoot(r2, Heap::kthrow_stringRootIndex); // "throw" |
| 2045 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize(); | 2045 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2056 __ push(r3); // g | 2056 __ push(r3); // g |
| 2057 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2057 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 2058 __ ldr(context_register(), | 2058 __ ldr(context_register(), |
| 2059 MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2059 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2060 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); | 2060 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); |
| 2061 __ b(ne, &l_resume); | 2061 __ b(ne, &l_resume); |
| 2062 EmitReturnIteratorResult(false); | 2062 EmitReturnIteratorResult(false); |
| 2063 __ bind(&l_resume); // received in r0 | 2063 __ bind(&l_resume); // received in r0 |
| 2064 __ PopTryHandler(); | 2064 __ PopTryHandler(); |
| 2065 | 2065 |
| 2066 // receiver = iter; f = iter.send; arg = received; | 2066 // receiver = iter; f = iter.next; arg = received; |
| 2067 __ bind(&l_send); | 2067 __ bind(&l_next); |
| 2068 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2068 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2069 __ push(r3); // iter | 2069 __ push(r3); // iter |
| 2070 __ push(r0); // received | 2070 __ push(r0); // received |
| 2071 __ mov(r0, r3); // iter | 2071 __ mov(r0, r3); // iter |
| 2072 __ LoadRoot(r2, Heap::ksend_stringRootIndex); // "send" | 2072 __ LoadRoot(r2, Heap::knext_stringRootIndex); // "next" |
| 2073 Handle<Code> send_ic = isolate()->builtins()->LoadIC_Initialize(); | 2073 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2074 CallIC(send_ic); // iter.send in r0 | 2074 CallIC(next_ic); // iter.next in r0 |
| 2075 | 2075 |
| 2076 // result = f.call(receiver, arg); | 2076 // result = f.call(receiver, arg); |
| 2077 __ bind(&l_call); | 2077 __ bind(&l_call); |
| 2078 Label l_call_runtime; | 2078 Label l_call_runtime; |
| 2079 __ JumpIfSmi(r0, &l_call_runtime); | 2079 __ JumpIfSmi(r0, &l_call_runtime); |
| 2080 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | 2080 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); |
| 2081 __ b(ne, &l_call_runtime); | 2081 __ b(ne, &l_call_runtime); |
| 2082 __ mov(r1, r0); | 2082 __ mov(r1, r0); |
| 2083 ParameterCount count(1); | 2083 ParameterCount count(1); |
| 2084 __ InvokeFunction(r1, count, CALL_FUNCTION, | 2084 __ InvokeFunction(r1, count, CALL_FUNCTION, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 __ push(cp); // Callee's context. | 2167 __ push(cp); // Callee's context. |
| 2168 __ push(r4); // Callee's JS Function. | 2168 __ push(r4); // Callee's JS Function. |
| 2169 | 2169 |
| 2170 // Load the operand stack size. | 2170 // Load the operand stack size. |
| 2171 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | 2171 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
| 2172 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2172 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
| 2173 __ SmiUntag(r3); | 2173 __ SmiUntag(r3); |
| 2174 | 2174 |
| 2175 // If we are sending a value and there is no operand stack, we can jump back | 2175 // If we are sending a value and there is no operand stack, we can jump back |
| 2176 // in directly. | 2176 // in directly. |
| 2177 if (resume_mode == JSGeneratorObject::SEND) { | 2177 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2178 Label slow_resume; | 2178 Label slow_resume; |
| 2179 __ cmp(r3, Operand(0)); | 2179 __ cmp(r3, Operand(0)); |
| 2180 __ b(ne, &slow_resume); | 2180 __ b(ne, &slow_resume); |
| 2181 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 2181 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
| 2182 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2182 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2183 __ SmiUntag(r2); | 2183 __ SmiUntag(r2); |
| 2184 __ add(r3, r3, r2); | 2184 __ add(r3, r3, r2); |
| 2185 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 2185 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
| 2186 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2186 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2187 __ Jump(r3); | 2187 __ Jump(r3); |
| (...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4929 *context_length = 0; | 4929 *context_length = 0; |
| 4930 return previous_; | 4930 return previous_; |
| 4931 } | 4931 } |
| 4932 | 4932 |
| 4933 | 4933 |
| 4934 #undef __ | 4934 #undef __ |
| 4935 | 4935 |
| 4936 } } // namespace v8::internal | 4936 } } // namespace v8::internal |
| 4937 | 4937 |
| 4938 #endif // V8_TARGET_ARCH_ARM | 4938 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |