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_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 ASSERT(!value.is(address)); | 421 ASSERT(!value.is(address)); |
422 AssertNotSmi(object); | 422 AssertNotSmi(object); |
423 | 423 |
424 if (!FLAG_incremental_marking) { | 424 if (!FLAG_incremental_marking) { |
425 return; | 425 return; |
426 } | 426 } |
427 | 427 |
428 // Compute the address. | 428 // Compute the address. |
429 lea(address, FieldOperand(object, HeapObject::kMapOffset)); | 429 lea(address, FieldOperand(object, HeapObject::kMapOffset)); |
430 | 430 |
431 // Count number of write barriers in generated code. | |
432 isolate()->counters()->write_barriers_static()->Increment(); | |
433 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | |
434 | |
435 // A single check of the map's pages interesting flag suffices, since it is | 431 // A single check of the map's pages interesting flag suffices, since it is |
436 // only set during incremental collection, and then it's also guaranteed that | 432 // only set during incremental collection, and then it's also guaranteed that |
437 // the from object's page's interesting flag is also set. This optimization | 433 // the from object's page's interesting flag is also set. This optimization |
438 // relies on the fact that maps can never be in new space. | 434 // relies on the fact that maps can never be in new space. |
439 ASSERT(!isolate()->heap()->InNewSpace(*map)); | 435 ASSERT(!isolate()->heap()->InNewSpace(*map)); |
440 CheckPageFlagForMap(map, | 436 CheckPageFlagForMap(map, |
441 MemoryChunk::kPointersToHereAreInterestingMask, | 437 MemoryChunk::kPointersToHereAreInterestingMask, |
442 zero, | 438 zero, |
443 &done, | 439 &done, |
444 Label::kNear); | 440 Label::kNear); |
445 | 441 |
446 RecordWriteStub stub(isolate(), object, value, address, OMIT_REMEMBERED_SET); | 442 RecordWriteStub stub(isolate(), object, value, address, OMIT_REMEMBERED_SET); |
447 CallStub(&stub); | 443 CallStub(&stub); |
448 | 444 |
449 bind(&done); | 445 bind(&done); |
450 | 446 |
| 447 // Count number of write barriers in generated code. |
| 448 isolate()->counters()->write_barriers_static()->Increment(); |
| 449 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
| 450 |
451 // Clobber clobbered input registers when running with the debug-code flag | 451 // Clobber clobbered input registers when running with the debug-code flag |
452 // turned on to provoke errors. | 452 // turned on to provoke errors. |
453 if (emit_debug_code()) { | 453 if (emit_debug_code()) { |
454 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 454 mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
455 mov(scratch1, Immediate(BitCast<int32_t>(kZapValue))); | 455 mov(scratch1, Immediate(BitCast<int32_t>(kZapValue))); |
456 mov(scratch2, Immediate(BitCast<int32_t>(kZapValue))); | 456 mov(scratch2, Immediate(BitCast<int32_t>(kZapValue))); |
457 } | 457 } |
458 } | 458 } |
459 | 459 |
460 | 460 |
(...skipping 15 matching lines...) Expand all Loading... |
476 } | 476 } |
477 | 477 |
478 if (emit_debug_code()) { | 478 if (emit_debug_code()) { |
479 Label ok; | 479 Label ok; |
480 cmp(value, Operand(address, 0)); | 480 cmp(value, Operand(address, 0)); |
481 j(equal, &ok, Label::kNear); | 481 j(equal, &ok, Label::kNear); |
482 int3(); | 482 int3(); |
483 bind(&ok); | 483 bind(&ok); |
484 } | 484 } |
485 | 485 |
486 // Count number of write barriers in generated code. | |
487 isolate()->counters()->write_barriers_static()->Increment(); | |
488 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | |
489 | |
490 // First, check if a write barrier is even needed. The tests below | 486 // First, check if a write barrier is even needed. The tests below |
491 // catch stores of Smis and stores into young gen. | 487 // catch stores of Smis and stores into young gen. |
492 Label done; | 488 Label done; |
493 | 489 |
494 if (smi_check == INLINE_SMI_CHECK) { | 490 if (smi_check == INLINE_SMI_CHECK) { |
495 // Skip barrier if writing a smi. | 491 // Skip barrier if writing a smi. |
496 JumpIfSmi(value, &done, Label::kNear); | 492 JumpIfSmi(value, &done, Label::kNear); |
497 } | 493 } |
498 | 494 |
499 if (pointers_to_here_check_for_value != kPointersToHereAreAlwaysInteresting) { | 495 if (pointers_to_here_check_for_value != kPointersToHereAreAlwaysInteresting) { |
(...skipping 10 matching lines...) Expand all Loading... |
510 zero, | 506 zero, |
511 &done, | 507 &done, |
512 Label::kNear); | 508 Label::kNear); |
513 | 509 |
514 RecordWriteStub stub(isolate(), object, value, address, | 510 RecordWriteStub stub(isolate(), object, value, address, |
515 remembered_set_action); | 511 remembered_set_action); |
516 CallStub(&stub); | 512 CallStub(&stub); |
517 | 513 |
518 bind(&done); | 514 bind(&done); |
519 | 515 |
| 516 // Count number of write barriers in generated code. |
| 517 isolate()->counters()->write_barriers_static()->Increment(); |
| 518 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
| 519 |
520 // Clobber clobbered registers when running with the debug-code flag | 520 // Clobber clobbered registers when running with the debug-code flag |
521 // turned on to provoke errors. | 521 // turned on to provoke errors. |
522 if (emit_debug_code()) { | 522 if (emit_debug_code()) { |
523 mov(address, Immediate(BitCast<int32_t>(kZapValue))); | 523 mov(address, Immediate(BitCast<int32_t>(kZapValue))); |
524 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 524 mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
525 } | 525 } |
526 } | 526 } |
527 | 527 |
528 | 528 |
529 void MacroAssembler::DebugBreak() { | 529 void MacroAssembler::DebugBreak() { |
(...skipping 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3317 if (ms.shift() > 0) sar(edx, ms.shift()); | 3317 if (ms.shift() > 0) sar(edx, ms.shift()); |
3318 mov(eax, dividend); | 3318 mov(eax, dividend); |
3319 shr(eax, 31); | 3319 shr(eax, 31); |
3320 add(edx, eax); | 3320 add(edx, eax); |
3321 } | 3321 } |
3322 | 3322 |
3323 | 3323 |
3324 } } // namespace v8::internal | 3324 } } // namespace v8::internal |
3325 | 3325 |
3326 #endif // V8_TARGET_ARCH_X87 | 3326 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |