| 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 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 __ cmp(sp, r1); | 2014 __ cmp(sp, r1); |
| 2015 __ b(eq, &post_runtime); | 2015 __ b(eq, &post_runtime); |
| 2016 __ push(r0); // generator object | 2016 __ push(r0); // generator object |
| 2017 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2017 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 2018 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2018 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2019 __ bind(&post_runtime); | 2019 __ bind(&post_runtime); |
| 2020 __ pop(result_register()); | 2020 __ pop(result_register()); |
| 2021 EmitReturnSequence(); | 2021 EmitReturnSequence(); |
| 2022 | 2022 |
| 2023 __ bind(&resume); | 2023 __ bind(&resume); |
| 2024 Label init_value_check_done; |
| 2025 if (expr->yield_kind() == Yield::INITIAL) { |
| 2026 // When value is provided and it is not undefined, throw error. |
| 2027 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); |
| 2028 __ b(eq, &init_value_check_done); |
| 2029 // This error should be raised from the Generator.prototype.next side. |
| 2030 // So in this case, we return the hole value as a marker. The caller |
| 2031 // checks the result value and if it is the hole value, the caller |
| 2032 // throws error. |
| 2033 __ Push(isolate()->factory()->the_hole_value()); |
| 2034 __ jmp(&suspend); |
| 2035 } |
| 2036 __ bind(&init_value_check_done); |
| 2024 context()->Plug(result_register()); | 2037 context()->Plug(result_register()); |
| 2025 break; | 2038 break; |
| 2026 } | 2039 } |
| 2027 | 2040 |
| 2028 case Yield::FINAL: { | 2041 case Yield::FINAL: { |
| 2029 VisitForAccumulatorValue(expr->generator_object()); | 2042 VisitForAccumulatorValue(expr->generator_object()); |
| 2030 __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 2043 __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 2031 __ str(r1, FieldMemOperand(result_register(), | 2044 __ str(r1, FieldMemOperand(result_register(), |
| 2032 JSGeneratorObject::kContinuationOffset)); | 2045 JSGeneratorObject::kContinuationOffset)); |
| 2033 // Pop value from top-of-stack slot, box result into result register. | 2046 // Pop value from top-of-stack slot, box result into result register. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 __ push(r0); | 2247 __ push(r0); |
| 2235 __ CallRuntime(Runtime::kThrow, 1); | 2248 __ CallRuntime(Runtime::kThrow, 1); |
| 2236 } | 2249 } |
| 2237 __ jmp(&done); | 2250 __ jmp(&done); |
| 2238 | 2251 |
| 2239 // Throw error if we attempt to operate on a running generator. | 2252 // Throw error if we attempt to operate on a running generator. |
| 2240 __ bind(&wrong_state); | 2253 __ bind(&wrong_state); |
| 2241 __ push(r1); | 2254 __ push(r1); |
| 2242 __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); | 2255 __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); |
| 2243 | 2256 |
| 2257 // Throw error if we attempt to pass a value to an unborn generator. |
| 2258 Label wrong_start; |
| 2259 __ bind(&wrong_start); |
| 2260 __ CallRuntime(Runtime::kThrowGeneratorStartError, 0); |
| 2261 |
| 2244 __ bind(&done); | 2262 __ bind(&done); |
| 2263 // When a value is passed to an unborn generator, the result becomes the hole |
| 2264 // value. And we need to throw GeneratorStartError in the caller side. |
| 2265 // (Generator.prototype.next) |
| 2266 __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex); |
| 2267 __ b(eq, &wrong_start); |
| 2245 context()->Plug(result_register()); | 2268 context()->Plug(result_register()); |
| 2246 } | 2269 } |
| 2247 | 2270 |
| 2248 | 2271 |
| 2249 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { | 2272 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
| 2250 Label gc_required; | 2273 Label gc_required; |
| 2251 Label allocated; | 2274 Label allocated; |
| 2252 | 2275 |
| 2253 Handle<Map> map(isolate()->native_context()->generator_result_map()); | 2276 Handle<Map> map(isolate()->native_context()->generator_result_map()); |
| 2254 | 2277 |
| (...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4923 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4946 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
| 4924 reinterpret_cast<uint32_t>( | 4947 reinterpret_cast<uint32_t>( |
| 4925 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4948 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4926 return OSR_AFTER_STACK_CHECK; | 4949 return OSR_AFTER_STACK_CHECK; |
| 4927 } | 4950 } |
| 4928 | 4951 |
| 4929 | 4952 |
| 4930 } } // namespace v8::internal | 4953 } } // namespace v8::internal |
| 4931 | 4954 |
| 4932 #endif // V8_TARGET_ARCH_ARM | 4955 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |