| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 133 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 134 __ int3(); | 134 __ int3(); |
| 135 } | 135 } |
| 136 #endif | 136 #endif |
| 137 | 137 |
| 138 // Strict mode functions and builtins need to replace the receiver | 138 // Strict mode functions and builtins need to replace the receiver |
| 139 // with undefined when called as functions (without an explicit | 139 // with undefined when called as functions (without an explicit |
| 140 // receiver object). ecx is zero for method calls and non-zero for | 140 // receiver object). ecx is zero for method calls and non-zero for |
| 141 // function calls. | 141 // function calls. |
| 142 if (!info_->is_classic_mode() || info_->is_native()) { | 142 if (!info_->is_classic_mode() || info_->is_native()) { |
| 143 Label begin; |
| 144 __ bind(&begin); |
| 143 Label ok; | 145 Label ok; |
| 144 __ test(ecx, Operand(ecx)); | 146 __ test(ecx, Operand(ecx)); |
| 145 __ j(zero, &ok, Label::kNear); | 147 __ j(zero, &ok, Label::kNear); |
| 146 // +1 for return address. | 148 // +1 for return address. |
| 147 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 149 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
| 148 __ mov(Operand(esp, receiver_offset), | 150 __ mov(Operand(esp, receiver_offset), |
| 149 Immediate(isolate()->factory()->undefined_value())); | 151 Immediate(isolate()->factory()->undefined_value())); |
| 150 __ bind(&ok); | 152 __ bind(&ok); |
| 153 ASSERT_EQ(kSizeOfOptimizedStrictModePrologue, ok.pos() - begin.pos()); |
| 151 } | 154 } |
| 152 | 155 |
| 153 | 156 |
| 154 if (dynamic_frame_alignment_) { | 157 if (dynamic_frame_alignment_) { |
| 158 Label begin; |
| 159 __ bind(&begin); |
| 155 // Move state of dynamic frame alignment into edx. | 160 // Move state of dynamic frame alignment into edx. |
| 156 __ mov(edx, Immediate(kNoAlignmentPadding)); | 161 __ mov(edx, Immediate(kNoAlignmentPadding)); |
| 157 | 162 |
| 158 Label do_not_pad, align_loop; | 163 Label do_not_pad, align_loop; |
| 159 STATIC_ASSERT(kDoubleSize == 2 * kPointerSize); | 164 STATIC_ASSERT(kDoubleSize == 2 * kPointerSize); |
| 160 // Align esp + 4 to a multiple of 2 * kPointerSize. | 165 // Align esp + 4 to a multiple of 2 * kPointerSize. |
| 161 __ test(esp, Immediate(kPointerSize)); | 166 __ test(esp, Immediate(kPointerSize)); |
| 162 __ j(not_zero, &do_not_pad, Label::kNear); | 167 __ j(not_zero, &do_not_pad, Label::kNear); |
| 163 __ push(Immediate(0)); | 168 __ push(Immediate(0)); |
| 164 __ mov(ebx, esp); | 169 __ mov(ebx, esp); |
| 165 __ mov(edx, Immediate(kAlignmentPaddingPushed)); | 170 __ mov(edx, Immediate(kAlignmentPaddingPushed)); |
| 166 // Copy arguments, receiver, and return address. | 171 // Copy arguments, receiver, and return address. |
| 167 __ mov(ecx, Immediate(scope()->num_parameters() + 2)); | 172 __ mov(ecx, Immediate(scope()->num_parameters() + 2)); |
| 168 | 173 |
| 169 __ bind(&align_loop); | 174 __ bind(&align_loop); |
| 170 __ mov(eax, Operand(ebx, 1 * kPointerSize)); | 175 __ mov(eax, Operand(ebx, 1 * kPointerSize)); |
| 171 __ mov(Operand(ebx, 0), eax); | 176 __ mov(Operand(ebx, 0), eax); |
| 172 __ add(Operand(ebx), Immediate(kPointerSize)); | 177 __ add(Operand(ebx), Immediate(kPointerSize)); |
| 173 __ dec(ecx); | 178 __ dec(ecx); |
| 174 __ j(not_zero, &align_loop, Label::kNear); | 179 __ j(not_zero, &align_loop, Label::kNear); |
| 175 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); | 180 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); |
| 176 __ bind(&do_not_pad); | 181 __ bind(&do_not_pad); |
| 182 ASSERT_EQ(kSizeOfOptimizedAlignStackPrologue, |
| 183 do_not_pad.pos() - begin.pos()); |
| 177 } | 184 } |
| 178 | 185 |
| 179 __ push(ebp); // Caller's frame pointer. | 186 __ push(ebp); // Caller's frame pointer. |
| 180 __ mov(ebp, esp); | 187 __ mov(ebp, esp); |
| 181 __ push(esi); // Callee's context. | 188 __ push(esi); // Callee's context. |
| 182 __ push(edi); // Callee's JS function. | 189 __ push(edi); // Callee's JS function. |
| 183 | 190 |
| 184 if (dynamic_frame_alignment_ && FLAG_debug_code) { | 191 if (dynamic_frame_alignment_ && FLAG_debug_code) { |
| 185 __ test(esp, Immediate(kPointerSize)); | 192 __ test(esp, Immediate(kPointerSize)); |
| 186 __ Assert(zero, "frame is expected to be aligned"); | 193 __ Assert(zero, "frame is expected to be aligned"); |
| (...skipping 5385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5572 FixedArray::kHeaderSize - kPointerSize)); | 5579 FixedArray::kHeaderSize - kPointerSize)); |
| 5573 __ bind(&done); | 5580 __ bind(&done); |
| 5574 } | 5581 } |
| 5575 | 5582 |
| 5576 | 5583 |
| 5577 #undef __ | 5584 #undef __ |
| 5578 | 5585 |
| 5579 } } // namespace v8::internal | 5586 } } // namespace v8::internal |
| 5580 | 5587 |
| 5581 #endif // V8_TARGET_ARCH_IA32 | 5588 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |