| 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 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 | 2030 |
| 2031 // Initial stack layout is as follows: | 2031 // Initial stack layout is as follows: |
| 2032 // [sp + 1 * kPointerSize] iter | 2032 // [sp + 1 * kPointerSize] iter |
| 2033 // [sp + 0 * kPointerSize] g | 2033 // [sp + 0 * kPointerSize] g |
| 2034 | 2034 |
| 2035 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; | 2035 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; |
| 2036 // Initial send value is undefined. | 2036 // Initial send value is undefined. |
| 2037 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 2037 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 2038 __ b(&l_next); | 2038 __ b(&l_next); |
| 2039 | 2039 |
| 2040 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } | 2040 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; } |
| 2041 __ bind(&l_catch); | 2041 __ bind(&l_catch); |
| 2042 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); | 2042 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); |
| 2043 __ LoadRoot(r2, Heap::kthrow_stringRootIndex); // "throw" |
| 2043 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2044 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2044 __ push(r3); // iter | 2045 __ push(r3); // iter |
| 2045 __ push(r0); // exception | 2046 __ push(r0); // exception |
| 2046 __ mov(r0, r3); // iter | |
| 2047 __ LoadRoot(r2, Heap::kthrow_stringRootIndex); // "throw" | |
| 2048 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize(); | |
| 2049 CallIC(throw_ic); // iter.throw in r0 | |
| 2050 __ jmp(&l_call); | 2047 __ jmp(&l_call); |
| 2051 | 2048 |
| 2052 // try { received = yield result.value } | 2049 // try { received = yield result.value } |
| 2053 __ bind(&l_try); | 2050 __ bind(&l_try); |
| 2054 EmitCreateIteratorResult(false); // pop and box to r0 | 2051 EmitCreateIteratorResult(false); // pop and box to r0 |
| 2055 __ PushTryHandler(StackHandler::CATCH, expr->index()); | 2052 __ PushTryHandler(StackHandler::CATCH, expr->index()); |
| 2056 const int handler_size = StackHandlerConstants::kSize; | 2053 const int handler_size = StackHandlerConstants::kSize; |
| 2057 __ push(r0); // result | 2054 __ push(r0); // result |
| 2058 __ ldr(r3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g | 2055 __ ldr(r3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g |
| 2059 __ push(r3); // g | 2056 __ push(r3); // g |
| 2060 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2057 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 2061 __ ldr(context_register(), | 2058 __ ldr(context_register(), |
| 2062 MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2059 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2063 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); | 2060 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); |
| 2064 __ b(ne, &l_resume); | 2061 __ b(ne, &l_resume); |
| 2065 __ pop(r0); // result | 2062 __ pop(r0); // result |
| 2066 EmitReturnSequence(); | 2063 EmitReturnSequence(); |
| 2067 __ bind(&l_resume); // received in r0 | 2064 __ bind(&l_resume); // received in r0 |
| 2068 __ PopTryHandler(); | 2065 __ PopTryHandler(); |
| 2069 | 2066 |
| 2070 // receiver = iter; f = iter.next; arg = received; | 2067 // receiver = iter; f = 'next'; arg = received; |
| 2071 __ bind(&l_next); | 2068 __ bind(&l_next); |
| 2069 __ LoadRoot(r2, Heap::knext_stringRootIndex); // "next" |
| 2072 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2070 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2073 __ push(r3); // iter | 2071 __ push(r3); // iter |
| 2074 __ push(r0); // received | 2072 __ push(r0); // received |
| 2075 __ mov(r0, r3); // iter | |
| 2076 __ LoadRoot(r2, Heap::knext_stringRootIndex); // "next" | |
| 2077 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize(); | |
| 2078 CallIC(next_ic); // iter.next in r0 | |
| 2079 | 2073 |
| 2080 // result = f.call(receiver, arg); | 2074 // result = receiver[f](arg); |
| 2081 __ bind(&l_call); | 2075 __ bind(&l_call); |
| 2082 Label l_call_runtime; | 2076 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(1); |
| 2083 __ JumpIfSmi(r0, &l_call_runtime); | 2077 CallIC(ic); |
| 2084 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); | |
| 2085 __ b(ne, &l_call_runtime); | |
| 2086 __ mov(r1, r0); | |
| 2087 ParameterCount count(1); | |
| 2088 __ InvokeFunction(r1, count, CALL_FUNCTION, | |
| 2089 NullCallWrapper(), CALL_AS_METHOD); | |
| 2090 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2078 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2091 __ jmp(&l_loop); | |
| 2092 __ bind(&l_call_runtime); | |
| 2093 __ push(r0); | |
| 2094 __ CallRuntime(Runtime::kCall, 3); | |
| 2095 | 2079 |
| 2096 // val = result.value; if (!result.done) goto l_try; | 2080 // val = result.value; if (!result.done) goto l_try; |
| 2097 __ bind(&l_loop); | 2081 __ bind(&l_loop); |
| 2098 // result.value | 2082 // result.value |
| 2099 __ push(r0); // save result | 2083 __ push(r0); // save result |
| 2100 __ LoadRoot(r2, Heap::kvalue_stringRootIndex); // "value" | 2084 __ LoadRoot(r2, Heap::kvalue_stringRootIndex); // "value" |
| 2101 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); | 2085 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2102 CallIC(value_ic); // result.value in r0 | 2086 CallIC(value_ic); // result.value in r0 |
| 2103 __ pop(r1); // result | 2087 __ pop(r1); // result |
| 2104 __ push(r0); // result.value | 2088 __ push(r0); // result.value |
| (...skipping 2811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4916 *context_length = 0; | 4900 *context_length = 0; |
| 4917 return previous_; | 4901 return previous_; |
| 4918 } | 4902 } |
| 4919 | 4903 |
| 4920 | 4904 |
| 4921 #undef __ | 4905 #undef __ |
| 4922 | 4906 |
| 4923 } } // namespace v8::internal | 4907 } } // namespace v8::internal |
| 4924 | 4908 |
| 4925 #endif // V8_TARGET_ARCH_ARM | 4909 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |