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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2049 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2049 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
2050 __ push(a3); // iter | 2050 __ push(a3); // iter |
2051 __ push(a0); // exception | 2051 __ push(a0); // exception |
2052 __ mov(a0, a3); // iter | 2052 __ mov(a0, a3); // iter |
2053 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" | 2053 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" |
2054 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize(); | 2054 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize(); |
2055 CallIC(throw_ic); // iter.throw in a0 | 2055 CallIC(throw_ic); // iter.throw in a0 |
2056 __ mov(a0, v0); | 2056 __ mov(a0, v0); |
2057 __ jmp(&l_call); | 2057 __ jmp(&l_call); |
2058 | 2058 |
2059 // try { received = yield result.value } | 2059 // try { received = %yield result } |
2060 // Shuffle the received result above a try handler and yield it without | |
2061 // re-boxing. | |
2060 __ bind(&l_try); | 2062 __ bind(&l_try); |
2061 EmitCreateIteratorResult(false); // pop and box to v0 | 2063 __ pop(a0); // result |
2062 __ PushTryHandler(StackHandler::CATCH, expr->index()); | 2064 __ PushTryHandler(StackHandler::CATCH, expr->index()); |
2063 const int handler_size = StackHandlerConstants::kSize; | 2065 const int handler_size = StackHandlerConstants::kSize; |
2064 __ push(a0); // result | 2066 __ push(a0); // result |
2065 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g | 2067 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g |
2066 __ push(a3); // g | 2068 __ push(a3); // g |
2067 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2069 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
2068 __ mov(a0, v0); | 2070 __ mov(a0, v0); |
2069 __ lw(context_register(), | 2071 __ lw(context_register(), |
2070 MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2072 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2071 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2073 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
(...skipping 24 matching lines...) Expand all Loading... | |
2096 __ mov(a1, a0); | 2098 __ mov(a1, a0); |
2097 ParameterCount count(1); | 2099 ParameterCount count(1); |
2098 __ InvokeFunction(a1, count, CALL_FUNCTION, | 2100 __ InvokeFunction(a1, count, CALL_FUNCTION, |
2099 NullCallWrapper(), CALL_AS_METHOD); | 2101 NullCallWrapper(), CALL_AS_METHOD); |
2100 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2102 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2101 __ jmp(&l_loop); | 2103 __ jmp(&l_loop); |
2102 __ bind(&l_call_runtime); | 2104 __ bind(&l_call_runtime); |
2103 __ push(a0); | 2105 __ push(a0); |
2104 __ CallRuntime(Runtime::kCall, 3); | 2106 __ CallRuntime(Runtime::kCall, 3); |
2105 | 2107 |
2106 // val = result.value; if (!result.done) goto l_try; | 2108 // if (!result.done) goto l_try; |
2107 __ bind(&l_loop); | 2109 __ bind(&l_loop); |
2108 __ mov(a0, v0); | 2110 __ mov(a0, v0); |
2109 // result.value | |
2110 __ push(a0); // save result | 2111 __ push(a0); // save result |
2111 __ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value" | |
2112 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); | |
2113 CallIC(value_ic); // result.value in a0 | |
2114 __ mov(a0, v0); | |
2115 __ pop(a1); // result | |
2116 __ push(a0); // result.value | |
2117 __ mov(a0, a1); // result | |
2118 __ LoadRoot(a2, Heap::kdone_stringRootIndex); // "done" | 2112 __ LoadRoot(a2, Heap::kdone_stringRootIndex); // "done" |
2119 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); | 2113 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); |
2120 CallIC(done_ic); // result.done in v0 | 2114 CallIC(done_ic); // result.done in v0 |
2121 __ mov(a0, v0); | 2115 __ mov(a0, v0); |
2122 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2116 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2123 CallIC(bool_ic); | 2117 CallIC(bool_ic); |
2124 __ Branch(&l_try, eq, v0, Operand(zero_reg)); | 2118 __ Branch(&l_try, eq, v0, Operand(zero_reg)); |
2125 | 2119 |
2126 // result.value | 2120 // result.value |
2127 __ pop(v0); // result.value | 2121 __ pop(a0); // result |
2122 __ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value" | |
2123 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); | |
2124 CallIC(value_ic); // result.value in r0 | |
Paul Lind
2013/06/13 17:32:46
nit: comment r0 -> v0
| |
2128 context()->DropAndPlug(2, v0); // drop iter and g | 2125 context()->DropAndPlug(2, v0); // drop iter and g |
2129 break; | 2126 break; |
2130 } | 2127 } |
2131 } | 2128 } |
2132 } | 2129 } |
2133 | 2130 |
2134 | 2131 |
2135 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2132 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
2136 Expression *value, | 2133 Expression *value, |
2137 JSGeneratorObject::ResumeMode resume_mode) { | 2134 JSGeneratorObject::ResumeMode resume_mode) { |
(...skipping 2811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4949 *context_length = 0; | 4946 *context_length = 0; |
4950 return previous_; | 4947 return previous_; |
4951 } | 4948 } |
4952 | 4949 |
4953 | 4950 |
4954 #undef __ | 4951 #undef __ |
4955 | 4952 |
4956 } } // namespace v8::internal | 4953 } } // namespace v8::internal |
4957 | 4954 |
4958 #endif // V8_TARGET_ARCH_MIPS | 4955 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |