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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 2144006: Cardmarking writebarrier. (Closed)
Patch Set: change NewSpace and SemiSpace Contains to match HasHeapObjectTag Created 10 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 } else { 1166 } else {
1167 // Get the elements array of the object. 1167 // Get the elements array of the object.
1168 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); 1168 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
1169 1169
1170 // Check that the elements are in fast mode (not dictionary). 1170 // Check that the elements are in fast mode (not dictionary).
1171 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), 1171 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1172 Immediate(Factory::fixed_array_map())); 1172 Immediate(Factory::fixed_array_map()));
1173 __ j(not_equal, &miss); 1173 __ j(not_equal, &miss);
1174 1174
1175 if (argc == 1) { // Otherwise fall through to call builtin. 1175 if (argc == 1) { // Otherwise fall through to call builtin.
1176 Label call_builtin, exit, with_rset_update, attempt_to_grow_elements; 1176 Label call_builtin, exit, with_write_barrier, attempt_to_grow_elements;
1177 1177
1178 // Get the array's length into eax and calculate new length. 1178 // Get the array's length into eax and calculate new length.
1179 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); 1179 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1180 STATIC_ASSERT(kSmiTagSize == 1); 1180 STATIC_ASSERT(kSmiTagSize == 1);
1181 STATIC_ASSERT(kSmiTag == 0); 1181 STATIC_ASSERT(kSmiTag == 0);
1182 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); 1182 __ add(Operand(eax), Immediate(Smi::FromInt(argc)));
1183 1183
1184 // Get the element's length into ecx. 1184 // Get the element's length into ecx.
1185 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); 1185 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset));
1186 __ SmiTag(ecx);
1187 1186
1188 // Check if we could survive without allocation. 1187 // Check if we could survive without allocation.
1189 __ cmp(eax, Operand(ecx)); 1188 __ cmp(eax, Operand(ecx));
1190 __ j(greater, &attempt_to_grow_elements); 1189 __ j(greater, &attempt_to_grow_elements);
1191 1190
1192 // Save new length. 1191 // Save new length.
1193 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); 1192 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1194 1193
1195 // Push the element. 1194 // Push the element.
1196 __ lea(edx, FieldOperand(ebx, 1195 __ lea(edx, FieldOperand(ebx,
1197 eax, times_half_pointer_size, 1196 eax, times_half_pointer_size,
1198 FixedArray::kHeaderSize - argc * kPointerSize)); 1197 FixedArray::kHeaderSize - argc * kPointerSize));
1199 __ mov(ecx, Operand(esp, argc * kPointerSize)); 1198 __ mov(ecx, Operand(esp, argc * kPointerSize));
1200 __ mov(Operand(edx, 0), ecx); 1199 __ mov(Operand(edx, 0), ecx);
1201 1200
1202 // Check if value is a smi. 1201 // Check if value is a smi.
1203 __ test(ecx, Immediate(kSmiTagMask)); 1202 __ test(ecx, Immediate(kSmiTagMask));
1204 __ j(not_zero, &with_rset_update); 1203 __ j(not_zero, &with_write_barrier);
1205 1204
1206 __ bind(&exit); 1205 __ bind(&exit);
1207 __ ret((argc + 1) * kPointerSize); 1206 __ ret((argc + 1) * kPointerSize);
1208 1207
1209 __ bind(&with_rset_update); 1208 __ bind(&with_write_barrier);
1210 1209
1211 __ InNewSpace(ebx, ecx, equal, &exit); 1210 __ InNewSpace(ebx, ecx, equal, &exit);
1212 1211
1213 RecordWriteStub stub(ebx, edx, ecx); 1212 __ RecordWriteHelper(ebx, edx, ecx);
1214 __ CallStub(&stub);
1215 __ ret((argc + 1) * kPointerSize); 1213 __ ret((argc + 1) * kPointerSize);
1216 1214
1217 __ bind(&attempt_to_grow_elements); 1215 __ bind(&attempt_to_grow_elements);
1218 ExternalReference new_space_allocation_top = 1216 ExternalReference new_space_allocation_top =
1219 ExternalReference::new_space_allocation_top_address(); 1217 ExternalReference::new_space_allocation_top_address();
1220 ExternalReference new_space_allocation_limit = 1218 ExternalReference new_space_allocation_limit =
1221 ExternalReference::new_space_allocation_limit_address(); 1219 ExternalReference::new_space_allocation_limit_address();
1222 1220
1223 const int kAllocationDelta = 4; 1221 const int kAllocationDelta = 4;
1224 // Load top. 1222 // Load top.
(...skipping 19 matching lines...) Expand all
1244 for (int i = 1; i < kAllocationDelta; i++) { 1242 for (int i = 1; i < kAllocationDelta; i++) {
1245 __ mov(Operand(edx, i * kPointerSize), 1243 __ mov(Operand(edx, i * kPointerSize),
1246 Immediate(Factory::the_hole_value())); 1244 Immediate(Factory::the_hole_value()));
1247 } 1245 }
1248 1246
1249 // Restore receiver to edx as finish sequence assumes it's here. 1247 // Restore receiver to edx as finish sequence assumes it's here.
1250 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); 1248 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1251 1249
1252 // Increment element's and array's sizes. 1250 // Increment element's and array's sizes.
1253 __ add(FieldOperand(ebx, FixedArray::kLengthOffset), 1251 __ add(FieldOperand(ebx, FixedArray::kLengthOffset),
1254 Immediate(kAllocationDelta)); 1252 Immediate(Smi::FromInt(kAllocationDelta)));
1255 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); 1253 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1256 1254
1257 // Elements are in new space, so no remembered set updates are necessary. 1255 // Elements are in new space, so write barrier is not required.
1258 __ ret((argc + 1) * kPointerSize); 1256 __ ret((argc + 1) * kPointerSize);
1259 1257
1260 __ bind(&call_builtin); 1258 __ bind(&call_builtin);
1261 } 1259 }
1262 1260
1263 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1261 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1264 argc + 1, 1262 argc + 1,
1265 1); 1263 1);
1266 } 1264 }
1267 1265
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 // Return the generated code. 2382 // Return the generated code.
2385 return GetCode(); 2383 return GetCode();
2386 } 2384 }
2387 2385
2388 2386
2389 #undef __ 2387 #undef __
2390 2388
2391 } } // namespace v8::internal 2389 } } // namespace v8::internal
2392 2390
2393 #endif // V8_TARGET_ARCH_IA32 2391 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mark-compact.h » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698