| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 } | 1258 } |
| 1259 } | 1259 } |
| 1260 jmp(gc_required); | 1260 jmp(gc_required); |
| 1261 return; | 1261 return; |
| 1262 } | 1262 } |
| 1263 ASSERT(!result.is(result_end)); | 1263 ASSERT(!result.is(result_end)); |
| 1264 | 1264 |
| 1265 // Load address of new object into result. | 1265 // Load address of new object into result. |
| 1266 LoadAllocationTopHelper(result, scratch, flags); | 1266 LoadAllocationTopHelper(result, scratch, flags); |
| 1267 | 1267 |
| 1268 ExternalReference allocation_limit = |
| 1269 AllocationUtils::GetAllocationLimitReference(isolate(), flags); |
| 1270 |
| 1268 // Align the next allocation. Storing the filler map without checking top is | 1271 // Align the next allocation. Storing the filler map without checking top is |
| 1269 // always safe because the limit of the heap is always aligned. | 1272 // safe in new-space because the limit of the heap is aligned there. |
| 1270 if ((flags & DOUBLE_ALIGNMENT) != 0) { | 1273 if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| 1271 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); | 1274 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); |
| 1272 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); | 1275 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); |
| 1273 Label aligned; | 1276 Label aligned; |
| 1274 test(result, Immediate(kDoubleAlignmentMask)); | 1277 test(result, Immediate(kDoubleAlignmentMask)); |
| 1275 j(zero, &aligned, Label::kNear); | 1278 j(zero, &aligned, Label::kNear); |
| 1279 if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { |
| 1280 cmp(result, Operand::StaticVariable(allocation_limit)); |
| 1281 j(above_equal, gc_required); |
| 1282 } |
| 1276 mov(Operand(result, 0), | 1283 mov(Operand(result, 0), |
| 1277 Immediate(isolate()->factory()->one_pointer_filler_map())); | 1284 Immediate(isolate()->factory()->one_pointer_filler_map())); |
| 1278 add(result, Immediate(kDoubleSize / 2)); | 1285 add(result, Immediate(kDoubleSize / 2)); |
| 1279 bind(&aligned); | 1286 bind(&aligned); |
| 1280 } | 1287 } |
| 1281 | 1288 |
| 1289 // Calculate new top and bail out if space is exhausted. |
| 1282 Register top_reg = result_end.is_valid() ? result_end : result; | 1290 Register top_reg = result_end.is_valid() ? result_end : result; |
| 1283 | |
| 1284 // Calculate new top and bail out if space is exhausted. | |
| 1285 ExternalReference allocation_limit = | |
| 1286 AllocationUtils::GetAllocationLimitReference(isolate(), flags); | |
| 1287 | |
| 1288 if (!top_reg.is(result)) { | 1291 if (!top_reg.is(result)) { |
| 1289 mov(top_reg, result); | 1292 mov(top_reg, result); |
| 1290 } | 1293 } |
| 1291 add(top_reg, Immediate(object_size)); | 1294 add(top_reg, Immediate(object_size)); |
| 1292 j(carry, gc_required); | 1295 j(carry, gc_required); |
| 1293 cmp(top_reg, Operand::StaticVariable(allocation_limit)); | 1296 cmp(top_reg, Operand::StaticVariable(allocation_limit)); |
| 1294 j(above, gc_required); | 1297 j(above, gc_required); |
| 1295 | 1298 |
| 1296 // Update allocation top. | 1299 // Update allocation top. |
| 1297 UpdateAllocationTopHelper(top_reg, scratch, flags); | 1300 UpdateAllocationTopHelper(top_reg, scratch, flags); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 // Register element_count is not modified by the function. | 1335 // Register element_count is not modified by the function. |
| 1333 } | 1336 } |
| 1334 jmp(gc_required); | 1337 jmp(gc_required); |
| 1335 return; | 1338 return; |
| 1336 } | 1339 } |
| 1337 ASSERT(!result.is(result_end)); | 1340 ASSERT(!result.is(result_end)); |
| 1338 | 1341 |
| 1339 // Load address of new object into result. | 1342 // Load address of new object into result. |
| 1340 LoadAllocationTopHelper(result, scratch, flags); | 1343 LoadAllocationTopHelper(result, scratch, flags); |
| 1341 | 1344 |
| 1345 ExternalReference allocation_limit = |
| 1346 AllocationUtils::GetAllocationLimitReference(isolate(), flags); |
| 1347 |
| 1342 // Align the next allocation. Storing the filler map without checking top is | 1348 // Align the next allocation. Storing the filler map without checking top is |
| 1343 // always safe because the limit of the heap is always aligned. | 1349 // safe in new-space because the limit of the heap is aligned there. |
| 1344 if ((flags & DOUBLE_ALIGNMENT) != 0) { | 1350 if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| 1345 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); | 1351 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); |
| 1346 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); | 1352 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); |
| 1347 Label aligned; | 1353 Label aligned; |
| 1348 test(result, Immediate(kDoubleAlignmentMask)); | 1354 test(result, Immediate(kDoubleAlignmentMask)); |
| 1349 j(zero, &aligned, Label::kNear); | 1355 j(zero, &aligned, Label::kNear); |
| 1356 if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { |
| 1357 cmp(result, Operand::StaticVariable(allocation_limit)); |
| 1358 j(above_equal, gc_required); |
| 1359 } |
| 1350 mov(Operand(result, 0), | 1360 mov(Operand(result, 0), |
| 1351 Immediate(isolate()->factory()->one_pointer_filler_map())); | 1361 Immediate(isolate()->factory()->one_pointer_filler_map())); |
| 1352 add(result, Immediate(kDoubleSize / 2)); | 1362 add(result, Immediate(kDoubleSize / 2)); |
| 1353 bind(&aligned); | 1363 bind(&aligned); |
| 1354 } | 1364 } |
| 1355 | 1365 |
| 1356 // Calculate new top and bail out if space is exhausted. | 1366 // Calculate new top and bail out if space is exhausted. |
| 1357 ExternalReference allocation_limit = | |
| 1358 AllocationUtils::GetAllocationLimitReference(isolate(), flags); | |
| 1359 | |
| 1360 // We assume that element_count*element_size + header_size does not | 1367 // We assume that element_count*element_size + header_size does not |
| 1361 // overflow. | 1368 // overflow. |
| 1362 if (element_count_type == REGISTER_VALUE_IS_SMI) { | 1369 if (element_count_type == REGISTER_VALUE_IS_SMI) { |
| 1363 STATIC_ASSERT(static_cast<ScaleFactor>(times_2 - 1) == times_1); | 1370 STATIC_ASSERT(static_cast<ScaleFactor>(times_2 - 1) == times_1); |
| 1364 STATIC_ASSERT(static_cast<ScaleFactor>(times_4 - 1) == times_2); | 1371 STATIC_ASSERT(static_cast<ScaleFactor>(times_4 - 1) == times_2); |
| 1365 STATIC_ASSERT(static_cast<ScaleFactor>(times_8 - 1) == times_4); | 1372 STATIC_ASSERT(static_cast<ScaleFactor>(times_8 - 1) == times_4); |
| 1366 ASSERT(element_size >= times_2); | 1373 ASSERT(element_size >= times_2); |
| 1367 ASSERT(kSmiTagSize == 1); | 1374 ASSERT(kSmiTagSize == 1); |
| 1368 element_size = static_cast<ScaleFactor>(element_size - 1); | 1375 element_size = static_cast<ScaleFactor>(element_size - 1); |
| 1369 } else { | 1376 } else { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 // object_size is left unchanged by this function. | 1410 // object_size is left unchanged by this function. |
| 1404 } | 1411 } |
| 1405 jmp(gc_required); | 1412 jmp(gc_required); |
| 1406 return; | 1413 return; |
| 1407 } | 1414 } |
| 1408 ASSERT(!result.is(result_end)); | 1415 ASSERT(!result.is(result_end)); |
| 1409 | 1416 |
| 1410 // Load address of new object into result. | 1417 // Load address of new object into result. |
| 1411 LoadAllocationTopHelper(result, scratch, flags); | 1418 LoadAllocationTopHelper(result, scratch, flags); |
| 1412 | 1419 |
| 1420 ExternalReference allocation_limit = |
| 1421 AllocationUtils::GetAllocationLimitReference(isolate(), flags); |
| 1422 |
| 1413 // Align the next allocation. Storing the filler map without checking top is | 1423 // Align the next allocation. Storing the filler map without checking top is |
| 1414 // always safe because the limit of the heap is always aligned. | 1424 // safe in new-space because the limit of the heap is aligned there. |
| 1415 if ((flags & DOUBLE_ALIGNMENT) != 0) { | 1425 if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| 1416 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); | 1426 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); |
| 1417 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); | 1427 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); |
| 1418 Label aligned; | 1428 Label aligned; |
| 1419 test(result, Immediate(kDoubleAlignmentMask)); | 1429 test(result, Immediate(kDoubleAlignmentMask)); |
| 1420 j(zero, &aligned, Label::kNear); | 1430 j(zero, &aligned, Label::kNear); |
| 1431 if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { |
| 1432 cmp(result, Operand::StaticVariable(allocation_limit)); |
| 1433 j(above_equal, gc_required); |
| 1434 } |
| 1421 mov(Operand(result, 0), | 1435 mov(Operand(result, 0), |
| 1422 Immediate(isolate()->factory()->one_pointer_filler_map())); | 1436 Immediate(isolate()->factory()->one_pointer_filler_map())); |
| 1423 add(result, Immediate(kDoubleSize / 2)); | 1437 add(result, Immediate(kDoubleSize / 2)); |
| 1424 bind(&aligned); | 1438 bind(&aligned); |
| 1425 } | 1439 } |
| 1426 | 1440 |
| 1427 // Calculate new top and bail out if space is exhausted. | 1441 // Calculate new top and bail out if space is exhausted. |
| 1428 ExternalReference allocation_limit = | |
| 1429 AllocationUtils::GetAllocationLimitReference(isolate(), flags); | |
| 1430 | |
| 1431 if (!object_size.is(result_end)) { | 1442 if (!object_size.is(result_end)) { |
| 1432 mov(result_end, object_size); | 1443 mov(result_end, object_size); |
| 1433 } | 1444 } |
| 1434 add(result_end, result); | 1445 add(result_end, result); |
| 1435 j(carry, gc_required); | 1446 j(carry, gc_required); |
| 1436 cmp(result_end, Operand::StaticVariable(allocation_limit)); | 1447 cmp(result_end, Operand::StaticVariable(allocation_limit)); |
| 1437 j(above, gc_required); | 1448 j(above, gc_required); |
| 1438 | 1449 |
| 1439 // Tag result if requested. | 1450 // Tag result if requested. |
| 1440 if ((flags & TAG_OBJECT) != 0) { | 1451 if ((flags & TAG_OBJECT) != 0) { |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 j(greater, &no_info_available); | 3179 j(greater, &no_info_available); |
| 3169 cmp(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), | 3180 cmp(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), |
| 3170 Immediate(Handle<Map>(isolate()->heap()->allocation_site_info_map()))); | 3181 Immediate(Handle<Map>(isolate()->heap()->allocation_site_info_map()))); |
| 3171 bind(&no_info_available); | 3182 bind(&no_info_available); |
| 3172 } | 3183 } |
| 3173 | 3184 |
| 3174 | 3185 |
| 3175 } } // namespace v8::internal | 3186 } } // namespace v8::internal |
| 3176 | 3187 |
| 3177 #endif // V8_TARGET_ARCH_IA32 | 3188 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |