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

Side by Side Diff: src/arm64/full-codegen-arm64.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, 6 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/arm/lithium-codegen-arm.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('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 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 } 205 }
206 } 206 }
207 207
208 bool function_in_register_x1 = true; 208 bool function_in_register_x1 = true;
209 209
210 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 210 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
211 if (heap_slots > 0) { 211 if (heap_slots > 0) {
212 // Argument to NewContext is the function, which is still in x1. 212 // Argument to NewContext is the function, which is still in x1.
213 Comment cmnt(masm_, "[ Allocate context"); 213 Comment cmnt(masm_, "[ Allocate context");
214 bool need_write_barrier = true;
214 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 215 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
215 __ Mov(x10, Operand(info->scope()->GetScopeInfo())); 216 __ Mov(x10, Operand(info->scope()->GetScopeInfo()));
216 __ Push(x1, x10); 217 __ Push(x1, x10);
217 __ CallRuntime(Runtime::kHiddenNewGlobalContext, 2); 218 __ CallRuntime(Runtime::kHiddenNewGlobalContext, 2);
218 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 219 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
219 FastNewContextStub stub(isolate(), heap_slots); 220 FastNewContextStub stub(isolate(), heap_slots);
220 __ CallStub(&stub); 221 __ CallStub(&stub);
222 // Result of FastNewContextStub is always in new space.
223 need_write_barrier = false;
221 } else { 224 } else {
222 __ Push(x1); 225 __ Push(x1);
223 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1); 226 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
224 } 227 }
225 function_in_register_x1 = false; 228 function_in_register_x1 = false;
226 // Context is returned in x0. It replaces the context passed to us. 229 // Context is returned in x0. It replaces the context passed to us.
227 // It's saved in the stack and kept live in cp. 230 // It's saved in the stack and kept live in cp.
228 __ Mov(cp, x0); 231 __ Mov(cp, x0);
229 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 232 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset));
230 // Copy any necessary parameters into the context. 233 // Copy any necessary parameters into the context.
231 int num_parameters = info->scope()->num_parameters(); 234 int num_parameters = info->scope()->num_parameters();
232 for (int i = 0; i < num_parameters; i++) { 235 for (int i = 0; i < num_parameters; i++) {
233 Variable* var = scope()->parameter(i); 236 Variable* var = scope()->parameter(i);
234 if (var->IsContextSlot()) { 237 if (var->IsContextSlot()) {
235 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 238 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
236 (num_parameters - 1 - i) * kPointerSize; 239 (num_parameters - 1 - i) * kPointerSize;
237 // Load parameter from stack. 240 // Load parameter from stack.
238 __ Ldr(x10, MemOperand(fp, parameter_offset)); 241 __ Ldr(x10, MemOperand(fp, parameter_offset));
239 // Store it in the context. 242 // Store it in the context.
240 MemOperand target = ContextMemOperand(cp, var->index()); 243 MemOperand target = ContextMemOperand(cp, var->index());
241 __ Str(x10, target); 244 __ Str(x10, target);
242 245
243 // Update the write barrier. 246 // Update the write barrier.
244 __ RecordWriteContextSlot( 247 if (need_write_barrier) {
245 cp, target.offset(), x10, x11, kLRHasBeenSaved, kDontSaveFPRegs); 248 __ RecordWriteContextSlot(
249 cp, target.offset(), x10, x11, kLRHasBeenSaved, kDontSaveFPRegs);
250 } else if (FLAG_debug_code) {
251 Label done;
252 __ JumpIfInNewSpace(cp, &done);
253 __ Abort(kExpectedNewSpaceObject);
254 __ bind(&done);
255 }
246 } 256 }
247 } 257 }
248 } 258 }
249 259
250 Variable* arguments = scope()->arguments(); 260 Variable* arguments = scope()->arguments();
251 if (arguments != NULL) { 261 if (arguments != NULL) {
252 // Function uses arguments object. 262 // Function uses arguments object.
253 Comment cmnt(masm_, "[ Allocate arguments object"); 263 Comment cmnt(masm_, "[ Allocate arguments object");
254 if (!function_in_register_x1) { 264 if (!function_in_register_x1) {
255 // Load this again, if it's used by the local context below. 265 // Load this again, if it's used by the local context below.
(...skipping 4630 matching lines...) Expand 10 before | Expand all | Expand 10 after
4886 return previous_; 4896 return previous_;
4887 } 4897 }
4888 4898
4889 4899
4890 #undef __ 4900 #undef __
4891 4901
4892 4902
4893 } } // namespace v8::internal 4903 } } // namespace v8::internal
4894 4904
4895 #endif // V8_TARGET_ARCH_ARM64 4905 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698