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

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

Issue 307433004: X87: Skip write barriers in the fast case when setting up local context. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 7 months 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
« no previous file with comments | « src/x87/full-codegen-x87.cc ('k') | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "x87/lithium-codegen-x87.h" 9 #include "x87/lithium-codegen-x87.h"
10 #include "ic.h" 10 #include "ic.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 __ mov(Operand(ebp, offset), Immediate(kNoAlignmentPadding)); 214 __ mov(Operand(ebp, offset), Immediate(kNoAlignmentPadding));
215 } 215 }
216 } 216 }
217 } 217 }
218 } 218 }
219 219
220 // Possibly allocate a local context. 220 // Possibly allocate a local context.
221 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 221 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
222 if (heap_slots > 0) { 222 if (heap_slots > 0) {
223 Comment(";;; Allocate local context"); 223 Comment(";;; Allocate local context");
224 bool need_write_barrier = true;
224 // Argument to NewContext is the function, which is still in edi. 225 // Argument to NewContext is the function, which is still in edi.
225 if (heap_slots <= FastNewContextStub::kMaximumSlots) { 226 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
226 FastNewContextStub stub(isolate(), heap_slots); 227 FastNewContextStub stub(isolate(), heap_slots);
227 __ CallStub(&stub); 228 __ CallStub(&stub);
229 // Result of FastNewContextStub is always in new space.
230 need_write_barrier = false;
228 } else { 231 } else {
229 __ push(edi); 232 __ push(edi);
230 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1); 233 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
231 } 234 }
232 RecordSafepoint(Safepoint::kNoLazyDeopt); 235 RecordSafepoint(Safepoint::kNoLazyDeopt);
233 // Context is returned in eax. It replaces the context passed to us. 236 // Context is returned in eax. It replaces the context passed to us.
234 // It's saved in the stack and kept live in esi. 237 // It's saved in the stack and kept live in esi.
235 __ mov(esi, eax); 238 __ mov(esi, eax);
236 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); 239 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
237 240
238 // Copy parameters into context if necessary. 241 // Copy parameters into context if necessary.
239 int num_parameters = scope()->num_parameters(); 242 int num_parameters = scope()->num_parameters();
240 for (int i = 0; i < num_parameters; i++) { 243 for (int i = 0; i < num_parameters; i++) {
241 Variable* var = scope()->parameter(i); 244 Variable* var = scope()->parameter(i);
242 if (var->IsContextSlot()) { 245 if (var->IsContextSlot()) {
243 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 246 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
244 (num_parameters - 1 - i) * kPointerSize; 247 (num_parameters - 1 - i) * kPointerSize;
245 // Load parameter from stack. 248 // Load parameter from stack.
246 __ mov(eax, Operand(ebp, parameter_offset)); 249 __ mov(eax, Operand(ebp, parameter_offset));
247 // Store it in the context. 250 // Store it in the context.
248 int context_offset = Context::SlotOffset(var->index()); 251 int context_offset = Context::SlotOffset(var->index());
249 __ mov(Operand(esi, context_offset), eax); 252 __ mov(Operand(esi, context_offset), eax);
250 // Update the write barrier. This clobbers eax and ebx. 253 // Update the write barrier. This clobbers eax and ebx.
251 __ RecordWriteContextSlot(esi, 254 if (need_write_barrier) {
252 context_offset, 255 __ RecordWriteContextSlot(esi,
253 eax, 256 context_offset,
254 ebx); 257 eax,
258 ebx);
259 } else if (FLAG_debug_code) {
260 Label done;
261 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear);
262 __ Abort(kExpectedNewSpaceObject);
263 __ bind(&done);
264 }
255 } 265 }
256 } 266 }
257 Comment(";;; End allocate local context"); 267 Comment(";;; End allocate local context");
258 } 268 }
259 269
260 // Trace the call. 270 // Trace the call.
261 if (FLAG_trace && info()->IsOptimizing()) { 271 if (FLAG_trace && info()->IsOptimizing()) {
262 // We have not executed any compiled code yet, so esi still holds the 272 // We have not executed any compiled code yet, so esi still holds the
263 // incoming context. 273 // incoming context.
264 __ CallRuntime(Runtime::kTraceEnter, 0); 274 __ CallRuntime(Runtime::kTraceEnter, 0);
(...skipping 5435 matching lines...) Expand 10 before | Expand all | Expand 10 after
5700 __ bind(deferred->exit()); 5710 __ bind(deferred->exit());
5701 __ bind(&done); 5711 __ bind(&done);
5702 } 5712 }
5703 5713
5704 5714
5705 #undef __ 5715 #undef __
5706 5716
5707 } } // namespace v8::internal 5717 } } // namespace v8::internal
5708 5718
5709 #endif // V8_TARGET_ARCH_X87 5719 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698