OLD | NEW |
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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 Register result_end, | 1235 Register result_end, |
1236 Register scratch, | 1236 Register scratch, |
1237 AllocationFlags flags) { | 1237 AllocationFlags flags) { |
1238 ExternalReference new_space_allocation_top = | 1238 ExternalReference new_space_allocation_top = |
1239 ExternalReference::new_space_allocation_top_address(); | 1239 ExternalReference::new_space_allocation_top_address(); |
1240 | 1240 |
1241 // Just return if allocation top is already known. | 1241 // Just return if allocation top is already known. |
1242 if ((flags & RESULT_CONTAINS_TOP) != 0) { | 1242 if ((flags & RESULT_CONTAINS_TOP) != 0) { |
1243 // No use of scratch if allocation top is provided. | 1243 // No use of scratch if allocation top is provided. |
1244 ASSERT(scratch.is(no_reg)); | 1244 ASSERT(scratch.is(no_reg)); |
| 1245 #ifdef DEBUG |
| 1246 // Assert that result actually contains top on entry. |
| 1247 movq(kScratchRegister, new_space_allocation_top); |
| 1248 cmpq(result, Operand(kScratchRegister, 0)); |
| 1249 Check(equal, "Unexpected allocation top"); |
| 1250 #endif |
1245 return; | 1251 return; |
1246 } | 1252 } |
1247 | 1253 |
1248 // Move address of new object to result. Use scratch register if available. | 1254 // Move address of new object to result. Use scratch register if available. |
1249 if (scratch.is(no_reg)) { | 1255 if (scratch.is(no_reg)) { |
1250 movq(kScratchRegister, new_space_allocation_top); | 1256 movq(kScratchRegister, new_space_allocation_top); |
1251 movq(result, Operand(kScratchRegister, 0)); | 1257 movq(result, Operand(kScratchRegister, 0)); |
1252 } else { | 1258 } else { |
1253 ASSERT(!scratch.is(result_end)); | 1259 ASSERT(!scratch.is(result_end)); |
1254 movq(scratch, new_space_allocation_top); | 1260 movq(scratch, new_space_allocation_top); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 movq(kScratchRegister, new_space_allocation_top); | 1383 movq(kScratchRegister, new_space_allocation_top); |
1378 #ifdef DEBUG | 1384 #ifdef DEBUG |
1379 cmpq(object, Operand(kScratchRegister, 0)); | 1385 cmpq(object, Operand(kScratchRegister, 0)); |
1380 Check(below, "Undo allocation of non allocated memory"); | 1386 Check(below, "Undo allocation of non allocated memory"); |
1381 #endif | 1387 #endif |
1382 movq(Operand(kScratchRegister, 0), object); | 1388 movq(Operand(kScratchRegister, 0), object); |
1383 } | 1389 } |
1384 | 1390 |
1385 | 1391 |
1386 } } // namespace v8::internal | 1392 } } // namespace v8::internal |
OLD | NEW |