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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 __ int3(); | 131 __ int3(); |
132 } | 132 } |
133 #endif | 133 #endif |
134 | 134 |
135 // Strict mode functions and builtins need to replace the receiver | 135 // Strict mode functions and builtins need to replace the receiver |
136 // with undefined when called as functions (without an explicit | 136 // with undefined when called as functions (without an explicit |
137 // receiver object). ecx is zero for method calls and non-zero for | 137 // receiver object). ecx is zero for method calls and non-zero for |
138 // function calls. | 138 // function calls. |
139 if (!info->is_classic_mode() || info->is_native()) { | 139 if (!info->is_classic_mode() || info->is_native()) { |
140 Label ok; | 140 Label ok; |
141 Label start; | |
142 __ bind(&start); | |
143 __ test(ecx, ecx); | 141 __ test(ecx, ecx); |
144 __ j(zero, &ok, Label::kNear); | 142 __ j(zero, &ok, Label::kNear); |
145 // +1 for return address. | 143 // +1 for return address. |
146 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 144 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; |
147 __ mov(ecx, Operand(esp, receiver_offset)); | 145 __ mov(ecx, Operand(esp, receiver_offset)); |
148 __ JumpIfSmi(ecx, &ok); | 146 __ JumpIfSmi(ecx, &ok); |
149 __ CmpObjectType(ecx, JS_GLOBAL_PROXY_TYPE, ecx); | 147 __ CmpObjectType(ecx, JS_GLOBAL_PROXY_TYPE, ecx); |
150 __ j(not_equal, &ok, Label::kNear); | 148 __ j(not_equal, &ok, Label::kNear); |
151 __ mov(Operand(esp, receiver_offset), | 149 __ mov(Operand(esp, receiver_offset), |
152 Immediate(isolate()->factory()->undefined_value())); | 150 Immediate(isolate()->factory()->undefined_value())); |
153 __ bind(&ok); | 151 __ bind(&ok); |
154 ASSERT(!FLAG_age_code || | |
155 (kSizeOfFullCodegenStrictModePrologue == ok.pos() - start.pos())); | |
156 } | 152 } |
157 | 153 |
158 // Open a frame scope to indicate that there is a frame on the stack. The | 154 // Open a frame scope to indicate that there is a frame on the stack. The |
159 // MANUAL indicates that the scope shouldn't actually generate code to set up | 155 // MANUAL indicates that the scope shouldn't actually generate code to set up |
160 // the frame (that is done below). | 156 // the frame (that is done below). |
161 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 157 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
162 | 158 |
| 159 info->set_prologue_offset(masm_->pc_offset()); |
163 __ push(ebp); // Caller's frame pointer. | 160 __ push(ebp); // Caller's frame pointer. |
164 __ mov(ebp, esp); | 161 __ mov(ebp, esp); |
165 __ push(esi); // Callee's context. | 162 __ push(esi); // Callee's context. |
166 __ push(edi); // Callee's JS Function. | 163 __ push(edi); // Callee's JS Function. |
167 | 164 |
168 { Comment cmnt(masm_, "[ Allocate locals"); | 165 { Comment cmnt(masm_, "[ Allocate locals"); |
169 int locals_count = info->scope()->num_stack_slots(); | 166 int locals_count = info->scope()->num_stack_slots(); |
170 if (locals_count == 1) { | 167 if (locals_count == 1) { |
171 __ push(Immediate(isolate()->factory()->undefined_value())); | 168 __ push(Immediate(isolate()->factory()->undefined_value())); |
172 } else if (locals_count > 1) { | 169 } else if (locals_count > 1) { |
(...skipping 4331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4504 *stack_depth = 0; | 4501 *stack_depth = 0; |
4505 *context_length = 0; | 4502 *context_length = 0; |
4506 return previous_; | 4503 return previous_; |
4507 } | 4504 } |
4508 | 4505 |
4509 #undef __ | 4506 #undef __ |
4510 | 4507 |
4511 } } // namespace v8::internal | 4508 } } // namespace v8::internal |
4512 | 4509 |
4513 #endif // V8_TARGET_ARCH_IA32 | 4510 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |