Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3338 | 3338 |
| 3339 | 3339 |
| 3340 void Assembler::LeaveStubFrame() { | 3340 void Assembler::LeaveStubFrame() { |
| 3341 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); | 3341 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); |
| 3342 // Adjust SP for null PC pushed in EnterStubFrame. | 3342 // Adjust SP for null PC pushed in EnterStubFrame. |
| 3343 AddImmediate(SP, kWordSize); | 3343 AddImmediate(SP, kWordSize); |
| 3344 } | 3344 } |
| 3345 | 3345 |
| 3346 | 3346 |
| 3347 void Assembler::LoadAllocationStatsAddress(Register dest, | 3347 void Assembler::LoadAllocationStatsAddress(Register dest, |
| 3348 intptr_t cid) { | 3348 intptr_t cid, |
| 3349 bool inline_isolate) { | |
| 3349 ASSERT(dest != kNoRegister); | 3350 ASSERT(dest != kNoRegister); |
| 3350 ASSERT(dest != TMP); | 3351 ASSERT(dest != TMP); |
| 3351 ASSERT(cid > 0); | 3352 ASSERT(cid > 0); |
| 3352 Isolate* isolate = Isolate::Current(); | 3353 ClassTable* class_table = Isolate::Current()->class_table(); |
| 3353 ClassTable* class_table = isolate->class_table(); | 3354 ClassHeapStats** table_ptr = class_table->TableAddressFor(cid); |
| 3354 if (cid < kNumPredefinedCids) { | 3355 const intptr_t class_offset = ClassTable::ClassOffsetFor(cid); |
| 3355 const uword class_heap_stats_table_address = | 3356 if (cid < kNumPredefinedCids && inline_isolate) { |
| 3356 class_table->PredefinedClassHeapStatsTableAddress(); | 3357 LoadImmediate(dest, reinterpret_cast<uword>(*table_ptr) + class_offset); |
| 3357 const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT | |
| 3358 LoadImmediate(dest, class_heap_stats_table_address + class_offset); | |
| 3359 } else { | 3358 } else { |
| 3360 const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT | 3359 if (inline_isolate) { |
| 3361 LoadImmediate(dest, class_table->ClassStatsTableAddress()); | 3360 LoadImmediate(dest, reinterpret_cast<uword>(table_ptr)); |
| 3362 ldr(dest, Address(dest, 0)); | 3361 ldr(dest, Address(dest, 0)); |
| 3362 } else { | |
| 3363 LoadIsolate(dest); | |
|
koda
2015/07/16 15:45:18
In this branch, one must not use "class_table", no
Florian Schneider
2015/07/17 07:40:40
Ok, I'll try to rearrange the code accordingly by
| |
| 3364 intptr_t table_offset = | |
| 3365 Isolate::class_table_offset() + ClassTable::TableOffsetFor(cid); | |
| 3366 ldr(dest, Address(dest, table_offset)); | |
| 3367 } | |
| 3363 AddImmediate(dest, class_offset); | 3368 AddImmediate(dest, class_offset); |
| 3364 } | 3369 } |
| 3365 } | 3370 } |
| 3366 | 3371 |
| 3367 | 3372 |
| 3368 void Assembler::MaybeTraceAllocation(intptr_t cid, | 3373 void Assembler::MaybeTraceAllocation(intptr_t cid, |
| 3369 Register temp_reg, | 3374 Register temp_reg, |
| 3370 Label* trace) { | 3375 Label* trace) { |
| 3371 LoadAllocationStatsAddress(temp_reg, cid); | 3376 LoadAllocationStatsAddress(temp_reg, cid); |
| 3372 const uword state_offset = ClassHeapStats::state_offset(); | 3377 const uword state_offset = ClassHeapStats::state_offset(); |
| 3373 const Address& state_address = Address(temp_reg, state_offset); | 3378 ldr(temp_reg, Address(temp_reg, state_offset)); |
| 3374 ldr(temp_reg, state_address); | |
| 3375 tst(temp_reg, Operand(ClassHeapStats::TraceAllocationMask())); | 3379 tst(temp_reg, Operand(ClassHeapStats::TraceAllocationMask())); |
| 3376 b(trace, NE); | 3380 b(trace, NE); |
| 3377 } | 3381 } |
| 3378 | 3382 |
| 3379 | 3383 |
| 3380 void Assembler::IncrementAllocationStats(Register stats_addr_reg, | 3384 void Assembler::IncrementAllocationStats(Register stats_addr_reg, |
| 3381 intptr_t cid, | 3385 intptr_t cid, |
| 3382 Heap::Space space) { | 3386 Heap::Space space) { |
| 3383 ASSERT(stats_addr_reg != kNoRegister); | 3387 ASSERT(stats_addr_reg != kNoRegister); |
| 3384 ASSERT(stats_addr_reg != TMP); | 3388 ASSERT(stats_addr_reg != TMP); |
| 3385 ASSERT(cid > 0); | 3389 ASSERT(cid > 0); |
| 3386 const uword count_field_offset = (space == Heap::kNew) ? | 3390 const uword count_field_offset = (space == Heap::kNew) ? |
| 3387 ClassHeapStats::allocated_since_gc_new_space_offset() : | 3391 ClassHeapStats::allocated_since_gc_new_space_offset() : |
| 3388 ClassHeapStats::allocated_since_gc_old_space_offset(); | 3392 ClassHeapStats::allocated_since_gc_old_space_offset(); |
| 3389 const Address& count_address = Address(stats_addr_reg, count_field_offset); | 3393 const Address& count_address = Address(stats_addr_reg, count_field_offset); |
| 3390 ldr(TMP, count_address); | 3394 ldr(TMP, count_address); |
| 3391 AddImmediate(TMP, 1); | 3395 AddImmediate(TMP, 1); |
| 3392 str(TMP, count_address); | 3396 str(TMP, count_address); |
| 3393 } | 3397 } |
| 3394 | 3398 |
| 3395 | 3399 |
| 3396 void Assembler::IncrementAllocationStatsWithSize(Register stats_addr_reg, | 3400 void Assembler::IncrementAllocationStatsWithSize(Register stats_addr_reg, |
| 3397 Register size_reg, | 3401 Register size_reg, |
| 3398 intptr_t cid, | |
| 3399 Heap::Space space) { | 3402 Heap::Space space) { |
| 3400 ASSERT(stats_addr_reg != kNoRegister); | 3403 ASSERT(stats_addr_reg != kNoRegister); |
| 3401 ASSERT(stats_addr_reg != TMP); | 3404 ASSERT(stats_addr_reg != TMP); |
| 3402 ASSERT(cid > 0); | |
| 3403 const uword count_field_offset = (space == Heap::kNew) ? | 3405 const uword count_field_offset = (space == Heap::kNew) ? |
| 3404 ClassHeapStats::allocated_since_gc_new_space_offset() : | 3406 ClassHeapStats::allocated_since_gc_new_space_offset() : |
| 3405 ClassHeapStats::allocated_since_gc_old_space_offset(); | 3407 ClassHeapStats::allocated_since_gc_old_space_offset(); |
| 3406 const uword size_field_offset = (space == Heap::kNew) ? | 3408 const uword size_field_offset = (space == Heap::kNew) ? |
| 3407 ClassHeapStats::allocated_size_since_gc_new_space_offset() : | 3409 ClassHeapStats::allocated_size_since_gc_new_space_offset() : |
| 3408 ClassHeapStats::allocated_size_since_gc_old_space_offset(); | 3410 ClassHeapStats::allocated_size_since_gc_old_space_offset(); |
| 3409 const Address& count_address = Address(stats_addr_reg, count_field_offset); | 3411 const Address& count_address = Address(stats_addr_reg, count_field_offset); |
| 3410 const Address& size_address = Address(stats_addr_reg, size_field_offset); | 3412 const Address& size_address = Address(stats_addr_reg, size_field_offset); |
| 3411 ldr(TMP, count_address); | 3413 ldr(TMP, count_address); |
| 3412 AddImmediate(TMP, 1); | 3414 AddImmediate(TMP, 1); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3508 | 3510 |
| 3509 // Initialize the tags. | 3511 // Initialize the tags. |
| 3510 // instance: new object start as a tagged pointer. | 3512 // instance: new object start as a tagged pointer. |
| 3511 uword tags = 0; | 3513 uword tags = 0; |
| 3512 tags = RawObject::ClassIdTag::update(cid, tags); | 3514 tags = RawObject::ClassIdTag::update(cid, tags); |
| 3513 tags = RawObject::SizeTag::update(instance_size, tags); | 3515 tags = RawObject::SizeTag::update(instance_size, tags); |
| 3514 LoadImmediate(temp1, tags); | 3516 LoadImmediate(temp1, tags); |
| 3515 str(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. | 3517 str(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. |
| 3516 | 3518 |
| 3517 LoadImmediate(temp1, instance_size); | 3519 LoadImmediate(temp1, instance_size); |
| 3518 IncrementAllocationStatsWithSize(temp2, temp1, cid, space); | 3520 IncrementAllocationStatsWithSize(temp2, temp1, space); |
| 3519 } else { | 3521 } else { |
| 3520 b(failure); | 3522 b(failure); |
| 3521 } | 3523 } |
| 3522 } | 3524 } |
| 3523 | 3525 |
| 3524 | 3526 |
| 3525 void Assembler::Stop(const char* message) { | 3527 void Assembler::Stop(const char* message) { |
| 3526 if (FLAG_print_stop_message) { | 3528 if (FLAG_print_stop_message) { |
| 3527 StubCode* stub_code = Isolate::Current()->stub_code(); | 3529 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 3528 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. | 3530 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3630 | 3632 |
| 3631 | 3633 |
| 3632 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3634 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3633 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3635 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3634 return fpu_reg_names[reg]; | 3636 return fpu_reg_names[reg]; |
| 3635 } | 3637 } |
| 3636 | 3638 |
| 3637 } // namespace dart | 3639 } // namespace dart |
| 3638 | 3640 |
| 3639 #endif // defined TARGET_ARCH_ARM | 3641 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |