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

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

Issue 15455002: Use keyed-call inline caches in delegating yield (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ARM compilation. 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 | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-2691.js » ('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 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 2013
2014 // Initial stack layout is as follows: 2014 // Initial stack layout is as follows:
2015 // [sp + 1 * kPointerSize] iter 2015 // [sp + 1 * kPointerSize] iter
2016 // [sp + 0 * kPointerSize] g 2016 // [sp + 0 * kPointerSize] g
2017 2017
2018 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; 2018 Label l_catch, l_try, l_resume, l_next, l_call, l_loop;
2019 // Initial send value is undefined. 2019 // Initial send value is undefined.
2020 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 2020 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
2021 __ jmp(&l_next); 2021 __ jmp(&l_next);
2022 2022
2023 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } 2023 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; }
2024 __ bind(&l_catch); 2024 __ bind(&l_catch);
2025 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); 2025 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
2026 __ movq(rcx, Operand(rsp, 1 * kPointerSize)); // iter 2026 __ LoadRoot(rcx, Heap::kthrow_stringRootIndex); // "throw"
2027 __ push(rcx); // iter 2027 __ push(rcx);
2028 __ push(Operand(rsp, 2 * kPointerSize)); // iter
2028 __ push(rax); // exception 2029 __ push(rax); // exception
2029 __ movq(rax, rcx); // iter
2030 __ LoadRoot(rcx, Heap::kthrow_stringRootIndex); // "throw"
2031 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize();
2032 CallIC(throw_ic); // iter.throw in rax
2033 __ jmp(&l_call); 2030 __ jmp(&l_call);
2034 2031
2035 // try { received = yield result.value } 2032 // try { received = yield result.value }
2036 __ bind(&l_try); 2033 __ bind(&l_try);
2037 EmitCreateIteratorResult(false); // pop and box to rax 2034 EmitCreateIteratorResult(false); // pop and box to rax
2038 __ PushTryHandler(StackHandler::CATCH, expr->index()); 2035 __ PushTryHandler(StackHandler::CATCH, expr->index());
2039 const int handler_size = StackHandlerConstants::kSize; 2036 const int handler_size = StackHandlerConstants::kSize;
2040 __ push(rax); // result 2037 __ push(rax); // result
2041 __ push(Operand(rsp, (0 + 1) * kPointerSize + handler_size)); // g 2038 __ push(Operand(rsp, (0 + 1) * kPointerSize + handler_size)); // g
2042 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 2039 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
2043 __ movq(context_register(), 2040 __ movq(context_register(),
2044 Operand(rbp, StandardFrameConstants::kContextOffset)); 2041 Operand(rbp, StandardFrameConstants::kContextOffset));
2045 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 2042 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
2046 __ j(not_equal, &l_resume); 2043 __ j(not_equal, &l_resume);
2047 __ pop(rax); // result 2044 __ pop(rax); // result
2048 EmitReturnSequence(); 2045 EmitReturnSequence();
2049 __ bind(&l_resume); // received in rax 2046 __ bind(&l_resume); // received in rax
2050 __ PopTryHandler(); 2047 __ PopTryHandler();
2051 2048
2052 // receiver = iter; f = iter.next; arg = received; 2049 // receiver = iter; f = 'next'; arg = received;
2053 __ bind(&l_next); 2050 __ bind(&l_next);
2054 __ movq(rcx, Operand(rsp, 1 * kPointerSize)); // iter 2051 __ LoadRoot(rcx, Heap::knext_stringRootIndex); // "next"
2055 __ push(rcx); // iter 2052 __ push(rcx);
2053 __ push(Operand(rsp, 2 * kPointerSize)); // iter
2056 __ push(rax); // received 2054 __ push(rax); // received
2057 __ movq(rax, rcx); // iter
2058 __ LoadRoot(rcx, Heap::knext_stringRootIndex); // "next"
2059 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize();
2060 CallIC(next_ic); // iter.next in rax
2061 2055
2062 // result = f.call(receiver, arg); 2056 // result = receiver[f](arg);
2063 __ bind(&l_call); 2057 __ bind(&l_call);
2064 Label l_call_runtime; 2058 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(1);
2065 __ JumpIfSmi(rax, &l_call_runtime); 2059 CallIC(ic);
2066 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx);
2067 __ j(not_equal, &l_call_runtime);
2068 __ movq(rdi, rax);
2069 ParameterCount count(1);
2070 __ InvokeFunction(rdi, count, CALL_FUNCTION,
2071 NullCallWrapper(), CALL_AS_METHOD);
2072 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2060 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2073 __ jmp(&l_loop); 2061 __ Drop(1); // The key is still on the stack; drop it.
2074 __ bind(&l_call_runtime);
2075 __ push(rax);
2076 __ CallRuntime(Runtime::kCall, 3);
2077 2062
2078 // val = result.value; if (!result.done) goto l_try; 2063 // val = result.value; if (!result.done) goto l_try;
2079 __ bind(&l_loop); 2064 __ bind(&l_loop);
2080 // result.value 2065 // result.value
2081 __ push(rax); // save result 2066 __ push(rax); // save result
2082 __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value" 2067 __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value"
2083 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); 2068 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
2084 CallIC(value_ic); // result.value in rax 2069 CallIC(value_ic); // result.value in rax
2085 __ pop(rbx); // result 2070 __ pop(rbx); // result
2086 __ push(rax); // result.value 2071 __ push(rax); // result.value
(...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after
4903 *context_length = 0; 4888 *context_length = 0;
4904 return previous_; 4889 return previous_;
4905 } 4890 }
4906 4891
4907 4892
4908 #undef __ 4893 #undef __
4909 4894
4910 } } // namespace v8::internal 4895 } } // namespace v8::internal
4911 4896
4912 #endif // V8_TARGET_ARCH_X64 4897 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-2691.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698