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

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 578443003: Support old-space allocation in generated code (bump block only for now). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (scale_factor == TIMES_16) { \ 279 if (scale_factor == TIMES_16) { \
280 /* double length of array. */ \ 280 /* double length of array. */ \
281 __ addl(EDI, EDI); \ 281 __ addl(EDI, EDI); \
282 /* only scale by 8. */ \ 282 /* only scale by 8. */ \
283 scale_factor = TIMES_8; \ 283 scale_factor = TIMES_8; \
284 } \ 284 } \
285 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 285 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
286 __ leal(EDI, Address(EDI, scale_factor, fixed_size)); \ 286 __ leal(EDI, Address(EDI, scale_factor, fixed_size)); \
287 __ andl(EDI, Immediate(-kObjectAlignment)); \ 287 __ andl(EDI, Immediate(-kObjectAlignment)); \
288 Heap* heap = Isolate::Current()->heap(); \ 288 Heap* heap = Isolate::Current()->heap(); \
289 \ 289 Heap::Space space = heap->SpaceForAllocation(cid); \
290 __ movl(EAX, Address::Absolute(heap->TopAddress())); \ 290 __ movl(EAX, Address::Absolute(heap->TopAddress(space))); \
291 __ movl(EBX, EAX); \ 291 __ movl(EBX, EAX); \
292 \ 292 \
293 /* EDI: allocation size. */ \ 293 /* EDI: allocation size. */ \
294 __ addl(EBX, EDI); \ 294 __ addl(EBX, EDI); \
295 __ j(CARRY, &fall_through); \ 295 __ j(CARRY, &fall_through); \
296 \ 296 \
297 /* Check if the allocation fits into the remaining space. */ \ 297 /* Check if the allocation fits into the remaining space. */ \
298 /* EAX: potential new object start. */ \ 298 /* EAX: potential new object start. */ \
299 /* EBX: potential next object start. */ \ 299 /* EBX: potential next object start. */ \
300 /* EDI: allocation size. */ \ 300 /* EDI: allocation size. */ \
301 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); \ 301 __ cmpl(EBX, Address::Absolute(heap->EndAddress(space))); \
302 __ j(ABOVE_EQUAL, &fall_through); \ 302 __ j(ABOVE_EQUAL, &fall_through); \
303 \ 303 \
304 /* Successfully allocated the object(s), now update top to point to */ \ 304 /* Successfully allocated the object(s), now update top to point to */ \
305 /* next object start and initialize the object. */ \ 305 /* next object start and initialize the object. */ \
306 __ movl(Address::Absolute(heap->TopAddress()), EBX); \ 306 __ movl(Address::Absolute(heap->TopAddress(space)), EBX); \
307 __ addl(EAX, Immediate(kHeapObjectTag)); \ 307 __ addl(EAX, Immediate(kHeapObjectTag)); \
308 __ UpdateAllocationStatsWithSize(cid, EDI, kNoRegister); \ 308 __ UpdateAllocationStatsWithSize(cid, EDI, kNoRegister, space); \
309 \ 309 \
310 /* Initialize the tags. */ \ 310 /* Initialize the tags. */ \
311 /* EAX: new object start as a tagged pointer. */ \ 311 /* EAX: new object start as a tagged pointer. */ \
312 /* EBX: new object end address. */ \ 312 /* EBX: new object end address. */ \
313 /* EDI: allocation size. */ \ 313 /* EDI: allocation size. */ \
314 { \ 314 { \
315 Label size_tag_overflow, done; \ 315 Label size_tag_overflow, done; \
316 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ 316 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \
317 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ 317 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \
318 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \ 318 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); \
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 } 1394 }
1395 Label pop_and_fail; 1395 Label pop_and_fail;
1396 __ pushl(EDI); // Preserve length. 1396 __ pushl(EDI); // Preserve length.
1397 __ SmiUntag(EDI); 1397 __ SmiUntag(EDI);
1398 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 1398 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
1399 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged. 1399 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged.
1400 __ andl(EDI, Immediate(-kObjectAlignment)); 1400 __ andl(EDI, Immediate(-kObjectAlignment));
1401 1401
1402 Isolate* isolate = Isolate::Current(); 1402 Isolate* isolate = Isolate::Current();
1403 Heap* heap = isolate->heap(); 1403 Heap* heap = isolate->heap();
1404 1404 Heap::Space space = heap->SpaceForAllocation(kOneByteStringCid);
1405 __ movl(EAX, Address::Absolute(heap->TopAddress())); 1405 __ movl(EAX, Address::Absolute(heap->TopAddress(space)));
1406 __ movl(EBX, EAX); 1406 __ movl(EBX, EAX);
1407 1407
1408 // EDI: allocation size. 1408 // EDI: allocation size.
1409 __ addl(EBX, EDI); 1409 __ addl(EBX, EDI);
1410 __ j(CARRY, &pop_and_fail, Assembler::kNearJump); 1410 __ j(CARRY, &pop_and_fail, Assembler::kNearJump);
1411 1411
1412 // Check if the allocation fits into the remaining space. 1412 // Check if the allocation fits into the remaining space.
1413 // EAX: potential new object start. 1413 // EAX: potential new object start.
1414 // EBX: potential next object start. 1414 // EBX: potential next object start.
1415 // EDI: allocation size. 1415 // EDI: allocation size.
1416 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 1416 __ cmpl(EBX, Address::Absolute(heap->EndAddress(space)));
1417 __ j(ABOVE_EQUAL, &pop_and_fail, Assembler::kNearJump); 1417 __ j(ABOVE_EQUAL, &pop_and_fail, Assembler::kNearJump);
1418 1418
1419 // Successfully allocated the object(s), now update top to point to 1419 // Successfully allocated the object(s), now update top to point to
1420 // next object start and initialize the object. 1420 // next object start and initialize the object.
1421 __ movl(Address::Absolute(heap->TopAddress()), EBX); 1421 __ movl(Address::Absolute(heap->TopAddress(space)), EBX);
1422 __ addl(EAX, Immediate(kHeapObjectTag)); 1422 __ addl(EAX, Immediate(kHeapObjectTag));
1423 1423
1424 __ UpdateAllocationStatsWithSize(kOneByteStringCid, EDI, kNoRegister); 1424 __ UpdateAllocationStatsWithSize(kOneByteStringCid, EDI, kNoRegister, space);
1425 1425
1426 // Initialize the tags. 1426 // Initialize the tags.
1427 // EAX: new object start as a tagged pointer. 1427 // EAX: new object start as a tagged pointer.
1428 // EBX: new object end address. 1428 // EBX: new object end address.
1429 // EDI: allocation size. 1429 // EDI: allocation size.
1430 { 1430 {
1431 Label size_tag_overflow, done; 1431 Label size_tag_overflow, done;
1432 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); 1432 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
1433 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 1433 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
1434 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); 1434 __ shll(EDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 Isolate::current_tag_offset()); 1642 Isolate::current_tag_offset());
1643 // Set return value to Isolate::current_tag_. 1643 // Set return value to Isolate::current_tag_.
1644 __ movl(EAX, current_tag_addr); 1644 __ movl(EAX, current_tag_addr);
1645 __ ret(); 1645 __ ret();
1646 } 1646 }
1647 1647
1648 #undef __ 1648 #undef __
1649 } // namespace dart 1649 } // namespace dart
1650 1650
1651 #endif // defined TARGET_ARCH_IA32 1651 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698