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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 201015: Second step in allocating objects in generated code on ARM (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 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/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 int token_offset = Context::kHeaderSize + 1224 int token_offset = Context::kHeaderSize +
1225 Context::SECURITY_TOKEN_INDEX * kPointerSize; 1225 Context::SECURITY_TOKEN_INDEX * kPointerSize;
1226 movq(scratch, FieldOperand(scratch, token_offset)); 1226 movq(scratch, FieldOperand(scratch, token_offset));
1227 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); 1227 cmpq(scratch, FieldOperand(kScratchRegister, token_offset));
1228 j(not_equal, miss); 1228 j(not_equal, miss);
1229 1229
1230 bind(&same_contexts); 1230 bind(&same_contexts);
1231 } 1231 }
1232 1232
1233 1233
1234 void MacroAssembler::LoadAllocationTopHelper( 1234 void MacroAssembler::LoadAllocationTopHelper(Register result,
1235 Register result, 1235 Register result_end,
1236 Register result_end, 1236 Register scratch,
1237 Register scratch, 1237 AllocationFlags flags) {
1238 bool result_contains_top_on_entry) {
1239 ExternalReference new_space_allocation_top = 1238 ExternalReference new_space_allocation_top =
1240 ExternalReference::new_space_allocation_top_address(); 1239 ExternalReference::new_space_allocation_top_address();
1241 1240
1242 // Just return if allocation top is already known. 1241 // Just return if allocation top is already known.
1243 if (result_contains_top_on_entry) { 1242 if ((flags & RESULT_CONTAINS_TOP) != 0) {
1244 // No use of scratch if allocation top is provided. 1243 // No use of scratch if allocation top is provided.
1245 ASSERT(scratch.is(no_reg)); 1244 ASSERT(scratch.is(no_reg));
1246 return; 1245 return;
1247 } 1246 }
1248 1247
1249 // Move address of new object to result. Use scratch register if available. 1248 // Move address of new object to result. Use scratch register if available.
1250 if (scratch.is(no_reg)) { 1249 if (scratch.is(no_reg)) {
1251 movq(kScratchRegister, new_space_allocation_top); 1250 movq(kScratchRegister, new_space_allocation_top);
1252 movq(result, Operand(kScratchRegister, 0)); 1251 movq(result, Operand(kScratchRegister, 0));
1253 } else { 1252 } else {
(...skipping 18 matching lines...) Expand all
1272 if (scratch.is(no_reg)) { 1271 if (scratch.is(no_reg)) {
1273 movq(kScratchRegister, new_space_allocation_top); 1272 movq(kScratchRegister, new_space_allocation_top);
1274 movq(Operand(kScratchRegister, 0), result_end); 1273 movq(Operand(kScratchRegister, 0), result_end);
1275 } else { 1274 } else {
1276 movq(Operand(scratch, 0), result_end); 1275 movq(Operand(scratch, 0), result_end);
1277 } 1276 }
1278 } 1277 }
1279 } 1278 }
1280 1279
1281 1280
1282 void MacroAssembler::AllocateObjectInNewSpace( 1281 void MacroAssembler::AllocateObjectInNewSpace(int object_size,
1283 int object_size, 1282 Register result,
1284 Register result, 1283 Register result_end,
1285 Register result_end, 1284 Register scratch,
1286 Register scratch, 1285 Label* gc_required,
1287 Label* gc_required, 1286 AllocationFlags flags) {
1288 bool result_contains_top_on_entry) {
1289 ASSERT(!result.is(result_end)); 1287 ASSERT(!result.is(result_end));
1290 1288
1291 // Load address of new object into result. 1289 // Load address of new object into result.
1292 LoadAllocationTopHelper(result, 1290 LoadAllocationTopHelper(result, result_end, scratch, flags);
1293 result_end,
1294 scratch,
1295 result_contains_top_on_entry);
1296 1291
1297 // Calculate new top and bail out if new space is exhausted. 1292 // Calculate new top and bail out if new space is exhausted.
1298 ExternalReference new_space_allocation_limit = 1293 ExternalReference new_space_allocation_limit =
1299 ExternalReference::new_space_allocation_limit_address(); 1294 ExternalReference::new_space_allocation_limit_address();
1300 lea(result_end, Operand(result, object_size)); 1295 lea(result_end, Operand(result, object_size));
1301 movq(kScratchRegister, new_space_allocation_limit); 1296 movq(kScratchRegister, new_space_allocation_limit);
1302 cmpq(result_end, Operand(kScratchRegister, 0)); 1297 cmpq(result_end, Operand(kScratchRegister, 0));
1303 j(above, gc_required); 1298 j(above, gc_required);
1304 1299
1305 // Update allocation top. 1300 // Update allocation top.
1306 UpdateAllocationTopHelper(result_end, scratch); 1301 UpdateAllocationTopHelper(result_end, scratch);
1302
1303 // Tag the result if requested.
1304 if ((flags & TAG_OBJECT) != 0) {
1305 addq(result, Immediate(kHeapObjectTag));
1306 }
1307 } 1307 }
1308 1308
1309 1309
1310 void MacroAssembler::AllocateObjectInNewSpace( 1310 void MacroAssembler::AllocateObjectInNewSpace(int header_size,
1311 int header_size, 1311 ScaleFactor element_size,
1312 ScaleFactor element_size, 1312 Register element_count,
1313 Register element_count, 1313 Register result,
1314 Register result, 1314 Register result_end,
1315 Register result_end, 1315 Register scratch,
1316 Register scratch, 1316 Label* gc_required,
1317 Label* gc_required, 1317 AllocationFlags flags) {
1318 bool result_contains_top_on_entry) {
1319 ASSERT(!result.is(result_end)); 1318 ASSERT(!result.is(result_end));
1320 1319
1321 // Load address of new object into result. 1320 // Load address of new object into result.
1322 LoadAllocationTopHelper(result, 1321 LoadAllocationTopHelper(result, result_end, scratch, flags);
1323 result_end,
1324 scratch,
1325 result_contains_top_on_entry);
1326 1322
1327 // Calculate new top and bail out if new space is exhausted. 1323 // Calculate new top and bail out if new space is exhausted.
1328 ExternalReference new_space_allocation_limit = 1324 ExternalReference new_space_allocation_limit =
1329 ExternalReference::new_space_allocation_limit_address(); 1325 ExternalReference::new_space_allocation_limit_address();
1330 lea(result_end, Operand(result, element_count, element_size, header_size)); 1326 lea(result_end, Operand(result, element_count, element_size, header_size));
1331 movq(kScratchRegister, new_space_allocation_limit); 1327 movq(kScratchRegister, new_space_allocation_limit);
1332 cmpq(result_end, Operand(kScratchRegister, 0)); 1328 cmpq(result_end, Operand(kScratchRegister, 0));
1333 j(above, gc_required); 1329 j(above, gc_required);
1334 1330
1335 // Update allocation top. 1331 // Update allocation top.
1336 UpdateAllocationTopHelper(result_end, scratch); 1332 UpdateAllocationTopHelper(result_end, scratch);
1333
1334 // Tag the result if requested.
1335 if ((flags & TAG_OBJECT) != 0) {
1336 addq(result, Immediate(kHeapObjectTag));
1337 }
1337 } 1338 }
1338 1339
1339 1340
1340 void MacroAssembler::AllocateObjectInNewSpace( 1341 void MacroAssembler::AllocateObjectInNewSpace(Register object_size,
1341 Register object_size, 1342 Register result,
1342 Register result, 1343 Register result_end,
1343 Register result_end, 1344 Register scratch,
1344 Register scratch, 1345 Label* gc_required,
1345 Label* gc_required, 1346 AllocationFlags flags) {
1346 bool result_contains_top_on_entry) {
1347 1347
1348 // Load address of new object into result. 1348 // Load address of new object into result.
1349 LoadAllocationTopHelper(result, 1349 LoadAllocationTopHelper(result, result_end, scratch, flags);
1350 result_end,
1351 scratch,
1352 result_contains_top_on_entry);
1353
1354 1350
1355 // Calculate new top and bail out if new space is exhausted. 1351 // Calculate new top and bail out if new space is exhausted.
1356 ExternalReference new_space_allocation_limit = 1352 ExternalReference new_space_allocation_limit =
1357 ExternalReference::new_space_allocation_limit_address(); 1353 ExternalReference::new_space_allocation_limit_address();
1358 if (!object_size.is(result_end)) { 1354 if (!object_size.is(result_end)) {
1359 movq(result_end, object_size); 1355 movq(result_end, object_size);
1360 } 1356 }
1361 addq(result_end, result); 1357 addq(result_end, result);
1362 movq(kScratchRegister, new_space_allocation_limit); 1358 movq(kScratchRegister, new_space_allocation_limit);
1363 cmpq(result_end, Operand(kScratchRegister, 0)); 1359 cmpq(result_end, Operand(kScratchRegister, 0));
1364 j(above, gc_required); 1360 j(above, gc_required);
1365 1361
1366 // Update allocation top. 1362 // Update allocation top.
1367 UpdateAllocationTopHelper(result_end, scratch); 1363 UpdateAllocationTopHelper(result_end, scratch);
1364
1365 // Tag the result if requested.
1366 if ((flags & TAG_OBJECT) != 0) {
1367 addq(result, Immediate(kHeapObjectTag));
1368 }
1368 } 1369 }
1369 1370
1370 1371
1371 void MacroAssembler::UndoAllocationInNewSpace(Register object) { 1372 void MacroAssembler::UndoAllocationInNewSpace(Register object) {
1372 ExternalReference new_space_allocation_top = 1373 ExternalReference new_space_allocation_top =
1373 ExternalReference::new_space_allocation_top_address(); 1374 ExternalReference::new_space_allocation_top_address();
1374 1375
1375 // Make sure the object has no tag before resetting top. 1376 // Make sure the object has no tag before resetting top.
1376 and_(object, Immediate(~kHeapObjectTagMask)); 1377 and_(object, Immediate(~kHeapObjectTagMask));
1377 movq(kScratchRegister, new_space_allocation_top); 1378 movq(kScratchRegister, new_space_allocation_top);
1378 #ifdef DEBUG 1379 #ifdef DEBUG
1379 cmpq(object, Operand(kScratchRegister, 0)); 1380 cmpq(object, Operand(kScratchRegister, 0));
1380 Check(below, "Undo allocation of non allocated memory"); 1381 Check(below, "Undo allocation of non allocated memory");
1381 #endif 1382 #endif
1382 movq(Operand(kScratchRegister, 0), object); 1383 movq(Operand(kScratchRegister, 0), object);
1383 } 1384 }
1384 1385
1385 1386
1386 } } // namespace v8::internal 1387 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698