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

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

Issue 346823003: VM: Optimized context allocation on all platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 ClassHeapStats::allocated_since_gc_old_space_offset(); 2436 ClassHeapStats::allocated_since_gc_old_space_offset();
2437 const uword size_field_offset = (space == Heap::kNew) ? 2437 const uword size_field_offset = (space == Heap::kNew) ?
2438 ClassHeapStats::allocated_size_since_gc_new_space_offset() : 2438 ClassHeapStats::allocated_size_since_gc_new_space_offset() :
2439 ClassHeapStats::allocated_size_since_gc_old_space_offset(); 2439 ClassHeapStats::allocated_size_since_gc_old_space_offset();
2440 *count_address = Address::Absolute( 2440 *count_address = Address::Absolute(
2441 class_heap_stats_table_address + class_offset + count_field_offset); 2441 class_heap_stats_table_address + class_offset + count_field_offset);
2442 *size_address = Address::Absolute( 2442 *size_address = Address::Absolute(
2443 class_heap_stats_table_address + class_offset + size_field_offset); 2443 class_heap_stats_table_address + class_offset + size_field_offset);
2444 } 2444 }
2445 2445
2446
2446 void Assembler::UpdateAllocationStats(intptr_t cid, 2447 void Assembler::UpdateAllocationStats(intptr_t cid,
2447 Register temp_reg, 2448 Register temp_reg,
2448 Heap::Space space) { 2449 Heap::Space space) {
2449 ASSERT(cid > 0); 2450 ASSERT(cid > 0);
2450 if (cid < kNumPredefinedCids) { 2451 if (cid < kNumPredefinedCids) {
2451 Address count_address(kNoRegister, 0), size_address(kNoRegister, 0); 2452 Address count_address(kNoRegister, 0), size_address(kNoRegister, 0);
2452 ComputeCounterAddressesForCid(cid, space, &count_address, &size_address); 2453 ComputeCounterAddressesForCid(cid, space, &count_address, &size_address);
2453 incl(count_address); 2454 incl(count_address);
2454 } else { 2455 } else {
2455 ASSERT(temp_reg != kNoRegister); 2456 ASSERT(temp_reg != kNoRegister);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 tags = RawObject::SizeTag::update(instance_size, tags); 2517 tags = RawObject::SizeTag::update(instance_size, tags);
2517 ASSERT(cls.id() != kIllegalCid); 2518 ASSERT(cls.id() != kIllegalCid);
2518 tags = RawObject::ClassIdTag::update(cls.id(), tags); 2519 tags = RawObject::ClassIdTag::update(cls.id(), tags);
2519 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); 2520 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags));
2520 } else { 2521 } else {
2521 jmp(failure); 2522 jmp(failure);
2522 } 2523 }
2523 } 2524 }
2524 2525
2525 2526
2527 void Assembler::TryAllocateArray(intptr_t cid,
2528 intptr_t instance_size,
2529 Label* failure,
2530 bool near_jump,
2531 Register instance,
2532 Register end_address) {
2533 ASSERT(failure != NULL);
2534 if (FLAG_inline_alloc) {
2535 Isolate* isolate = Isolate::Current();
2536 Heap* heap = isolate->heap();
2537 movl(instance, Address::Absolute(heap->TopAddress()));
2538 movl(end_address, instance);
2539
2540 addl(end_address, Immediate(instance_size));
2541 j(CARRY, failure);
2542
2543 // Check if the allocation fits into the remaining space.
2544 // EAX: potential new object start.
2545 // EBX: potential next object start.
2546 cmpl(end_address, Address::Absolute(heap->EndAddress()));
2547 j(ABOVE_EQUAL, failure);
2548
2549 // Successfully allocated the object(s), now update top to point to
2550 // next object start and initialize the object.
2551 movl(Address::Absolute(heap->TopAddress()), end_address);
2552 addl(instance, Immediate(kHeapObjectTag));
2553 UpdateAllocationStatsWithSize(cid, instance_size, kNoRegister);
2554
2555 // Initialize the tags.
2556 uword tags = 0;
2557 tags = RawObject::ClassIdTag::update(cid, tags);
2558 tags = RawObject::SizeTag::update(instance_size, tags);
2559 movl(FieldAddress(instance, Object::tags_offset()), Immediate(tags));
2560 } else {
2561 jmp(failure);
2562 }
2563 }
2564
2565
2526 void Assembler::EnterDartFrame(intptr_t frame_size) { 2566 void Assembler::EnterDartFrame(intptr_t frame_size) {
2527 EnterFrame(0); 2567 EnterFrame(0);
2528 Label dart_entry; 2568 Label dart_entry;
2529 call(&dart_entry); 2569 call(&dart_entry);
2530 Bind(&dart_entry); 2570 Bind(&dart_entry);
2531 // The runtime system assumes that the code marker address is 2571 // The runtime system assumes that the code marker address is
2532 // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code 2572 // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code
2533 // generated before entering the frame, the address needs to be adjusted. 2573 // generated before entering the frame, the address needs to be adjusted.
2534 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize(); 2574 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize();
2535 if (offset != 0) { 2575 if (offset != 0) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 2849
2810 const char* Assembler::FpuRegisterName(FpuRegister reg) { 2850 const char* Assembler::FpuRegisterName(FpuRegister reg) {
2811 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 2851 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
2812 return xmm_reg_names[reg]; 2852 return xmm_reg_names[reg];
2813 } 2853 }
2814 2854
2815 2855
2816 } // namespace dart 2856 } // namespace dart
2817 2857
2818 #endif // defined TARGET_ARCH_IA32 2858 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698