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

Side by Side Diff: src/ia32/full-codegen-ia32.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/arm64/lithium-codegen-arm64.cc ('k') | src/ia32/lithium-codegen-ia32.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 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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 bool function_in_register = true; 195 bool function_in_register = true;
196 196
197 // Possibly allocate a local context. 197 // Possibly allocate a local context.
198 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 198 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
199 if (heap_slots > 0) { 199 if (heap_slots > 0) {
200 Comment cmnt(masm_, "[ Allocate context"); 200 Comment cmnt(masm_, "[ Allocate context");
201 bool need_write_barrier = true;
201 // Argument to NewContext is the function, which is still in edi. 202 // Argument to NewContext is the function, which is still in edi.
202 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 203 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
203 __ push(edi); 204 __ push(edi);
204 __ Push(info->scope()->GetScopeInfo()); 205 __ Push(info->scope()->GetScopeInfo());
205 __ CallRuntime(Runtime::kHiddenNewGlobalContext, 2); 206 __ CallRuntime(Runtime::kHiddenNewGlobalContext, 2);
206 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 207 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
207 FastNewContextStub stub(isolate(), heap_slots); 208 FastNewContextStub stub(isolate(), heap_slots);
208 __ CallStub(&stub); 209 __ CallStub(&stub);
210 // Result of FastNewContextStub is always in new space.
211 need_write_barrier = false;
209 } else { 212 } else {
210 __ push(edi); 213 __ push(edi);
211 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1); 214 __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
212 } 215 }
213 function_in_register = false; 216 function_in_register = false;
214 // Context is returned in eax. It replaces the context passed to us. 217 // Context is returned in eax. It replaces the context passed to us.
215 // It's saved in the stack and kept live in esi. 218 // It's saved in the stack and kept live in esi.
216 __ mov(esi, eax); 219 __ mov(esi, eax);
217 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); 220 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
218 221
219 // Copy parameters into context if necessary. 222 // Copy parameters into context if necessary.
220 int num_parameters = info->scope()->num_parameters(); 223 int num_parameters = info->scope()->num_parameters();
221 for (int i = 0; i < num_parameters; i++) { 224 for (int i = 0; i < num_parameters; i++) {
222 Variable* var = scope()->parameter(i); 225 Variable* var = scope()->parameter(i);
223 if (var->IsContextSlot()) { 226 if (var->IsContextSlot()) {
224 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 227 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
225 (num_parameters - 1 - i) * kPointerSize; 228 (num_parameters - 1 - i) * kPointerSize;
226 // Load parameter from stack. 229 // Load parameter from stack.
227 __ mov(eax, Operand(ebp, parameter_offset)); 230 __ mov(eax, Operand(ebp, parameter_offset));
228 // Store it in the context. 231 // Store it in the context.
229 int context_offset = Context::SlotOffset(var->index()); 232 int context_offset = Context::SlotOffset(var->index());
230 __ mov(Operand(esi, context_offset), eax); 233 __ mov(Operand(esi, context_offset), eax);
231 // Update the write barrier. This clobbers eax and ebx. 234 // Update the write barrier. This clobbers eax and ebx.
232 __ RecordWriteContextSlot(esi, 235 if (need_write_barrier) {
233 context_offset, 236 __ RecordWriteContextSlot(esi,
234 eax, 237 context_offset,
235 ebx, 238 eax,
236 kDontSaveFPRegs); 239 ebx,
240 kDontSaveFPRegs);
241 } else if (FLAG_debug_code) {
242 Label done;
243 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear);
244 __ Abort(kExpectedNewSpaceObject);
245 __ bind(&done);
246 }
237 } 247 }
238 } 248 }
239 } 249 }
240 250
241 Variable* arguments = scope()->arguments(); 251 Variable* arguments = scope()->arguments();
242 if (arguments != NULL) { 252 if (arguments != NULL) {
243 // Function uses arguments object. 253 // Function uses arguments object.
244 Comment cmnt(masm_, "[ Allocate arguments object"); 254 Comment cmnt(masm_, "[ Allocate arguments object");
245 if (function_in_register) { 255 if (function_in_register) {
246 __ push(edi); 256 __ push(edi);
(...skipping 4546 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4803 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4794 Assembler::target_address_at(call_target_address, 4804 Assembler::target_address_at(call_target_address,
4795 unoptimized_code)); 4805 unoptimized_code));
4796 return OSR_AFTER_STACK_CHECK; 4806 return OSR_AFTER_STACK_CHECK;
4797 } 4807 }
4798 4808
4799 4809
4800 } } // namespace v8::internal 4810 } } // namespace v8::internal
4801 4811
4802 #endif // V8_TARGET_ARCH_IA32 4812 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698