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

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

Issue 297203002: 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/x64/full-codegen-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "x64/lithium-codegen-x64.h" 9 #include "x64/lithium-codegen-x64.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 if (info()->saves_caller_doubles()) { 185 if (info()->saves_caller_doubles()) {
186 SaveCallerDoubles(); 186 SaveCallerDoubles();
187 } 187 }
188 } 188 }
189 189
190 // Possibly allocate a local context. 190 // Possibly allocate a local context.
191 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 191 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
192 if (heap_slots > 0) { 192 if (heap_slots > 0) {
193 Comment(";;; Allocate local context"); 193 Comment(";;; Allocate local context");
194 bool need_write_barrier = true;
194 // Argument to NewContext is the function, which is still in rdi. 195 // Argument to NewContext is the function, which is still in rdi.
195 if (heap_slots <= FastNewContextStub::kMaximumSlots) { 196 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
196 FastNewContextStub stub(isolate(), heap_slots); 197 FastNewContextStub stub(isolate(), heap_slots);
197 __ CallStub(&stub); 198 __ CallStub(&stub);
199 // Result of FastNewContextStub is always in new space.
200 need_write_barrier = false;
198 } else { 201 } else {
199 __ Push(rdi); 202 __ Push(rdi);
200 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1); 203 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
201 } 204 }
202 RecordSafepoint(Safepoint::kNoLazyDeopt); 205 RecordSafepoint(Safepoint::kNoLazyDeopt);
203 // Context is returned in rax. It replaces the context passed to us. 206 // Context is returned in rax. It replaces the context passed to us.
204 // It's saved in the stack and kept live in rsi. 207 // It's saved in the stack and kept live in rsi.
205 __ movp(rsi, rax); 208 __ movp(rsi, rax);
206 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); 209 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax);
207 210
208 // Copy any necessary parameters into the context. 211 // Copy any necessary parameters into the context.
209 int num_parameters = scope()->num_parameters(); 212 int num_parameters = scope()->num_parameters();
210 for (int i = 0; i < num_parameters; i++) { 213 for (int i = 0; i < num_parameters; i++) {
211 Variable* var = scope()->parameter(i); 214 Variable* var = scope()->parameter(i);
212 if (var->IsContextSlot()) { 215 if (var->IsContextSlot()) {
213 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 216 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
214 (num_parameters - 1 - i) * kPointerSize; 217 (num_parameters - 1 - i) * kPointerSize;
215 // Load parameter from stack. 218 // Load parameter from stack.
216 __ movp(rax, Operand(rbp, parameter_offset)); 219 __ movp(rax, Operand(rbp, parameter_offset));
217 // Store it in the context. 220 // Store it in the context.
218 int context_offset = Context::SlotOffset(var->index()); 221 int context_offset = Context::SlotOffset(var->index());
219 __ movp(Operand(rsi, context_offset), rax); 222 __ movp(Operand(rsi, context_offset), rax);
220 // Update the write barrier. This clobbers rax and rbx. 223 // Update the write barrier. This clobbers rax and rbx.
221 __ RecordWriteContextSlot(rsi, context_offset, rax, rbx, kSaveFPRegs); 224 if (need_write_barrier) {
225 __ RecordWriteContextSlot(rsi, context_offset, rax, rbx, kSaveFPRegs);
226 } else if (FLAG_debug_code) {
227 Label done;
228 __ JumpIfInNewSpace(rsi, rax, &done, Label::kNear);
229 __ Abort(kExpectedNewSpaceObject);
230 __ bind(&done);
231 }
222 } 232 }
223 } 233 }
224 Comment(";;; End allocate local context"); 234 Comment(";;; End allocate local context");
225 } 235 }
226 236
227 // Trace the call. 237 // Trace the call.
228 if (FLAG_trace && info()->IsOptimizing()) { 238 if (FLAG_trace && info()->IsOptimizing()) {
229 __ CallRuntime(Runtime::kTraceEnter, 0); 239 __ CallRuntime(Runtime::kTraceEnter, 0);
230 } 240 }
231 return !is_aborted(); 241 return !is_aborted();
(...skipping 5468 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_X64 5719 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698