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

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

Issue 16923008: MIPS: Use keyed-call inline caches in delegating yield. (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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 2035
2036 // Initial stack layout is as follows: 2036 // Initial stack layout is as follows:
2037 // [sp + 1 * kPointerSize] iter 2037 // [sp + 1 * kPointerSize] iter
2038 // [sp + 0 * kPointerSize] g 2038 // [sp + 0 * kPointerSize] g
2039 2039
2040 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; 2040 Label l_catch, l_try, l_resume, l_next, l_call, l_loop;
2041 // Initial send value is undefined. 2041 // Initial send value is undefined.
2042 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); 2042 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex);
2043 __ Branch(&l_next); 2043 __ Branch(&l_next);
2044 2044
2045 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } 2045 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; }
2046 __ bind(&l_catch); 2046 __ bind(&l_catch);
2047 __ mov(a0, v0); 2047 __ mov(a0, v0);
2048 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); 2048 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
2049 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
2049 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter 2050 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2050 __ push(a3); // iter 2051 __ push(a3); // iter
2051 __ push(a0); // exception 2052 __ push(a0); // exception
2052 __ mov(a0, a3); // iter
2053 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
2054 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize();
2055 CallIC(throw_ic); // iter.throw in a0
2056 __ mov(a0, v0);
2057 __ jmp(&l_call); 2053 __ jmp(&l_call);
2058 2054
2059 // try { received = yield result.value } 2055 // try { received = yield result.value }
2060 __ bind(&l_try); 2056 __ bind(&l_try);
2061 EmitCreateIteratorResult(false); // pop and box to v0 2057 EmitCreateIteratorResult(false); // pop and box to v0
2062 __ PushTryHandler(StackHandler::CATCH, expr->index()); 2058 __ PushTryHandler(StackHandler::CATCH, expr->index());
2063 const int handler_size = StackHandlerConstants::kSize; 2059 const int handler_size = StackHandlerConstants::kSize;
2064 __ push(a0); // result 2060 __ push(a0); // result
2065 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g 2061 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g
2066 __ push(a3); // g 2062 __ push(a3); // g
2067 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 2063 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
2068 __ mov(a0, v0); 2064 __ mov(a0, v0);
2069 __ lw(context_register(), 2065 __ lw(context_register(),
2070 MemOperand(fp, StandardFrameConstants::kContextOffset)); 2066 MemOperand(fp, StandardFrameConstants::kContextOffset));
2071 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 2067 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
2072 __ Branch(&l_resume, ne, a0, Operand(at)); 2068 __ Branch(&l_resume, ne, a0, Operand(at));
2073 __ pop(v0); // result 2069 __ pop(v0); // result
2074 EmitReturnSequence(); 2070 EmitReturnSequence();
2075 __ mov(a0, v0); 2071 __ mov(a0, v0);
2076 __ bind(&l_resume); // received in a0 2072 __ bind(&l_resume); // received in a0
2077 __ PopTryHandler(); 2073 __ PopTryHandler();
2078 2074
2079 // receiver = iter; f = iter.next; arg = received; 2075 // receiver = iter; f = 'next'; arg = received;
2080 __ bind(&l_next); 2076 __ bind(&l_next);
2077 __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next"
2081 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter 2078 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2082 __ push(a3); // iter 2079 __ push(a3); // iter
2083 __ push(a0); // received 2080 __ push(a0); // received
2084 __ mov(a0, a3); // iter
2085 __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next"
2086 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize();
2087 CallIC(next_ic); // iter.next in a0
2088 __ mov(a0, v0);
2089 2081
2090 // result = f.call(receiver, arg); 2082 // result = receiver[f](arg);
2091 __ bind(&l_call); 2083 __ bind(&l_call);
2092 Label l_call_runtime; 2084 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(1);
2093 __ JumpIfSmi(a0, &l_call_runtime); 2085 CallIC(ic);
2094 __ GetObjectType(a0, a1, a1);
2095 __ Branch(&l_call_runtime, ne, a1, Operand(JS_FUNCTION_TYPE));
2096 __ mov(a1, a0);
2097 ParameterCount count(1);
2098 __ InvokeFunction(a1, count, CALL_FUNCTION,
2099 NullCallWrapper(), CALL_AS_METHOD);
2100 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2086 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2101 __ jmp(&l_loop);
2102 __ bind(&l_call_runtime);
2103 __ push(a0);
2104 __ CallRuntime(Runtime::kCall, 3);
2105 2087
2106 // val = result.value; if (!result.done) goto l_try; 2088 // val = result.value; if (!result.done) goto l_try;
2107 __ bind(&l_loop); 2089 __ bind(&l_loop);
2108 __ mov(a0, v0); 2090 __ mov(a0, v0);
2109 // result.value 2091 // result.value
2110 __ push(a0); // save result 2092 __ push(a0); // save result
2111 __ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value" 2093 __ LoadRoot(a2, Heap::kvalue_stringRootIndex); // "value"
2112 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); 2094 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
2113 CallIC(value_ic); // result.value in a0 2095 CallIC(value_ic); // result.value in a0
2114 __ mov(a0, v0); 2096 __ mov(a0, v0);
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
4949 *context_length = 0; 4931 *context_length = 0;
4950 return previous_; 4932 return previous_;
4951 } 4933 }
4952 4934
4953 4935
4954 #undef __ 4936 #undef __
4955 4937
4956 } } // namespace v8::internal 4938 } } // namespace v8::internal
4957 4939
4958 #endif // V8_TARGET_ARCH_MIPS 4940 #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