| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 ASSERT(!value.is(address)); | 501 ASSERT(!value.is(address)); |
| 502 AssertNotSmi(object); | 502 AssertNotSmi(object); |
| 503 | 503 |
| 504 if (!FLAG_incremental_marking) { | 504 if (!FLAG_incremental_marking) { |
| 505 return; | 505 return; |
| 506 } | 506 } |
| 507 | 507 |
| 508 // Compute the address. | 508 // Compute the address. |
| 509 lea(address, FieldOperand(object, HeapObject::kMapOffset)); | 509 lea(address, FieldOperand(object, HeapObject::kMapOffset)); |
| 510 | 510 |
| 511 // Count number of write barriers in generated code. | |
| 512 isolate()->counters()->write_barriers_static()->Increment(); | |
| 513 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | |
| 514 | |
| 515 // A single check of the map's pages interesting flag suffices, since it is | 511 // A single check of the map's pages interesting flag suffices, since it is |
| 516 // only set during incremental collection, and then it's also guaranteed that | 512 // only set during incremental collection, and then it's also guaranteed that |
| 517 // the from object's page's interesting flag is also set. This optimization | 513 // the from object's page's interesting flag is also set. This optimization |
| 518 // relies on the fact that maps can never be in new space. | 514 // relies on the fact that maps can never be in new space. |
| 519 ASSERT(!isolate()->heap()->InNewSpace(*map)); | 515 ASSERT(!isolate()->heap()->InNewSpace(*map)); |
| 520 CheckPageFlagForMap(map, | 516 CheckPageFlagForMap(map, |
| 521 MemoryChunk::kPointersToHereAreInterestingMask, | 517 MemoryChunk::kPointersToHereAreInterestingMask, |
| 522 zero, | 518 zero, |
| 523 &done, | 519 &done, |
| 524 Label::kNear); | 520 Label::kNear); |
| 525 | 521 |
| 526 RecordWriteStub stub(isolate(), object, value, address, OMIT_REMEMBERED_SET, | 522 RecordWriteStub stub(isolate(), object, value, address, OMIT_REMEMBERED_SET, |
| 527 save_fp); | 523 save_fp); |
| 528 CallStub(&stub); | 524 CallStub(&stub); |
| 529 | 525 |
| 530 bind(&done); | 526 bind(&done); |
| 531 | 527 |
| 528 // Count number of write barriers in generated code. |
| 529 isolate()->counters()->write_barriers_static()->Increment(); |
| 530 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
| 531 |
| 532 // Clobber clobbered input registers when running with the debug-code flag | 532 // Clobber clobbered input registers when running with the debug-code flag |
| 533 // turned on to provoke errors. | 533 // turned on to provoke errors. |
| 534 if (emit_debug_code()) { | 534 if (emit_debug_code()) { |
| 535 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 535 mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
| 536 mov(scratch1, Immediate(BitCast<int32_t>(kZapValue))); | 536 mov(scratch1, Immediate(BitCast<int32_t>(kZapValue))); |
| 537 mov(scratch2, Immediate(BitCast<int32_t>(kZapValue))); | 537 mov(scratch2, Immediate(BitCast<int32_t>(kZapValue))); |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 | 541 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 558 } | 558 } |
| 559 | 559 |
| 560 if (emit_debug_code()) { | 560 if (emit_debug_code()) { |
| 561 Label ok; | 561 Label ok; |
| 562 cmp(value, Operand(address, 0)); | 562 cmp(value, Operand(address, 0)); |
| 563 j(equal, &ok, Label::kNear); | 563 j(equal, &ok, Label::kNear); |
| 564 int3(); | 564 int3(); |
| 565 bind(&ok); | 565 bind(&ok); |
| 566 } | 566 } |
| 567 | 567 |
| 568 // Count number of write barriers in generated code. | |
| 569 isolate()->counters()->write_barriers_static()->Increment(); | |
| 570 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | |
| 571 | |
| 572 // First, check if a write barrier is even needed. The tests below | 568 // First, check if a write barrier is even needed. The tests below |
| 573 // catch stores of Smis and stores into young gen. | 569 // catch stores of Smis and stores into young gen. |
| 574 Label done; | 570 Label done; |
| 575 | 571 |
| 576 if (smi_check == INLINE_SMI_CHECK) { | 572 if (smi_check == INLINE_SMI_CHECK) { |
| 577 // Skip barrier if writing a smi. | 573 // Skip barrier if writing a smi. |
| 578 JumpIfSmi(value, &done, Label::kNear); | 574 JumpIfSmi(value, &done, Label::kNear); |
| 579 } | 575 } |
| 580 | 576 |
| 581 if (pointers_to_here_check_for_value != kPointersToHereAreAlwaysInteresting) { | 577 if (pointers_to_here_check_for_value != kPointersToHereAreAlwaysInteresting) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 592 zero, | 588 zero, |
| 593 &done, | 589 &done, |
| 594 Label::kNear); | 590 Label::kNear); |
| 595 | 591 |
| 596 RecordWriteStub stub(isolate(), object, value, address, remembered_set_action, | 592 RecordWriteStub stub(isolate(), object, value, address, remembered_set_action, |
| 597 fp_mode); | 593 fp_mode); |
| 598 CallStub(&stub); | 594 CallStub(&stub); |
| 599 | 595 |
| 600 bind(&done); | 596 bind(&done); |
| 601 | 597 |
| 598 // Count number of write barriers in generated code. |
| 599 isolate()->counters()->write_barriers_static()->Increment(); |
| 600 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
| 601 |
| 602 // Clobber clobbered registers when running with the debug-code flag | 602 // Clobber clobbered registers when running with the debug-code flag |
| 603 // turned on to provoke errors. | 603 // turned on to provoke errors. |
| 604 if (emit_debug_code()) { | 604 if (emit_debug_code()) { |
| 605 mov(address, Immediate(BitCast<int32_t>(kZapValue))); | 605 mov(address, Immediate(BitCast<int32_t>(kZapValue))); |
| 606 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 606 mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
| 607 } | 607 } |
| 608 } | 608 } |
| 609 | 609 |
| 610 | 610 |
| 611 void MacroAssembler::DebugBreak() { | 611 void MacroAssembler::DebugBreak() { |
| (...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3430 if (ms.shift() > 0) sar(edx, ms.shift()); | 3430 if (ms.shift() > 0) sar(edx, ms.shift()); |
| 3431 mov(eax, dividend); | 3431 mov(eax, dividend); |
| 3432 shr(eax, 31); | 3432 shr(eax, 31); |
| 3433 add(edx, eax); | 3433 add(edx, eax); |
| 3434 } | 3434 } |
| 3435 | 3435 |
| 3436 | 3436 |
| 3437 } } // namespace v8::internal | 3437 } } // namespace v8::internal |
| 3438 | 3438 |
| 3439 #endif // V8_TARGET_ARCH_IA32 | 3439 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |