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

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

Issue 16703007: Merged r15047, r15048, r15049 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
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 | src/mips/ic-mips.cc » ('j') | 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 __ push(a0); // push LoadIC state
2053 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" 2052 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
2054 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize(); 2053 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize();
2055 CallIC(throw_ic); // iter.throw in a0 2054 CallIC(throw_ic); // iter.throw in a0
2056 __ mov(a0, v0); 2055 __ mov(a0, v0);
2057 __ Addu(sp, sp, Operand(kPointerSize)); // drop LoadIC state
2058 __ jmp(&l_call); 2056 __ jmp(&l_call);
2059 2057
2060 // try { received = yield result.value } 2058 // try { received = yield result.value }
2061 __ bind(&l_try); 2059 __ bind(&l_try);
2062 __ pop(a0); // result.value 2060 __ pop(a0); // result.value
2063 __ PushTryHandler(StackHandler::CATCH, expr->index()); 2061 __ PushTryHandler(StackHandler::CATCH, expr->index());
2064 const int handler_size = StackHandlerConstants::kSize; 2062 const int handler_size = StackHandlerConstants::kSize;
2065 __ push(a0); // result.value 2063 __ push(a0); // result.value
2066 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g 2064 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g
2067 __ push(a3); // g 2065 __ push(a3); // g
2068 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 2066 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
2069 __ mov(a0, v0); 2067 __ mov(a0, v0);
2070 __ lw(context_register(), 2068 __ lw(context_register(),
2071 MemOperand(fp, StandardFrameConstants::kContextOffset)); 2069 MemOperand(fp, StandardFrameConstants::kContextOffset));
2072 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 2070 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
2073 __ Branch(&l_resume, ne, a0, Operand(at)); 2071 __ Branch(&l_resume, ne, a0, Operand(at));
2074 EmitReturnIteratorResult(false); 2072 EmitReturnIteratorResult(false);
2075 __ mov(a0, v0); 2073 __ mov(a0, v0);
2076 __ bind(&l_resume); // received in a0 2074 __ bind(&l_resume); // received in a0
2077 __ PopTryHandler(); 2075 __ PopTryHandler();
2078 2076
2079 // receiver = iter; f = iter.send; arg = received; 2077 // receiver = iter; f = iter.next; arg = received;
2080 __ bind(&l_send); 2078 __ bind(&l_next);
2081 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter 2079 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2082 __ push(a3); // iter 2080 __ push(a3); // iter
2083 __ push(a0); // received 2081 __ push(a0); // received
2084 __ mov(a0, a3); // iter 2082 __ mov(a0, a3); // iter
2085 __ push(a0); // push LoadIC state 2083 __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next"
2086 __ LoadRoot(a2, Heap::ksend_stringRootIndex); // "send" 2084 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize();
2087 Handle<Code> send_ic = isolate()->builtins()->LoadIC_Initialize(); 2085 CallIC(next_ic); // iter.next in a0
2088 CallIC(send_ic); // iter.send in a0
2089 __ mov(a0, v0); 2086 __ mov(a0, v0);
2090 __ Addu(sp, sp, Operand(kPointerSize)); // drop LoadIC state
2091 2087
2092 // result = f.call(receiver, arg); 2088 // result = f.call(receiver, arg);
2093 __ bind(&l_call); 2089 __ bind(&l_call);
2094 Label l_call_runtime; 2090 Label l_call_runtime;
2095 __ JumpIfSmi(a0, &l_call_runtime); 2091 __ JumpIfSmi(a0, &l_call_runtime);
2096 __ GetObjectType(a0, a1, a1); 2092 __ GetObjectType(a0, a1, a1);
2097 __ Branch(&l_call_runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); 2093 __ Branch(&l_call_runtime, ne, a1, Operand(JS_FUNCTION_TYPE));
2098 __ mov(a1, a0); 2094 __ mov(a1, a0);
2099 ParameterCount count(1); 2095 ParameterCount count(1);
2100 __ InvokeFunction(a1, count, CALL_FUNCTION, 2096 __ InvokeFunction(a1, count, CALL_FUNCTION,
2101 NullCallWrapper(), CALL_AS_METHOD); 2097 NullCallWrapper(), CALL_AS_METHOD);
2102 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2098 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2103 __ jmp(&l_loop); 2099 __ jmp(&l_loop);
2104 __ bind(&l_call_runtime); 2100 __ bind(&l_call_runtime);
2105 __ push(a0); 2101 __ push(a0);
2106 __ CallRuntime(Runtime::kCall, 3); 2102 __ CallRuntime(Runtime::kCall, 3);
2107 2103
2108 // val = result.value; if (!result.done) goto l_try; 2104 // val = result.value; if (!result.done) goto l_try;
2109 __ bind(&l_loop); 2105 __ bind(&l_loop);
2110 __ mov(a0, v0); 2106 __ mov(a0, v0);
2111 // result.value 2107 // result.value
2112 __ push(a0); // save result 2108 __ push(a0); // save result
2113 __ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value" 2109 __ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value"
2114 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); 2110 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
2115 CallIC(value_ic); // result.value in a0 2111 CallIC(value_ic); // result.value in a0
2116 __ mov(a0, v0); 2112 __ mov(a0, v0);
2117 __ pop(a1); // result 2113 __ pop(a1); // result
2118 __ push(a0); // result.value 2114 __ push(a0); // result.value
2119 __ mov(a0, a1); // result 2115 __ mov(a0, a1); // result
2120 __ push(a0); // push LoadIC state
2121 __ LoadRoot(a2, Heap::kdone_stringRootIndex); // "done" 2116 __ LoadRoot(a2, Heap::kdone_stringRootIndex); // "done"
2122 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); 2117 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize();
2123 CallIC(done_ic); // result.done in v0 2118 CallIC(done_ic); // result.done in v0
2124 __ Addu(sp, sp, Operand(kPointerSize)); // drop LoadIC state
2125 __ mov(a0, v0); 2119 __ mov(a0, v0);
2126 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 2120 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2127 CallIC(bool_ic); 2121 CallIC(bool_ic);
2128 __ Branch(&l_try, eq, v0, Operand(zero_reg)); 2122 __ Branch(&l_try, eq, v0, Operand(zero_reg));
2129 2123
2130 // result.value 2124 // result.value
2131 __ pop(v0); // result.value 2125 __ pop(v0); // result.value
2132 context()->DropAndPlug(2, v0); // drop iter and g 2126 context()->DropAndPlug(2, v0); // drop iter and g
2133 break; 2127 break;
2134 } 2128 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 __ push(cp); // Callee's context. 2180 __ push(cp); // Callee's context.
2187 __ push(t0); // Callee's JS Function. 2181 __ push(t0); // Callee's JS Function.
2188 2182
2189 // Load the operand stack size. 2183 // Load the operand stack size.
2190 __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); 2184 __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset));
2191 __ lw(a3, FieldMemOperand(a3, FixedArray::kLengthOffset)); 2185 __ lw(a3, FieldMemOperand(a3, FixedArray::kLengthOffset));
2192 __ SmiUntag(a3); 2186 __ SmiUntag(a3);
2193 2187
2194 // 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
2195 // in directly. 2189 // in directly.
2196 if (resume_mode == JSGeneratorObject::SEND) { 2190 if (resume_mode == JSGeneratorObject::NEXT) {
2197 Label slow_resume; 2191 Label slow_resume;
2198 __ Branch(&slow_resume, ne, a3, Operand(zero_reg)); 2192 __ Branch(&slow_resume, ne, a3, Operand(zero_reg));
2199 __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset)); 2193 __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset));
2200 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 2194 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
2201 __ SmiUntag(a2); 2195 __ SmiUntag(a2);
2202 __ Addu(a3, a3, Operand(a2)); 2196 __ Addu(a3, a3, Operand(a2));
2203 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 2197 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
2204 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 2198 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
2205 __ Jump(a3); 2199 __ Jump(a3);
2206 __ bind(&slow_resume); 2200 __ bind(&slow_resume);
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after
4972 *context_length = 0; 4966 *context_length = 0;
4973 return previous_; 4967 return previous_;
4974 } 4968 }
4975 4969
4976 4970
4977 #undef __ 4971 #undef __
4978 4972
4979 } } // namespace v8::internal 4973 } } // namespace v8::internal
4980 4974
4981 #endif // V8_TARGET_ARCH_MIPS 4975 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698