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

Side by Side Diff: src/ia32/code-stubs-ia32.h

Issue 6794052: Combine the incremental-marking write barrier and the remembered-set... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 8 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
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 const char* GetName() { return "NumberToStringStub"; } 498 const char* GetName() { return "NumberToStringStub"; }
499 499
500 #ifdef DEBUG 500 #ifdef DEBUG
501 void Print() { 501 void Print() {
502 PrintF("NumberToStringStub\n"); 502 PrintF("NumberToStringStub\n");
503 } 503 }
504 #endif 504 #endif
505 }; 505 };
506 506
507 507
508 class IncrementalMarkingRecordWriteStub: public CodeStub { 508 class RecordWriteStub: public CodeStub {
509 public: 509 public:
510 IncrementalMarkingRecordWriteStub(Register object, 510 RecordWriteStub(Register object,
511 Register value, 511 Register value,
512 Register scratch, 512 Register address,
513 ObjectMode object_mode, 513 EmitRememberedSet emit_remembered_set,
514 ValueMode value_mode, 514 SaveFPRegsMode fp_mode)
515 ScratchMode scratch_mode)
516 : object_(object), 515 : object_(object),
517 value_(value), 516 value_(value),
518 scratch_(scratch), 517 address_(address),
519 object_mode_(object_mode), 518 emit_remembered_set_(emit_remembered_set),
520 value_mode_(value_mode), 519 save_fp_regs_mode_(fp_mode) {
521 scratch_mode_(scratch_mode) {
522 } 520 }
523 521
522 static const byte kTwoByteNopInstruction = 0x3c; // Cmpb al, #imm8.
523 static const byte kSkipIncrementalPartInstruction = 0xeb; // Jmp #imm8.
524 524
525 static byte GetInstruction(bool enable) { 525 static byte GetInstruction(bool enable) {
526 static const byte kNopInstruction = 0x90; 526 // Can't use ternary operator here, because gcc makes an undefined
527 static const byte kRet0Instruction = 0xc3; 527 // reference to a static const int.
528 return enable ? kNopInstruction : kRet0Instruction; 528 if (enable) {
529 return kTwoByteNopInstruction;
530 } else {
531 return kSkipIncrementalPartInstruction;
532 }
529 } 533 }
530 534
531 static void Patch(Code* stub, bool enable) { 535 static void Patch(Code* stub, bool enable) {
532 ASSERT(*stub->instruction_start() == GetInstruction(!enable)); 536 ASSERT(*stub->instruction_start() == GetInstruction(!enable));
533 *stub->instruction_start() = GetInstruction(enable); 537 *stub->instruction_start() = GetInstruction(enable);
534 } 538 }
535 539
536 private: 540 private:
537 void Generate(MacroAssembler* masm); 541 void Generate(MacroAssembler* masm);
538 542
539 Major MajorKey() { return IncrementalMarkingRecordWrite; } 543 Major MajorKey() { return RecordWrite; }
540 544
541 int MinorKey() { 545 int MinorKey() {
542 return ObjectBits::encode(object_.code()) | 546 return ObjectBits::encode(object_.code()) |
543 ValueBits::encode(value_.code()) | 547 ValueBits::encode(value_.code()) |
544 ScratchBits::encode(scratch_.code()) | 548 AddressBits::encode(address_.code()) |
545 ObjectModeBits::encode(object_mode_) | 549 EmitRememberedSetBits::encode(emit_remembered_set_) |
546 ValueModeBits::encode(value_mode_) | 550 SaveFPRegsModeBits::encode(save_fp_regs_mode_);
547 ScratchModeBits::encode(scratch_mode_);
548 } 551 }
549 552
550 class ObjectBits: public BitField<int, 0, 3> {}; 553 class ObjectBits: public BitField<int, 0, 3> {};
551 class ValueBits: public BitField<int, 3, 3> {}; 554 class ValueBits: public BitField<int, 3, 3> {};
552 class ScratchBits: public BitField<int, 6, 3> {}; 555 class AddressBits: public BitField<int, 6, 3> {};
553 class ObjectModeBits: public BitField<ObjectMode, 9, 1> {}; 556 class EmitRememberedSetBits: public BitField<EmitRememberedSet, 9, 1> {};
554 class ValueModeBits: public BitField<ValueMode, 10, 1> {}; 557 class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 10, 1> {};
555 class ScratchModeBits: public BitField<ScratchMode, 11, 1> {};
556 558
557 Register object_; 559 Register object_;
558 Register value_; 560 Register value_;
559 Register scratch_; 561 Register address_;
560 ObjectMode object_mode_; 562 EmitRememberedSet emit_remembered_set_;
561 ValueMode value_mode_; 563 SaveFPRegsMode save_fp_regs_mode_;
562 ScratchMode scratch_mode_;
563 }; 564 };
564 565
565 566
566 // Generate code to load an element from a pixel array. The receiver is assumed 567 // Generate code to load an element from a pixel array. The receiver is assumed
567 // to not be a smi and to have elements, the caller must guarantee this 568 // to not be a smi and to have elements, the caller must guarantee this
568 // precondition. If key is not a smi, then the generated code branches to 569 // precondition. If key is not a smi, then the generated code branches to
569 // key_not_smi. Callers can specify NULL for key_not_smi to signal that a smi 570 // key_not_smi. Callers can specify NULL for key_not_smi to signal that a smi
570 // check has already been performed on key so that the smi check is not 571 // check has already been performed on key so that the smi check is not
571 // generated. If key is not a valid index within the bounds of the pixel array, 572 // generated. If key is not a valid index within the bounds of the pixel array,
572 // the generated code jumps to out_of_range. receiver, key and elements are 573 // the generated code jumps to out_of_range. receiver, key and elements are
(...skipping 27 matching lines...) Expand all
600 Register scratch1, 601 Register scratch1,
601 bool load_elements_from_receiver, 602 bool load_elements_from_receiver,
602 Label* key_not_smi, 603 Label* key_not_smi,
603 Label* value_not_smi, 604 Label* value_not_smi,
604 Label* not_pixel_array, 605 Label* not_pixel_array,
605 Label* out_of_range); 606 Label* out_of_range);
606 607
607 } } // namespace v8::internal 608 } } // namespace v8::internal
608 609
609 #endif // V8_IA32_CODE_STUBS_IA32_H_ 610 #endif // V8_IA32_CODE_STUBS_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698