Commit 3ef636f7 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Minor-key-ify remaining code stubs.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/535733004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23643 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3071a64f
This diff is collapsed.
......@@ -75,36 +75,39 @@ class StringHelper : public AllStatic {
// so you don't have to set up the frame.
class WriteInt32ToHeapNumberStub : public PlatformCodeStub {
public:
WriteInt32ToHeapNumberStub(Isolate* isolate,
Register the_int,
Register the_heap_number,
Register scratch)
: PlatformCodeStub(isolate),
the_int_(the_int),
the_heap_number_(the_heap_number),
scratch_(scratch) { }
WriteInt32ToHeapNumberStub(Isolate* isolate, Register the_int,
Register the_heap_number, Register scratch)
: PlatformCodeStub(isolate) {
minor_key_ = IntRegisterBits::encode(the_int.code()) |
HeapNumberRegisterBits::encode(the_heap_number.code()) |
ScratchRegisterBits::encode(scratch.code());
}
static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
private:
Register the_int_;
Register the_heap_number_;
Register scratch_;
Major MajorKey() const { return WriteInt32ToHeapNumber; }
void Generate(MacroAssembler* masm);
Register the_int() const {
return Register::from_code(IntRegisterBits::decode(minor_key_));
}
Register the_heap_number() const {
return Register::from_code(HeapNumberRegisterBits::decode(minor_key_));
}
Register scratch() const {
return Register::from_code(ScratchRegisterBits::decode(minor_key_));
}
// Minor key encoding in 16 bits.
class IntRegisterBits: public BitField<int, 0, 4> {};
class HeapNumberRegisterBits: public BitField<int, 4, 4> {};
class ScratchRegisterBits: public BitField<int, 8, 4> {};
Major MajorKey() const { return WriteInt32ToHeapNumber; }
uint32_t MinorKey() const {
// Encode the parameters in a unique 16 bit value.
return IntRegisterBits::encode(the_int_.code())
| HeapNumberRegisterBits::encode(the_heap_number_.code())
| ScratchRegisterBits::encode(scratch_.code());
}
void Generate(MacroAssembler* masm);
DISALLOW_COPY_AND_ASSIGN(WriteInt32ToHeapNumberStub);
};
......@@ -117,14 +120,14 @@ class RecordWriteStub: public PlatformCodeStub {
RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode)
: PlatformCodeStub(isolate),
object_(object),
value_(value),
address_(address),
remembered_set_action_(remembered_set_action),
save_fp_regs_mode_(fp_mode),
regs_(object, // An input reg.
address, // An input reg.
value) { // One scratch reg.
minor_key_ = ObjectBits::encode(object.code()) |
ValueBits::encode(value.code()) |
AddressBits::encode(address.code()) |
RememberedSetActionBits::encode(remembered_set_action) |
SaveFPRegsModeBits::encode(fp_mode);
}
enum Mode {
......@@ -254,6 +257,8 @@ class RecordWriteStub: public PlatformCodeStub {
kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
};
Major MajorKey() const { return RecordWrite; }
void Generate(MacroAssembler* masm);
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
......@@ -262,18 +267,28 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
Major MajorKey() const { return RecordWrite; }
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
uint32_t MinorKey() const {
return ObjectBits::encode(object_.code()) |
ValueBits::encode(value_.code()) |
AddressBits::encode(address_.code()) |
RememberedSetActionBits::encode(remembered_set_action_) |
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));
}
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
Register value() const {
return Register::from_code(ValueBits::decode(minor_key_));
}
Register address() const {
return Register::from_code(AddressBits::decode(minor_key_));
}
RememberedSetAction remembered_set_action() const {
return RememberedSetActionBits::decode(minor_key_);
}
SaveFPRegsMode save_fp_regs_mode() const {
return SaveFPRegsModeBits::decode(minor_key_);
}
class ObjectBits: public BitField<int, 0, 4> {};
......@@ -282,13 +297,10 @@ class RecordWriteStub: public PlatformCodeStub {
class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {};
class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {};
Register object_;
Register value_;
Register address_;
RememberedSetAction remembered_set_action_;
SaveFPRegsMode save_fp_regs_mode_;
Label slow_;
RegisterAllocation regs_;
DISALLOW_COPY_AND_ASSIGN(RecordWriteStub);
};
......@@ -305,9 +317,10 @@ class DirectCEntryStub: public PlatformCodeStub {
private:
Major MajorKey() const { return DirectCEntry; }
uint32_t MinorKey() const { return 0; }
bool NeedsImmovableCode() { return true; }
DISALLOW_COPY_AND_ASSIGN(DirectCEntryStub);
};
......@@ -316,7 +329,9 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
NameDictionaryLookupStub(Isolate* isolate, LookupMode mode)
: PlatformCodeStub(isolate), mode_(mode) { }
: PlatformCodeStub(isolate) {
minor_key_ = LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
......@@ -352,11 +367,11 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
Major MajorKey() const { return NameDictionaryLookup; }
uint32_t MinorKey() const { return LookupModeBits::encode(mode_); }
LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
class LookupModeBits: public BitField<LookupMode, 0, 1> {};
LookupMode mode_;
DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub);
};
} } // namespace v8::internal
......
......@@ -4031,16 +4031,14 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
// but we need to save them before using them.
regs_.Save(masm);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
Label dont_need_remembered_set;
Register value = regs_.scratch0();
__ Ldr(value, MemOperand(regs_.address()));
__ JumpIfNotInNewSpace(value, &dont_need_remembered_set);
Register val = regs_.scratch0();
__ Ldr(val, MemOperand(regs_.address()));
__ JumpIfNotInNewSpace(val, &dont_need_remembered_set);
__ CheckPageFlagSet(regs_.object(),
value,
1 << MemoryChunk::SCAN_ON_SCAVENGE,
__ CheckPageFlagSet(regs_.object(), val, 1 << MemoryChunk::SCAN_ON_SCAVENGE,
&dont_need_remembered_set);
// First notify the incremental marker if necessary, then update the
......@@ -4050,11 +4048,9 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
InformIncrementalMarker(masm);
regs_.Restore(masm); // Restore the extra scratch registers we used.
__ RememberedSetHelper(object_,
address_,
value_, // scratch1
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
__ RememberedSetHelper(object(), address(),
value(), // scratch1
save_fp_regs_mode(), MacroAssembler::kReturnAtEnd);
__ Bind(&dont_need_remembered_set);
}
......@@ -4068,7 +4064,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode_);
regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode());
Register address =
x0.Is(regs_.address()) ? regs_.scratch0() : regs_.address();
DCHECK(!address.Is(regs_.object()));
......@@ -4084,7 +4080,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
isolate());
__ CallCFunction(function, 3, 0);
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_);
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode());
}
......@@ -4111,25 +4107,22 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); // Restore the extra scratch registers we used.
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_, // scratch1
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
__ RememberedSetHelper(object(), address(),
value(), // scratch1
save_fp_regs_mode(), MacroAssembler::kReturnAtEnd);
} else {
__ Ret();
}
__ Bind(&on_black);
// Get the value from the slot.
Register value = regs_.scratch0();
__ Ldr(value, MemOperand(regs_.address()));
Register val = regs_.scratch0();
__ Ldr(val, MemOperand(regs_.address()));
if (mode == INCREMENTAL_COMPACTION) {
Label ensure_not_white;
__ CheckPageFlagClear(value,
regs_.scratch1(),
__ CheckPageFlagClear(val, regs_.scratch1(),
MemoryChunk::kEvacuationCandidateMask,
&ensure_not_white);
......@@ -4144,7 +4137,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
// We need extra registers for this, so we push the object and the address
// register temporarily.
__ Push(regs_.address(), regs_.object());
__ EnsureNotWhite(value,
__ EnsureNotWhite(val,
regs_.scratch1(), // Scratch.
regs_.object(), // Scratch.
regs_.address(), // Scratch.
......@@ -4154,11 +4147,9 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); // Restore the extra scratch registers we used.
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_, // scratch1
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
__ RememberedSetHelper(object(), address(),
value(), // scratch1
save_fp_regs_mode(), MacroAssembler::kReturnAtEnd);
} else {
__ Ret();
}
......@@ -4186,12 +4177,10 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ adr(xzr, &skip_to_incremental_compacting);
}
if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object_,
address_,
value_, // scratch1
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object(), address(),
value(), // scratch1
save_fp_regs_mode(), MacroAssembler::kReturnAtEnd);
}
__ Ret();
......@@ -4626,7 +4615,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ Cmp(entry_key, key);
__ B(eq, &in_dictionary);
if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) {
if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) {
// Check if the entry name is not a unique name.
__ Ldr(entry_key, FieldMemOperand(entry_key, HeapObject::kMapOffset));
__ Ldrb(entry_key, FieldMemOperand(entry_key, Map::kInstanceTypeOffset));
......@@ -4638,7 +4627,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// If we are doing negative lookup then probing failure should be
// treated as a lookup success. For positive lookup, probing failure
// should be treated as lookup failure.
if (mode_ == POSITIVE_LOOKUP) {
if (mode() == POSITIVE_LOOKUP) {
__ Mov(result, 0);
__ Ret();
}
......
......@@ -59,12 +59,15 @@ class StoreRegistersStateStub: public PlatformCodeStub {
: PlatformCodeStub(isolate) {}
static Register to_be_pushed_lr() { return ip0; }
static void GenerateAheadOfTime(Isolate* isolate);
private:
Major MajorKey() const { return StoreRegistersState; }
uint32_t MinorKey() const { return 0; }
void Generate(MacroAssembler* masm);
DISALLOW_COPY_AND_ASSIGN(StoreRegistersStateStub);
};
......@@ -76,9 +79,10 @@ class RestoreRegistersStateStub: public PlatformCodeStub {
static void GenerateAheadOfTime(Isolate* isolate);
private:
Major MajorKey() const { return RestoreRegistersState; }
uint32_t MinorKey() const { return 0; }
void Generate(MacroAssembler* masm);
DISALLOW_COPY_AND_ASSIGN(RestoreRegistersStateStub);
};
......@@ -94,14 +98,17 @@ class RecordWriteStub: public PlatformCodeStub {
RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode)
: PlatformCodeStub(isolate),
object_(object),
value_(value),
address_(address),
remembered_set_action_(remembered_set_action),
save_fp_regs_mode_(fp_mode),
regs_(object, // An input reg.
address, // An input reg.
value) { // One scratch reg.
DCHECK(object.Is64Bits());
DCHECK(value.Is64Bits());
DCHECK(address.Is64Bits());
minor_key_ = ObjectBits::encode(object.code()) |
ValueBits::encode(value.code()) |
AddressBits::encode(address.code()) |
RememberedSetActionBits::encode(remembered_set_action) |
SaveFPRegsModeBits::encode(fp_mode);
}
enum Mode {
......@@ -281,47 +288,43 @@ class RecordWriteStub: public PlatformCodeStub {
friend class RecordWriteStub;
};
// A list of stub variants which are pregenerated.
// The variants are stored in the same format as the minor key, so
// MinorKeyFor() can be used to populate and check this list.
static const int kAheadOfTime[];
void Generate(MacroAssembler* masm);
void GenerateIncremental(MacroAssembler* masm, Mode mode);
enum OnNoNeedToInformIncrementalMarker {
kReturnOnNoNeedToInformIncrementalMarker,
kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
};
Major MajorKey() const { return RecordWrite; }
void Generate(MacroAssembler* masm);
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
MacroAssembler* masm,
OnNoNeedToInformIncrementalMarker on_no_need,
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
Major MajorKey() const { return RecordWrite; }
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
uint32_t MinorKey() const {
return MinorKeyFor(object_, value_, address_, remembered_set_action_,
save_fp_regs_mode_);
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));
}
static uint32_t MinorKeyFor(Register object, Register value, Register address,
RememberedSetAction action,
SaveFPRegsMode fp_mode) {
DCHECK(object.Is64Bits());
DCHECK(value.Is64Bits());
DCHECK(address.Is64Bits());
return ObjectBits::encode(object.code()) |
ValueBits::encode(value.code()) |
AddressBits::encode(address.code()) |
RememberedSetActionBits::encode(action) |
SaveFPRegsModeBits::encode(fp_mode);
Register value() const {
return Register::from_code(ValueBits::decode(minor_key_));
}
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
Register address() const {
return Register::from_code(AddressBits::decode(minor_key_));
}
RememberedSetAction remembered_set_action() const {
return RememberedSetActionBits::decode(minor_key_);
}
SaveFPRegsMode save_fp_regs_mode() const {
return SaveFPRegsModeBits::decode(minor_key_);
}
class ObjectBits: public BitField<int, 0, 5> {};
......@@ -350,9 +353,10 @@ class DirectCEntryStub: public PlatformCodeStub {
private:
Major MajorKey() const { return DirectCEntry; }
uint32_t MinorKey() const { return 0; }
bool NeedsImmovableCode() { return true; }
DISALLOW_COPY_AND_ASSIGN(DirectCEntryStub);
};
......@@ -361,7 +365,9 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
NameDictionaryLookupStub(Isolate* isolate, LookupMode mode)
: PlatformCodeStub(isolate), mode_(mode) { }
: PlatformCodeStub(isolate) {
minor_key_ = LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
......@@ -397,11 +403,11 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
Major MajorKey() const { return NameDictionaryLookup; }
uint32_t MinorKey() const { return LookupModeBits::encode(mode_); }
LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
class LookupModeBits: public BitField<LookupMode, 0, 1> {};
LookupMode mode_;
DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub);
};
} } // namespace v8::internal
......
......@@ -187,7 +187,7 @@ class CodeStub BASE_EMBEDDED {
// Returns information for computing the number key.
virtual Major MajorKey() const = 0;
virtual uint32_t MinorKey() const { return minor_key_; }
uint32_t MinorKey() const { return minor_key_; }
virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
......
......@@ -3870,9 +3870,9 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
Label in_dictionary, maybe_in_dictionary, not_in_dictionary;
Register scratch = result_;
Register scratch = result();
__ mov(scratch, FieldOperand(dictionary_, kCapacityOffset));
__ mov(scratch, FieldOperand(dictionary(), kCapacityOffset));
__ dec(scratch);
__ SmiUntag(scratch);
__ push(scratch);
......@@ -3892,13 +3892,11 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
__ lea(index_, Operand(scratch, scratch, times_2, 0)); // index *= 3.
__ lea(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3.
// Having undefined at this place means the name is not contained.
DCHECK_EQ(kSmiTagSize, 1);
__ mov(scratch, Operand(dictionary_,
index_,
times_pointer_size,
__ mov(scratch, Operand(dictionary(), index(), times_pointer_size,
kElementsStartOffset - kHeapObjectTag));
__ cmp(scratch, isolate()->factory()->undefined_value());
__ j(equal, &not_in_dictionary);
......@@ -3907,7 +3905,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ cmp(scratch, Operand(esp, 3 * kPointerSize));
__ j(equal, &in_dictionary);
if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) {
if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) {
// If we hit a key that is not a unique name during negative
// lookup we have to bailout as this key might be equal to the
// key we are looking for.
......@@ -3923,19 +3921,19 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// If we are doing negative lookup then probing failure should be
// treated as a lookup success. For positive lookup probing failure
// should be treated as lookup failure.
if (mode_ == POSITIVE_LOOKUP) {
__ mov(result_, Immediate(0));
if (mode() == POSITIVE_LOOKUP) {
__ mov(result(), Immediate(0));
__ Drop(1);
__ ret(2 * kPointerSize);
}
__ bind(&in_dictionary);
__ mov(result_, Immediate(1));
__ mov(result(), Immediate(1));
__ Drop(1);
__ ret(2 * kPointerSize);
__ bind(&not_in_dictionary);
__ mov(result_, Immediate(0));
__ mov(result(), Immediate(0));
__ Drop(1);
__ ret(2 * kPointerSize);
}
......@@ -3965,11 +3963,8 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ jmp(&skip_to_incremental_noncompacting, Label::kNear);
__ jmp(&skip_to_incremental_compacting, Label::kFar);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
......@@ -3991,7 +3986,7 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
regs_.Save(masm);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
Label dont_need_remembered_set;
__ mov(regs_.scratch0(), Operand(regs_.address(), 0));
......@@ -4013,10 +4008,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
mode);
InformIncrementalMarker(masm);
regs_.Restore(masm);
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
__ bind(&dont_need_remembered_set);
......@@ -4033,7 +4025,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode_);
regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode());
int argument_count = 3;
__ PrepareCallCFunction(argument_count, regs_.scratch0());
__ mov(Operand(esp, 0 * kPointerSize), regs_.object());
......@@ -4046,7 +4038,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
ExternalReference::incremental_marking_record_write_function(isolate()),
argument_count);
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_);
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode());
}
......@@ -4077,10 +4069,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
......@@ -4125,10 +4114,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
......
......@@ -75,13 +75,13 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
public:
enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
NameDictionaryLookupStub(Isolate* isolate,
Register dictionary,
Register result,
Register index,
LookupMode mode)
: PlatformCodeStub(isolate),
dictionary_(dictionary), result_(result), index_(index), mode_(mode) { }
NameDictionaryLookupStub(Isolate* isolate, Register dictionary,
Register result, Register index, LookupMode mode)
: PlatformCodeStub(isolate) {
minor_key_ = DictionaryBits::encode(dictionary.code()) |
ResultBits::encode(result.code()) |
IndexBits::encode(index.code()) | LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
......@@ -116,22 +116,26 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
Major MajorKey() const { return NameDictionaryLookup; }
uint32_t MinorKey() const {
return DictionaryBits::encode(dictionary_.code()) |
ResultBits::encode(result_.code()) |
IndexBits::encode(index_.code()) |
LookupModeBits::encode(mode_);
Register dictionary() const {
return Register::from_code(DictionaryBits::decode(minor_key_));
}
Register result() const {
return Register::from_code(ResultBits::decode(minor_key_));
}
Register index() const {
return Register::from_code(IndexBits::decode(minor_key_));
}
LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
class DictionaryBits: public BitField<int, 0, 3> {};
class ResultBits: public BitField<int, 3, 3> {};
class IndexBits: public BitField<int, 6, 3> {};
class LookupModeBits: public BitField<LookupMode, 9, 1> {};
Register dictionary_;
Register result_;
Register index_;
LookupMode mode_;
DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub);
};
......@@ -144,14 +148,14 @@ class RecordWriteStub: public PlatformCodeStub {
RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode)
: PlatformCodeStub(isolate),
object_(object),
value_(value),
address_(address),
remembered_set_action_(remembered_set_action),
save_fp_regs_mode_(fp_mode),
regs_(object, // An input reg.
address, // An input reg.
value) { // One scratch reg.
minor_key_ = ObjectBits::encode(object.code()) |
ValueBits::encode(value.code()) |
AddressBits::encode(address.code()) |
RememberedSetActionBits::encode(remembered_set_action) |
SaveFPRegsModeBits::encode(fp_mode);
}
enum Mode {
......@@ -353,8 +357,10 @@ class RecordWriteStub: public PlatformCodeStub {
enum OnNoNeedToInformIncrementalMarker {
kReturnOnNoNeedToInformIncrementalMarker,
kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
}
;
};
Major MajorKey() const { return RecordWrite; }
void Generate(MacroAssembler* masm);
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
......@@ -363,18 +369,28 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
Major MajorKey() const { return RecordWrite; }
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
uint32_t MinorKey() const {
return ObjectBits::encode(object_.code()) |
ValueBits::encode(value_.code()) |
AddressBits::encode(address_.code()) |
RememberedSetActionBits::encode(remembered_set_action_) |
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));
}
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
Register value() const {
return Register::from_code(ValueBits::decode(minor_key_));
}
Register address() const {
return Register::from_code(AddressBits::decode(minor_key_));
}
RememberedSetAction remembered_set_action() const {
return RememberedSetActionBits::decode(minor_key_);
}
SaveFPRegsMode save_fp_regs_mode() const {
return SaveFPRegsModeBits::decode(minor_key_);
}
class ObjectBits: public BitField<int, 0, 3> {};
......@@ -383,12 +399,9 @@ class RecordWriteStub: public PlatformCodeStub {
class RememberedSetActionBits: public BitField<RememberedSetAction, 9, 1> {};
class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 10, 1> {};
Register object_;
Register value_;
Register address_;
RememberedSetAction remembered_set_action_;
SaveFPRegsMode save_fp_regs_mode_;
RegisterAllocation regs_;
DISALLOW_COPY_AND_ASSIGN(RecordWriteStub);
};
......
......@@ -3803,9 +3803,9 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
Label in_dictionary, maybe_in_dictionary, not_in_dictionary;
Register scratch = result_;
Register scratch = result();
__ SmiToInteger32(scratch, FieldOperand(dictionary_, kCapacityOffset));
__ SmiToInteger32(scratch, FieldOperand(dictionary(), kCapacityOffset));
__ decl(scratch);
__ Push(scratch);
......@@ -3826,12 +3826,10 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// Scale the index by multiplying by the entry size.
DCHECK(NameDictionary::kEntrySize == 3);
__ leap(index_, Operand(scratch, scratch, times_2, 0)); // index *= 3.
__ leap(index(), Operand(scratch, scratch, times_2, 0)); // index *= 3.
// Having undefined at this place means the name is not contained.
__ movp(scratch, Operand(dictionary_,
index_,
times_pointer_size,
__ movp(scratch, Operand(dictionary(), index(), times_pointer_size,
kElementsStartOffset - kHeapObjectTag));
__ Cmp(scratch, isolate()->factory()->undefined_value());
......@@ -3841,7 +3839,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
__ cmpp(scratch, args.GetArgumentOperand(0));
__ j(equal, &in_dictionary);
if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) {
if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) {
// If we hit a key that is not a unique name during negative
// lookup we have to bailout as this key might be equal to the
// key we are looking for.
......@@ -3857,7 +3855,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// If we are doing negative lookup then probing failure should be
// treated as a lookup success. For positive lookup probing failure
// should be treated as lookup failure.
if (mode_ == POSITIVE_LOOKUP) {
if (mode() == POSITIVE_LOOKUP) {
__ movp(scratch, Immediate(0));
__ Drop(1);
__ ret(2 * kPointerSize);
......@@ -3900,11 +3898,8 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ jmp(&skip_to_incremental_noncompacting, Label::kNear);
__ jmp(&skip_to_incremental_compacting, Label::kFar);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
......@@ -3926,7 +3921,7 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
regs_.Save(masm);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
Label dont_need_remembered_set;
__ movp(regs_.scratch0(), Operand(regs_.address(), 0));
......@@ -3946,10 +3941,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode);
InformIncrementalMarker(masm);
regs_.Restore(masm);
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
__ bind(&dont_need_remembered_set);
......@@ -3964,7 +3956,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode_);
regs_.SaveCallerSaveRegisters(masm, save_fp_regs_mode());
Register address =
arg_reg_1.is(regs_.address()) ? kScratchRegister : regs_.address();
DCHECK(!address.is(regs_.object()));
......@@ -3982,7 +3974,7 @@ void RecordWriteStub::InformIncrementalMarker(MacroAssembler* masm) {
__ CallCFunction(
ExternalReference::incremental_marking_record_write_function(isolate()),
argument_count);
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_);
regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode());
}
......@@ -4015,10 +4007,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
......@@ -4060,10 +4049,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_,
save_fp_regs_mode_,
__ RememberedSetHelper(object(), address(), value(), save_fp_regs_mode(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
......
......@@ -71,16 +71,13 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
public:
enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
NameDictionaryLookupStub(Isolate* isolate,
Register dictionary,
Register result,
Register index,
LookupMode mode)
: PlatformCodeStub(isolate),
dictionary_(dictionary),
result_(result),
index_(index),
mode_(mode) { }
NameDictionaryLookupStub(Isolate* isolate, Register dictionary,
Register result, Register index, LookupMode mode)
: PlatformCodeStub(isolate) {
minor_key_ = DictionaryBits::encode(dictionary.code()) |
ResultBits::encode(result.code()) |
IndexBits::encode(index.code()) | LookupModeBits::encode(mode);
}
void Generate(MacroAssembler* masm);
......@@ -115,42 +112,43 @@ class NameDictionaryLookupStub: public PlatformCodeStub {
Major MajorKey() const { return NameDictionaryLookup; }
uint32_t MinorKey() const {
return DictionaryBits::encode(dictionary_.code()) |
ResultBits::encode(result_.code()) |
IndexBits::encode(index_.code()) |
LookupModeBits::encode(mode_);
Register dictionary() const {
return Register::from_code(DictionaryBits::decode(minor_key_));
}
Register result() const {
return Register::from_code(ResultBits::decode(minor_key_));
}
Register index() const {
return Register::from_code(IndexBits::decode(minor_key_));
}
LookupMode mode() const { return LookupModeBits::decode(minor_key_); }
class DictionaryBits: public BitField<int, 0, 4> {};
class ResultBits: public BitField<int, 4, 4> {};
class IndexBits: public BitField<int, 8, 4> {};
class LookupModeBits: public BitField<LookupMode, 12, 1> {};
Register dictionary_;
Register result_;
Register index_;
LookupMode mode_;
DISALLOW_COPY_AND_ASSIGN(NameDictionaryLookupStub);
};
class RecordWriteStub: public PlatformCodeStub {
public:
RecordWriteStub(Isolate* isolate,
Register object,
Register value,
Register address,
RememberedSetAction remembered_set_action,
RecordWriteStub(Isolate* isolate, Register object, Register value,
Register address, RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode)
: PlatformCodeStub(isolate),
object_(object),
value_(value),
address_(address),
remembered_set_action_(remembered_set_action),
save_fp_regs_mode_(fp_mode),
regs_(object, // An input reg.
address, // An input reg.
value) { // One scratch reg.
minor_key_ = ObjectBits::encode(object.code()) |
ValueBits::encode(value.code()) |
AddressBits::encode(address.code()) |
RememberedSetActionBits::encode(remembered_set_action) |
SaveFPRegsModeBits::encode(fp_mode);
}
enum Mode {
......@@ -336,6 +334,8 @@ class RecordWriteStub: public PlatformCodeStub {
kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
};
Major MajorKey() const { return RecordWrite; }
void Generate(MacroAssembler* masm);
void GenerateIncremental(MacroAssembler* masm, Mode mode);
void CheckNeedsToInformIncrementalMarker(
......@@ -344,18 +344,28 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
Major MajorKey() const { return RecordWrite; }
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
uint32_t MinorKey() const {
return ObjectBits::encode(object_.code()) |
ValueBits::encode(value_.code()) |
AddressBits::encode(address_.code()) |
RememberedSetActionBits::encode(remembered_set_action_) |
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));
}
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
Register value() const {
return Register::from_code(ValueBits::decode(minor_key_));
}
Register address() const {
return Register::from_code(AddressBits::decode(minor_key_));
}
RememberedSetAction remembered_set_action() const {
return RememberedSetActionBits::decode(minor_key_);
}
SaveFPRegsMode save_fp_regs_mode() const {
return SaveFPRegsModeBits::decode(minor_key_);
}
class ObjectBits: public BitField<int, 0, 4> {};
......@@ -364,13 +374,10 @@ class RecordWriteStub: public PlatformCodeStub {
class RememberedSetActionBits: public BitField<RememberedSetAction, 12, 1> {};
class SaveFPRegsModeBits: public BitField<SaveFPRegsMode, 13, 1> {};
Register object_;
Register value_;
Register address_;
RememberedSetAction remembered_set_action_;
SaveFPRegsMode save_fp_regs_mode_;
Label slow_;
RegisterAllocation regs_;
DISALLOW_COPY_AND_ASSIGN(RecordWriteStub);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment