OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4421 | 4421 |
4422 if (emit_debug_code()) { | 4422 if (emit_debug_code()) { |
4423 UseScratchRegisterScope temps(this); | 4423 UseScratchRegisterScope temps(this); |
4424 Register temp = temps.AcquireX(); | 4424 Register temp = temps.AcquireX(); |
4425 | 4425 |
4426 Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset)); | 4426 Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset)); |
4427 Cmp(temp, map); | 4427 Cmp(temp, map); |
4428 Check(eq, kWrongAddressOrValuePassedToRecordWrite); | 4428 Check(eq, kWrongAddressOrValuePassedToRecordWrite); |
4429 } | 4429 } |
4430 | 4430 |
4431 // Count number of write barriers in generated code. | |
4432 isolate()->counters()->write_barriers_static()->Increment(); | |
4433 // TODO(mstarzinger): Dynamic counter missing. | |
4434 | |
4435 // First, check if a write barrier is even needed. The tests below | 4431 // First, check if a write barrier is even needed. The tests below |
4436 // catch stores of smis and stores into the young generation. | 4432 // catch stores of smis and stores into the young generation. |
4437 Label done; | 4433 Label done; |
4438 | 4434 |
4439 // A single check of the map's pages interesting flag suffices, since it is | 4435 // A single check of the map's pages interesting flag suffices, since it is |
4440 // only set during incremental collection, and then it's also guaranteed that | 4436 // only set during incremental collection, and then it's also guaranteed that |
4441 // the from object's page's interesting flag is also set. This optimization | 4437 // the from object's page's interesting flag is also set. This optimization |
4442 // relies on the fact that maps can never be in new space. | 4438 // relies on the fact that maps can never be in new space. |
4443 CheckPageFlagClear(map, | 4439 CheckPageFlagClear(map, |
4444 map, // Used as scratch. | 4440 map, // Used as scratch. |
4445 MemoryChunk::kPointersToHereAreInterestingMask, | 4441 MemoryChunk::kPointersToHereAreInterestingMask, |
4446 &done); | 4442 &done); |
4447 | 4443 |
4448 // Record the actual write. | 4444 // Record the actual write. |
4449 if (lr_status == kLRHasNotBeenSaved) { | 4445 if (lr_status == kLRHasNotBeenSaved) { |
4450 Push(lr); | 4446 Push(lr); |
4451 } | 4447 } |
4452 Add(dst, object, HeapObject::kMapOffset - kHeapObjectTag); | 4448 Add(dst, object, HeapObject::kMapOffset - kHeapObjectTag); |
4453 RecordWriteStub stub(isolate(), object, map, dst, OMIT_REMEMBERED_SET, | 4449 RecordWriteStub stub(isolate(), object, map, dst, OMIT_REMEMBERED_SET, |
4454 fp_mode); | 4450 fp_mode); |
4455 CallStub(&stub); | 4451 CallStub(&stub); |
4456 if (lr_status == kLRHasNotBeenSaved) { | 4452 if (lr_status == kLRHasNotBeenSaved) { |
4457 Pop(lr); | 4453 Pop(lr); |
4458 } | 4454 } |
4459 | 4455 |
4460 Bind(&done); | 4456 Bind(&done); |
4461 | 4457 |
| 4458 // Count number of write barriers in generated code. |
| 4459 isolate()->counters()->write_barriers_static()->Increment(); |
| 4460 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, map, |
| 4461 dst); |
| 4462 |
4462 // Clobber clobbered registers when running with the debug-code flag | 4463 // Clobber clobbered registers when running with the debug-code flag |
4463 // turned on to provoke errors. | 4464 // turned on to provoke errors. |
4464 if (emit_debug_code()) { | 4465 if (emit_debug_code()) { |
4465 Mov(dst, Operand(BitCast<int64_t>(kZapValue + 12))); | 4466 Mov(dst, Operand(BitCast<int64_t>(kZapValue + 12))); |
4466 Mov(map, Operand(BitCast<int64_t>(kZapValue + 16))); | 4467 Mov(map, Operand(BitCast<int64_t>(kZapValue + 16))); |
4467 } | 4468 } |
4468 } | 4469 } |
4469 | 4470 |
4470 | 4471 |
4471 // Will clobber: object, address, value. | 4472 // Will clobber: object, address, value. |
(...skipping 15 matching lines...) Expand all Loading... |
4487 | 4488 |
4488 if (emit_debug_code()) { | 4489 if (emit_debug_code()) { |
4489 UseScratchRegisterScope temps(this); | 4490 UseScratchRegisterScope temps(this); |
4490 Register temp = temps.AcquireX(); | 4491 Register temp = temps.AcquireX(); |
4491 | 4492 |
4492 Ldr(temp, MemOperand(address)); | 4493 Ldr(temp, MemOperand(address)); |
4493 Cmp(temp, value); | 4494 Cmp(temp, value); |
4494 Check(eq, kWrongAddressOrValuePassedToRecordWrite); | 4495 Check(eq, kWrongAddressOrValuePassedToRecordWrite); |
4495 } | 4496 } |
4496 | 4497 |
4497 // Count number of write barriers in generated code. | |
4498 isolate()->counters()->write_barriers_static()->Increment(); | |
4499 // TODO(mstarzinger): Dynamic counter missing. | |
4500 | |
4501 // First, check if a write barrier is even needed. The tests below | 4498 // First, check if a write barrier is even needed. The tests below |
4502 // catch stores of smis and stores into the young generation. | 4499 // catch stores of smis and stores into the young generation. |
4503 Label done; | 4500 Label done; |
4504 | 4501 |
4505 if (smi_check == INLINE_SMI_CHECK) { | 4502 if (smi_check == INLINE_SMI_CHECK) { |
4506 ASSERT_EQ(0, kSmiTag); | 4503 ASSERT_EQ(0, kSmiTag); |
4507 JumpIfSmi(value, &done); | 4504 JumpIfSmi(value, &done); |
4508 } | 4505 } |
4509 | 4506 |
4510 if (pointers_to_here_check_for_value != kPointersToHereAreAlwaysInteresting) { | 4507 if (pointers_to_here_check_for_value != kPointersToHereAreAlwaysInteresting) { |
(...skipping 13 matching lines...) Expand all Loading... |
4524 } | 4521 } |
4525 RecordWriteStub stub(isolate(), object, value, address, remembered_set_action, | 4522 RecordWriteStub stub(isolate(), object, value, address, remembered_set_action, |
4526 fp_mode); | 4523 fp_mode); |
4527 CallStub(&stub); | 4524 CallStub(&stub); |
4528 if (lr_status == kLRHasNotBeenSaved) { | 4525 if (lr_status == kLRHasNotBeenSaved) { |
4529 Pop(lr); | 4526 Pop(lr); |
4530 } | 4527 } |
4531 | 4528 |
4532 Bind(&done); | 4529 Bind(&done); |
4533 | 4530 |
| 4531 // Count number of write barriers in generated code. |
| 4532 isolate()->counters()->write_barriers_static()->Increment(); |
| 4533 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, address, |
| 4534 value); |
| 4535 |
4534 // Clobber clobbered registers when running with the debug-code flag | 4536 // Clobber clobbered registers when running with the debug-code flag |
4535 // turned on to provoke errors. | 4537 // turned on to provoke errors. |
4536 if (emit_debug_code()) { | 4538 if (emit_debug_code()) { |
4537 Mov(address, Operand(BitCast<int64_t>(kZapValue + 12))); | 4539 Mov(address, Operand(BitCast<int64_t>(kZapValue + 12))); |
4538 Mov(value, Operand(BitCast<int64_t>(kZapValue + 16))); | 4540 Mov(value, Operand(BitCast<int64_t>(kZapValue + 16))); |
4539 } | 4541 } |
4540 } | 4542 } |
4541 | 4543 |
4542 | 4544 |
4543 void MacroAssembler::AssertHasValidColor(const Register& reg) { | 4545 void MacroAssembler::AssertHasValidColor(const Register& reg) { |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5373 } | 5375 } |
5374 } | 5376 } |
5375 | 5377 |
5376 | 5378 |
5377 #undef __ | 5379 #undef __ |
5378 | 5380 |
5379 | 5381 |
5380 } } // namespace v8::internal | 5382 } } // namespace v8::internal |
5381 | 5383 |
5382 #endif // V8_TARGET_ARCH_ARM64 | 5384 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |