OLD | NEW |
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 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1976 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 1976 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); |
1977 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 1977 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); |
1978 __ SmiCompare(FieldOperand(rbx, JSGeneratorObject::kContinuationOffset), | 1978 __ SmiCompare(FieldOperand(rbx, JSGeneratorObject::kContinuationOffset), |
1979 Smi::FromInt(0)); | 1979 Smi::FromInt(0)); |
1980 __ j(less_equal, &wrong_state); | 1980 __ j(less_equal, &wrong_state); |
1981 | 1981 |
1982 // Load suspended function and context. | 1982 // Load suspended function and context. |
1983 __ movq(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); | 1983 __ movq(rsi, FieldOperand(rbx, JSGeneratorObject::kContextOffset)); |
1984 __ movq(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); | 1984 __ movq(rdi, FieldOperand(rbx, JSGeneratorObject::kFunctionOffset)); |
1985 | 1985 |
| 1986 // Push receiver. |
| 1987 __ push(FieldOperand(rbx, JSGeneratorObject::kReceiverOffset)); |
| 1988 |
1986 // Push holes for arguments to generator function. | 1989 // Push holes for arguments to generator function. |
1987 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 1990 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
1988 __ movsxlq(rdx, | 1991 __ movsxlq(rdx, |
1989 FieldOperand(rdx, | 1992 FieldOperand(rdx, |
1990 SharedFunctionInfo::kFormalParameterCountOffset)); | 1993 SharedFunctionInfo::kFormalParameterCountOffset)); |
1991 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex); | 1994 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex); |
1992 Label push_argument_holes; | 1995 Label push_argument_holes, push_frame; |
1993 __ bind(&push_argument_holes); | 1996 __ bind(&push_argument_holes); |
| 1997 __ subq(rdx, Immediate(1)); |
| 1998 __ j(carry, &push_frame); |
1994 __ push(rcx); | 1999 __ push(rcx); |
1995 __ subq(rdx, Immediate(1)); | 2000 __ jmp(&push_argument_holes); |
1996 __ j(not_carry, &push_argument_holes); | |
1997 | 2001 |
1998 // Enter a new JavaScript frame, and initialize its slots as they were when | 2002 // Enter a new JavaScript frame, and initialize its slots as they were when |
1999 // the generator was suspended. | 2003 // the generator was suspended. |
2000 Label push_frame, resume_frame; | 2004 Label resume_frame; |
2001 __ bind(&push_frame); | 2005 __ bind(&push_frame); |
2002 __ call(&resume_frame); | 2006 __ call(&resume_frame); |
2003 __ jmp(&done); | 2007 __ jmp(&done); |
2004 __ bind(&resume_frame); | 2008 __ bind(&resume_frame); |
2005 __ push(rbp); // Caller's frame pointer. | 2009 __ push(rbp); // Caller's frame pointer. |
2006 __ movq(rbp, rsp); | 2010 __ movq(rbp, rsp); |
2007 __ push(rsi); // Callee's context. | 2011 __ push(rsi); // Callee's context. |
2008 __ push(rdi); // Callee's JS Function. | 2012 __ push(rdi); // Callee's JS Function. |
2009 | 2013 |
2010 // Load the operand stack size. | 2014 // Load the operand stack size. |
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4679 *context_length = 0; | 4683 *context_length = 0; |
4680 return previous_; | 4684 return previous_; |
4681 } | 4685 } |
4682 | 4686 |
4683 | 4687 |
4684 #undef __ | 4688 #undef __ |
4685 | 4689 |
4686 } } // namespace v8::internal | 4690 } } // namespace v8::internal |
4687 | 4691 |
4688 #endif // V8_TARGET_ARCH_X64 | 4692 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |