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

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

Issue 7122003: Make x64 to use the RecordWrite stub. This is a step towards getting (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 for (int i = 0; i < num_parameters; i++) { 209 for (int i = 0; i < num_parameters; i++) {
210 Slot* slot = scope()->parameter(i)->AsSlot(); 210 Slot* slot = scope()->parameter(i)->AsSlot();
211 if (slot != NULL && slot->type() == Slot::CONTEXT) { 211 if (slot != NULL && slot->type() == Slot::CONTEXT) {
212 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 212 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
213 (num_parameters - 1 - i) * kPointerSize; 213 (num_parameters - 1 - i) * kPointerSize;
214 // Load parameter from stack. 214 // Load parameter from stack.
215 __ movq(rax, Operand(rbp, parameter_offset)); 215 __ movq(rax, Operand(rbp, parameter_offset));
216 // Store it in the context. 216 // Store it in the context.
217 int context_offset = Context::SlotOffset(slot->index()); 217 int context_offset = Context::SlotOffset(slot->index());
218 __ movq(Operand(rsi, context_offset), rax); 218 __ movq(Operand(rsi, context_offset), rax);
219 // Update the write barrier. This clobbers all involved 219 // Update the write barrier. This clobbers rax and rbx.
220 // registers, so we have use a third register to avoid 220 __ RecordWriteContextSlot(rsi, context_offset, rax, rbx, kSaveFPRegs);
221 // clobbering rsi.
222 __ movq(rcx, rsi);
223 __ RecordWrite(rcx, context_offset, rax, rbx, kSaveFPRegs);
224 } 221 }
225 } 222 }
226 Comment(";;; End allocate local context"); 223 Comment(";;; End allocate local context");
227 } 224 }
228 225
229 // Trace the call. 226 // Trace the call.
230 if (FLAG_trace) { 227 if (FLAG_trace) {
231 __ CallRuntime(Runtime::kTraceEnter, 0); 228 __ CallRuntime(Runtime::kTraceEnter, 0);
232 } 229 }
233 return !is_aborted(); 230 return !is_aborted();
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 2208
2212 __ Move(rcx, instr->name()); 2209 __ Move(rcx, instr->name());
2213 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : 2210 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET :
2214 RelocInfo::CODE_TARGET_CONTEXT; 2211 RelocInfo::CODE_TARGET_CONTEXT;
2215 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2212 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2216 CallCode(ic, mode, instr); 2213 CallCode(ic, mode, instr);
2217 } 2214 }
2218 2215
2219 2216
2220 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { 2217 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
2218 Register object = ToRegister(instr->TempAt(0));
2219 Register address = ToRegister(instr->TempAt(1));
2221 Register value = ToRegister(instr->InputAt(0)); 2220 Register value = ToRegister(instr->InputAt(0));
2222 Register temp = ToRegister(instr->TempAt(0)); 2221 ASSERT(!value.is(object));
2223 ASSERT(!value.is(temp)); 2222 Handle<JSGlobalPropertyCell> cell_handle(instr->hydrogen()->cell());
2224 bool check_hole = instr->hydrogen()->check_hole_value(); 2223
2225 if (!check_hole && value.is(rax)) { 2224 int offset = JSGlobalPropertyCell::kValueOffset;
2226 __ store_rax(instr->hydrogen()->cell().location(), 2225 __ movq(address, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL);
2227 RelocInfo::GLOBAL_PROPERTY_CELL); 2226
2228 return;
2229 }
2230 // If the cell we are storing to contains the hole it could have 2227 // If the cell we are storing to contains the hole it could have
2231 // been deleted from the property dictionary. In that case, we need 2228 // been deleted from the property dictionary. In that case, we need
2232 // to update the property details in the property dictionary to mark 2229 // to update the property details in the property dictionary to mark
2233 // it as no longer deleted. We deoptimize in that case. 2230 // it as no longer deleted. We deoptimize in that case.
2234 __ movq(temp, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL); 2231 if (instr->hydrogen()->check_hole_value()) {
2235 if (check_hole) { 2232 __ CompareRoot(Operand(address, 0), Heap::kTheHoleValueRootIndex);
2236 __ CompareRoot(Operand(temp, 0), Heap::kTheHoleValueRootIndex);
2237 DeoptimizeIf(equal, instr->environment()); 2233 DeoptimizeIf(equal, instr->environment());
2238 } 2234 }
2239 __ movq(Operand(temp, 0), value); 2235
2236 // Store the value.
2237 __ movq(Operand(address, 0), value);
2238
2239 Label smi_store;
2240 __ JumpIfSmi(value, &smi_store, Label::kNear);
2241
2242 __ lea(object, Operand(address, -offset));
2243 // Cells are always in the remembered set.
2244 __ RecordWrite(object,
2245 address,
2246 value,
2247 kSaveFPRegs,
2248 OMIT_REMEMBERED_SET,
2249 OMIT_SMI_CHECK);
2250 __ bind(&smi_store);
2240 } 2251 }
2241 2252
2242 2253
2243 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { 2254 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
2244 ASSERT(ToRegister(instr->global_object()).is(rdx)); 2255 ASSERT(ToRegister(instr->global_object()).is(rdx));
2245 ASSERT(ToRegister(instr->value()).is(rax)); 2256 ASSERT(ToRegister(instr->value()).is(rax));
2246 2257
2247 __ Move(rcx, instr->name()); 2258 __ Move(rcx, instr->name());
2248 Handle<Code> ic = instr->strict_mode() 2259 Handle<Code> ic = instr->strict_mode()
2249 ? isolate()->builtins()->StoreIC_Initialize_Strict() 2260 ? isolate()->builtins()->StoreIC_Initialize_Strict()
2250 : isolate()->builtins()->StoreIC_Initialize(); 2261 : isolate()->builtins()->StoreIC_Initialize();
2251 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); 2262 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr);
2252 } 2263 }
2253 2264
2254 2265
2255 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { 2266 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2256 Register context = ToRegister(instr->context()); 2267 Register context = ToRegister(instr->context());
2257 Register result = ToRegister(instr->result()); 2268 Register result = ToRegister(instr->result());
2258 __ movq(result, ContextOperand(context, instr->slot_index())); 2269 __ movq(result, ContextOperand(context, instr->slot_index()));
2259 } 2270 }
2260 2271
2261 2272
2262 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { 2273 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
2263 Register context = ToRegister(instr->context()); 2274 Register context = ToRegister(instr->context());
2264 Register value = ToRegister(instr->value()); 2275 Register value = ToRegister(instr->value());
2265 __ movq(ContextOperand(context, instr->slot_index()), value); 2276 __ movq(ContextOperand(context, instr->slot_index()), value);
2266 if (instr->needs_write_barrier()) { 2277 if (instr->needs_write_barrier()) {
2267 int offset = Context::SlotOffset(instr->slot_index()); 2278 int offset = Context::SlotOffset(instr->slot_index());
2268 Register scratch = ToRegister(instr->TempAt(0)); 2279 Register scratch = ToRegister(instr->TempAt(0));
2269 __ RecordWrite(context, offset, value, scratch, kSaveFPRegs); 2280 __ RecordWriteContextSlot(context, offset, value, scratch, kSaveFPRegs);
2270 } 2281 }
2271 } 2282 }
2272 2283
2273 2284
2274 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 2285 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2275 Register object = ToRegister(instr->InputAt(0)); 2286 Register object = ToRegister(instr->InputAt(0));
2276 Register result = ToRegister(instr->result()); 2287 Register result = ToRegister(instr->result());
2277 if (instr->hydrogen()->is_in_object()) { 2288 if (instr->hydrogen()->is_in_object()) {
2278 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); 2289 __ movq(result, FieldOperand(object, instr->hydrogen()->offset()));
2279 } else { 2290 } else {
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 if (!instr->transition().is_null()) { 3169 if (!instr->transition().is_null()) {
3159 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); 3170 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition());
3160 } 3171 }
3161 3172
3162 // Do the store. 3173 // Do the store.
3163 if (instr->is_in_object()) { 3174 if (instr->is_in_object()) {
3164 __ movq(FieldOperand(object, offset), value); 3175 __ movq(FieldOperand(object, offset), value);
3165 if (instr->needs_write_barrier()) { 3176 if (instr->needs_write_barrier()) {
3166 Register temp = ToRegister(instr->TempAt(0)); 3177 Register temp = ToRegister(instr->TempAt(0));
3167 // Update the write barrier for the object for in-object properties. 3178 // Update the write barrier for the object for in-object properties.
3168 __ RecordWrite(object, offset, value, temp, kSaveFPRegs); 3179 __ RecordWriteField(object, offset, value, temp, kSaveFPRegs);
3169 } 3180 }
3170 } else { 3181 } else {
3171 Register temp = ToRegister(instr->TempAt(0)); 3182 Register temp = ToRegister(instr->TempAt(0));
3172 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); 3183 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset));
3173 __ movq(FieldOperand(temp, offset), value); 3184 __ movq(FieldOperand(temp, offset), value);
3174 if (instr->needs_write_barrier()) { 3185 if (instr->needs_write_barrier()) {
3175 // Update the write barrier for the properties array. 3186 // Update the write barrier for the properties array.
3176 // object is used as a scratch register. 3187 // object is used as a scratch register.
3177 __ RecordWrite(temp, offset, value, object, kSaveFPRegs); 3188 __ RecordWriteField(temp, offset, value, object, kSaveFPRegs);
3178 } 3189 }
3179 } 3190 }
3180 } 3191 }
3181 3192
3182 3193
3183 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 3194 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
3184 ASSERT(ToRegister(instr->object()).is(rdx)); 3195 ASSERT(ToRegister(instr->object()).is(rdx));
3185 ASSERT(ToRegister(instr->value()).is(rax)); 3196 ASSERT(ToRegister(instr->value()).is(rax));
3186 3197
3187 __ Move(rcx, instr->hydrogen()->name()); 3198 __ Move(rcx, instr->hydrogen()->name());
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
4258 RegisterEnvironmentForDeoptimization(environment); 4269 RegisterEnvironmentForDeoptimization(environment);
4259 ASSERT(osr_pc_offset_ == -1); 4270 ASSERT(osr_pc_offset_ == -1);
4260 osr_pc_offset_ = masm()->pc_offset(); 4271 osr_pc_offset_ = masm()->pc_offset();
4261 } 4272 }
4262 4273
4263 #undef __ 4274 #undef __
4264 4275
4265 } } // namespace v8::internal 4276 } } // namespace v8::internal
4266 4277
4267 #endif // V8_TARGET_ARCH_X64 4278 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698