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

Side by Side Diff: src/ia32/full-codegen-ia32.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/arm/full-codegen-arm.cc ('k') | src/x64/full-codegen-x64.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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 1989
1990 // Initial stack layout is as follows: 1990 // Initial stack layout is as follows:
1991 // [sp + 1 * kPointerSize] iter 1991 // [sp + 1 * kPointerSize] iter
1992 // [sp + 0 * kPointerSize] g 1992 // [sp + 0 * kPointerSize] g
1993 1993
1994 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; 1994 Label l_catch, l_try, l_resume, l_next, l_call, l_loop;
1995 // Initial send value is undefined. 1995 // Initial send value is undefined.
1996 __ mov(eax, isolate()->factory()->undefined_value()); 1996 __ mov(eax, isolate()->factory()->undefined_value());
1997 __ jmp(&l_next); 1997 __ jmp(&l_next);
1998 1998
1999 // catch (e) { receiver = iter; f = iter.throw; arg = e; goto l_call; } 1999 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; }
2000 __ bind(&l_catch); 2000 __ bind(&l_catch);
2001 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); 2001 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
2002 __ mov(edx, Operand(esp, 1 * kPointerSize)); // iter 2002 __ mov(ecx, isolate()->factory()->throw_string()); // "throw"
2003 __ push(edx); // iter 2003 __ push(ecx); // "throw"
2004 __ push(Operand(esp, 2 * kPointerSize)); // iter
2004 __ push(eax); // exception 2005 __ push(eax); // exception
2005 __ mov(ecx, isolate()->factory()->throw_string()); // "throw"
2006 Handle<Code> throw_ic = isolate()->builtins()->LoadIC_Initialize();
2007 CallIC(throw_ic); // iter.throw in eax
2008 __ jmp(&l_call); 2006 __ jmp(&l_call);
2009 2007
2010 // try { received = yield result.value } 2008 // try { received = yield result.value }
2011 __ bind(&l_try); 2009 __ bind(&l_try);
2012 EmitCreateIteratorResult(false); // pop and box to eax 2010 EmitCreateIteratorResult(false); // pop and box to eax
2013 __ PushTryHandler(StackHandler::CATCH, expr->index()); 2011 __ PushTryHandler(StackHandler::CATCH, expr->index());
2014 const int handler_size = StackHandlerConstants::kSize; 2012 const int handler_size = StackHandlerConstants::kSize;
2015 __ push(eax); // result 2013 __ push(eax); // result
2016 __ push(Operand(esp, (0 + 1) * kPointerSize + handler_size)); // g 2014 __ push(Operand(esp, (0 + 1) * kPointerSize + handler_size)); // g
2017 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 2015 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
2018 __ mov(context_register(), 2016 __ mov(context_register(),
2019 Operand(ebp, StandardFrameConstants::kContextOffset)); 2017 Operand(ebp, StandardFrameConstants::kContextOffset));
2020 __ CompareRoot(eax, Heap::kTheHoleValueRootIndex); 2018 __ CompareRoot(eax, Heap::kTheHoleValueRootIndex);
2021 __ j(not_equal, &l_resume); 2019 __ j(not_equal, &l_resume);
2022 __ pop(eax); // result 2020 __ pop(eax); // result
2023 EmitReturnSequence(); 2021 EmitReturnSequence();
2024 __ bind(&l_resume); // received in eax 2022 __ bind(&l_resume); // received in eax
2025 __ PopTryHandler(); 2023 __ PopTryHandler();
2026 2024
2027 // receiver = iter; f = iter.next; arg = received; 2025 // receiver = iter; f = iter.next; arg = received;
2028 __ bind(&l_next); 2026 __ bind(&l_next);
2029 __ mov(edx, Operand(esp, 1 * kPointerSize)); // iter 2027 __ mov(ecx, isolate()->factory()->next_string()); // "next"
2030 __ push(edx); // iter 2028 __ push(ecx);
2029 __ push(Operand(esp, 2 * kPointerSize)); // iter
2031 __ push(eax); // received 2030 __ push(eax); // received
2032 __ mov(ecx, isolate()->factory()->next_string()); // "next"
2033 Handle<Code> next_ic = isolate()->builtins()->LoadIC_Initialize();
2034 CallIC(next_ic); // iter.next in eax
2035 2031
2036 // result = f.call(receiver, arg); 2032 // result = receiver[f](arg);
2037 __ bind(&l_call); 2033 __ bind(&l_call);
2038 Label l_call_runtime; 2034 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(1);
2039 __ JumpIfSmi(eax, &l_call_runtime); 2035 CallIC(ic);
2040 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
2041 __ j(not_equal, &l_call_runtime);
2042 __ mov(edi, eax);
2043 ParameterCount count(1);
2044 __ InvokeFunction(edi, count, CALL_FUNCTION,
2045 NullCallWrapper(), CALL_AS_METHOD);
2046 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2036 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2047 __ jmp(&l_loop); 2037 __ Drop(1); // The key is still on the stack; drop it.
2048 __ bind(&l_call_runtime);
2049 __ push(eax);
2050 __ CallRuntime(Runtime::kCall, 3);
2051 2038
2052 // val = result.value; if (!result.done) goto l_try; 2039 // val = result.value; if (!result.done) goto l_try;
2053 __ bind(&l_loop); 2040 __ bind(&l_loop);
2054 // result.value 2041 // result.value
2055 __ push(eax); // save result 2042 __ push(eax); // save result
2056 __ mov(edx, eax); // result 2043 __ mov(edx, eax); // result
2057 __ mov(ecx, isolate()->factory()->value_string()); // "value" 2044 __ mov(ecx, isolate()->factory()->value_string()); // "value"
2058 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize(); 2045 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
2059 CallIC(value_ic); // result.value in eax 2046 CallIC(value_ic); // result.value in eax
2060 __ pop(ebx); // result 2047 __ pop(ebx); // result
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after
4913 *stack_depth = 0; 4900 *stack_depth = 0;
4914 *context_length = 0; 4901 *context_length = 0;
4915 return previous_; 4902 return previous_;
4916 } 4903 }
4917 4904
4918 #undef __ 4905 #undef __
4919 4906
4920 } } // namespace v8::internal 4907 } } // namespace v8::internal
4921 4908
4922 #endif // V8_TARGET_ARCH_IA32 4909 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698