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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 11316218: Simplify and fix code aging. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed comment and rebased. Created 8 years 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/ia32/full-codegen-ia32.cc ('k') | src/mips/codegen-mips.h » ('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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
145 Label ok; 143 Label ok;
146 __ test(ecx, Operand(ecx)); 144 __ test(ecx, Operand(ecx));
147 __ j(zero, &ok, Label::kNear); 145 __ j(zero, &ok, Label::kNear);
148 // +1 for return address. 146 // +1 for return address.
149 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; 147 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize;
150 __ mov(Operand(esp, receiver_offset), 148 __ mov(Operand(esp, receiver_offset),
151 Immediate(isolate()->factory()->undefined_value())); 149 Immediate(isolate()->factory()->undefined_value()));
152 __ bind(&ok); 150 __ bind(&ok);
153 ASSERT(!FLAG_age_code ||
154 (kSizeOfOptimizedStrictModePrologue == ok.pos() - begin.pos()));
155 } 151 }
156 152
157 153
158 if (dynamic_frame_alignment_) { 154 if (dynamic_frame_alignment_) {
159 Label begin;
160 __ bind(&begin);
161 // Move state of dynamic frame alignment into edx. 155 // Move state of dynamic frame alignment into edx.
162 __ mov(edx, Immediate(kNoAlignmentPadding)); 156 __ mov(edx, Immediate(kNoAlignmentPadding));
163 157
164 Label do_not_pad, align_loop; 158 Label do_not_pad, align_loop;
165 STATIC_ASSERT(kDoubleSize == 2 * kPointerSize); 159 STATIC_ASSERT(kDoubleSize == 2 * kPointerSize);
166 // Align esp + 4 to a multiple of 2 * kPointerSize. 160 // Align esp + 4 to a multiple of 2 * kPointerSize.
167 __ test(esp, Immediate(kPointerSize)); 161 __ test(esp, Immediate(kPointerSize));
168 __ j(not_zero, &do_not_pad, Label::kNear); 162 __ j(not_zero, &do_not_pad, Label::kNear);
169 __ push(Immediate(0)); 163 __ push(Immediate(0));
170 __ mov(ebx, esp); 164 __ mov(ebx, esp);
171 __ mov(edx, Immediate(kAlignmentPaddingPushed)); 165 __ mov(edx, Immediate(kAlignmentPaddingPushed));
172 // Copy arguments, receiver, and return address. 166 // Copy arguments, receiver, and return address.
173 __ mov(ecx, Immediate(scope()->num_parameters() + 2)); 167 __ mov(ecx, Immediate(scope()->num_parameters() + 2));
174 168
175 __ bind(&align_loop); 169 __ bind(&align_loop);
176 __ mov(eax, Operand(ebx, 1 * kPointerSize)); 170 __ mov(eax, Operand(ebx, 1 * kPointerSize));
177 __ mov(Operand(ebx, 0), eax); 171 __ mov(Operand(ebx, 0), eax);
178 __ add(Operand(ebx), Immediate(kPointerSize)); 172 __ add(Operand(ebx), Immediate(kPointerSize));
179 __ dec(ecx); 173 __ dec(ecx);
180 __ j(not_zero, &align_loop, Label::kNear); 174 __ j(not_zero, &align_loop, Label::kNear);
181 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); 175 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue));
182 __ bind(&do_not_pad); 176 __ bind(&do_not_pad);
183 ASSERT(!FLAG_age_code ||
184 (kSizeOfOptimizedAlignStackPrologue ==
185 do_not_pad.pos() - begin.pos()));
186 } 177 }
187 178
179 info()->set_prologue_offset(masm_->pc_offset());
188 __ push(ebp); // Caller's frame pointer. 180 __ push(ebp); // Caller's frame pointer.
189 __ mov(ebp, esp); 181 __ mov(ebp, esp);
190 __ push(esi); // Callee's context. 182 __ push(esi); // Callee's context.
191 __ push(edi); // Callee's JS function. 183 __ push(edi); // Callee's JS function.
192 184
193 if (dynamic_frame_alignment_ && FLAG_debug_code) { 185 if (dynamic_frame_alignment_ && FLAG_debug_code) {
194 __ test(esp, Immediate(kPointerSize)); 186 __ test(esp, Immediate(kPointerSize));
195 __ Assert(zero, "frame is expected to be aligned"); 187 __ Assert(zero, "frame is expected to be aligned");
196 } 188 }
197 189
(...skipping 5422 matching lines...) Expand 10 before | Expand all | Expand 10 after
5620 FixedArray::kHeaderSize - kPointerSize)); 5612 FixedArray::kHeaderSize - kPointerSize));
5621 __ bind(&done); 5613 __ bind(&done);
5622 } 5614 }
5623 5615
5624 5616
5625 #undef __ 5617 #undef __
5626 5618
5627 } } // namespace v8::internal 5619 } } // namespace v8::internal
5628 5620
5629 #endif // V8_TARGET_ARCH_IA32 5621 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/mips/codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698