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 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 1952 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); |
1953 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 1953 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); |
1954 __ cmp(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset), | 1954 __ cmp(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset), |
1955 Immediate(Smi::FromInt(0))); | 1955 Immediate(Smi::FromInt(0))); |
1956 __ j(less_equal, &wrong_state); | 1956 __ j(less_equal, &wrong_state); |
1957 | 1957 |
1958 // Load suspended function and context. | 1958 // Load suspended function and context. |
1959 __ mov(esi, FieldOperand(ebx, JSGeneratorObject::kContextOffset)); | 1959 __ mov(esi, FieldOperand(ebx, JSGeneratorObject::kContextOffset)); |
1960 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); | 1960 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); |
1961 | 1961 |
| 1962 // Push receiver. |
| 1963 __ push(FieldOperand(ebx, JSGeneratorObject::kReceiverOffset)); |
| 1964 |
1962 // Push holes for arguments to generator function. | 1965 // Push holes for arguments to generator function. |
1963 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 1966 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
1964 __ mov(edx, | 1967 __ mov(edx, |
1965 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); | 1968 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
1966 __ mov(ecx, isolate()->factory()->the_hole_value()); | 1969 __ mov(ecx, isolate()->factory()->the_hole_value()); |
1967 Label push_argument_holes; | 1970 Label push_argument_holes, push_frame; |
1968 __ bind(&push_argument_holes); | 1971 __ bind(&push_argument_holes); |
| 1972 __ sub(edx, Immediate(1)); |
| 1973 __ j(carry, &push_frame); |
1969 __ push(ecx); | 1974 __ push(ecx); |
1970 __ sub(edx, Immediate(1)); | 1975 __ jmp(&push_argument_holes); |
1971 __ j(not_carry, &push_argument_holes); | |
1972 | 1976 |
1973 // Enter a new JavaScript frame, and initialize its slots as they were when | 1977 // Enter a new JavaScript frame, and initialize its slots as they were when |
1974 // the generator was suspended. | 1978 // the generator was suspended. |
1975 Label push_frame, resume_frame; | 1979 Label resume_frame; |
1976 __ bind(&push_frame); | 1980 __ bind(&push_frame); |
1977 __ call(&resume_frame); | 1981 __ call(&resume_frame); |
1978 __ jmp(&done); | 1982 __ jmp(&done); |
1979 __ bind(&resume_frame); | 1983 __ bind(&resume_frame); |
1980 __ push(ebp); // Caller's frame pointer. | 1984 __ push(ebp); // Caller's frame pointer. |
1981 __ mov(ebp, esp); | 1985 __ mov(ebp, esp); |
1982 __ push(esi); // Callee's context. | 1986 __ push(esi); // Callee's context. |
1983 __ push(edi); // Callee's JS Function. | 1987 __ push(edi); // Callee's JS Function. |
1984 | 1988 |
1985 // Load the operand stack size. | 1989 // Load the operand stack size. |
(...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4689 *stack_depth = 0; | 4693 *stack_depth = 0; |
4690 *context_length = 0; | 4694 *context_length = 0; |
4691 return previous_; | 4695 return previous_; |
4692 } | 4696 } |
4693 | 4697 |
4694 #undef __ | 4698 #undef __ |
4695 | 4699 |
4696 } } // namespace v8::internal | 4700 } } // namespace v8::internal |
4697 | 4701 |
4698 #endif // V8_TARGET_ARCH_IA32 | 4702 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |