Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 16735005: MIPS: Generator object "next" method takes optional send value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 break; 2029 break;
2030 } 2030 }
2031 2031
2032 case Yield::DELEGATING: { 2032 case Yield::DELEGATING: {
2033 VisitForStackValue(expr->generator_object()); 2033 VisitForStackValue(expr->generator_object());
2034 2034
2035 // Initial stack layout is as follows: 2035 // Initial stack layout is as follows:
2036 // [sp + 1 * kPointerSize] iter 2036 // [sp + 1 * kPointerSize] iter
2037 // [sp + 0 * kPointerSize] g 2037 // [sp + 0 * kPointerSize] g
2038 2038
2039 Label l_catch, l_try, l_resume, l_send, l_call, l_loop; 2039 Label l_catch, l_try, l_resume, l_next, l_call, l_loop;
2040 // Initial send value is undefined. 2040 // Initial send value is undefined.
2041 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); 2041 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex);
2042 __ Branch(&l_send); 2042 __ Branch(&l_next);
2043 2043
2044 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } 2044 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; }
2045 __ bind(&l_catch); 2045 __ bind(&l_catch);
2046 __ mov(a0, v0); 2046 __ mov(a0, v0);
2047 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); 2047 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
2048 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter 2048 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2049 __ push(a3); // iter 2049 __ push(a3); // iter
2050 __ push(a0); // exception 2050 __ push(a0); // exception
2051 __ mov(a0, a3); // iter 2051 __ mov(a0, a3); // iter
2052 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" 2052 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
(...skipping 14 matching lines...) Expand all
2067 __ mov(a0, v0); 2067 __ mov(a0, v0);
2068 __ lw(context_register(), 2068 __ lw(context_register(),
2069 MemOperand(fp, StandardFrameConstants::kContextOffset)); 2069 MemOperand(fp, StandardFrameConstants::kContextOffset));
2070 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 2070 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
2071 __ Branch(&l_resume, ne, a0, Operand(at)); 2071 __ Branch(&l_resume, ne, a0, Operand(at));
2072 EmitReturnIteratorResult(false); 2072 EmitReturnIteratorResult(false);
2073 __ mov(a0, v0); 2073 __ mov(a0, v0);
2074 __ bind(&l_resume); // received in a0 2074 __ bind(&l_resume); // received in a0
2075 __ PopTryHandler(); 2075 __ PopTryHandler();
2076 2076
2077 // receiver = iter; f = iter.send; arg = received; 2077 // receiver = iter; f = iter.next; arg = received;
2078 __ bind(&l_send); 2078 __ bind(&l_next);
2079 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter 2079 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2080 __ push(a3); // iter 2080 __ push(a3); // iter
2081 __ push(a0); // received 2081 __ push(a0); // received
2082 __ mov(a0, a3); // iter 2082 __ mov(a0, a3); // iter
2083 __ LoadRoot(a2, Heap::ksend_stringRootIndex); // "send" 2083 __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next"
2084 Handle<Code> send_ic = isolate()->builtins()->LoadIC_Initialize(); 2084 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize();
2085 CallIC(send_ic); // iter.send in a0 2085 CallIC(next_ic); // iter.next in a0
2086 __ mov(a0, v0); 2086 __ mov(a0, v0);
2087 2087
2088 // result = f.call(receiver, arg); 2088 // result = f.call(receiver, arg);
2089 __ bind(&l_call); 2089 __ bind(&l_call);
2090 Label l_call_runtime; 2090 Label l_call_runtime;
2091 __ JumpIfSmi(a0, &l_call_runtime); 2091 __ JumpIfSmi(a0, &l_call_runtime);
2092 __ GetObjectType(a0, a1, a1); 2092 __ GetObjectType(a0, a1, a1);
2093 __ Branch(&l_call_runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); 2093 __ Branch(&l_call_runtime, ne, a1, Operand(JS_FUNCTION_TYPE));
2094 __ mov(a1, a0); 2094 __ mov(a1, a0);
2095 ParameterCount count(1); 2095 ParameterCount count(1);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 __ push(cp); // Callee's context. 2180 __ push(cp); // Callee's context.
2181 __ push(t0); // Callee's JS Function. 2181 __ push(t0); // Callee's JS Function.
2182 2182
2183 // Load the operand stack size. 2183 // Load the operand stack size.
2184 __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); 2184 __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset));
2185 __ lw(a3, FieldMemOperand(a3, FixedArray::kLengthOffset)); 2185 __ lw(a3, FieldMemOperand(a3, FixedArray::kLengthOffset));
2186 __ SmiUntag(a3); 2186 __ SmiUntag(a3);
2187 2187
2188 // If we are sending a value and there is no operand stack, we can jump back 2188 // If we are sending a value and there is no operand stack, we can jump back
2189 // in directly. 2189 // in directly.
2190 if (resume_mode == JSGeneratorObject::SEND) { 2190 if (resume_mode == JSGeneratorObject::NEXT) {
2191 Label slow_resume; 2191 Label slow_resume;
2192 __ Branch(&slow_resume, ne, a3, Operand(zero_reg)); 2192 __ Branch(&slow_resume, ne, a3, Operand(zero_reg));
2193 __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset)); 2193 __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset));
2194 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 2194 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
2195 __ SmiUntag(a2); 2195 __ SmiUntag(a2);
2196 __ Addu(a3, a3, Operand(a2)); 2196 __ Addu(a3, a3, Operand(a2));
2197 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 2197 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
2198 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 2198 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
2199 __ Jump(a3); 2199 __ Jump(a3);
2200 __ bind(&slow_resume); 2200 __ bind(&slow_resume);
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after
4966 *context_length = 0; 4966 *context_length = 0;
4967 return previous_; 4967 return previous_;
4968 } 4968 }
4969 4969
4970 4970
4971 #undef __ 4971 #undef __
4972 4972
4973 } } // namespace v8::internal 4973 } } // namespace v8::internal
4974 4974
4975 #endif // V8_TARGET_ARCH_MIPS 4975 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698