X87: Minor-key-ify remaining code stubs

port r23643.

original commit message:

  Minor-key-ify remaining code stubs

BUG=
R=weiliang.lin@intel.com

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

Patch from Jing Bao <jing.bao@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23711 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
weiliang.lin@intel.com 2014-09-05 06:41:24 +00:00
parent 276c2a0dec
commit 48c61115ec
2 changed files with 61 additions and 60 deletions

View File

@ -3517,9 +3517,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);
@ -3539,13 +3539,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);
@ -3554,7 +3552,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.
@ -3570,19 +3568,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);
}
@ -3610,10 +3608,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_,
if (remembered_set_action() == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper(object(), address(), value(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
@ -3635,7 +3631,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));
@ -3657,9 +3653,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
mode);
InformIncrementalMarker(masm);
regs_.Restore(masm);
__ RememberedSetHelper(object_,
address_,
value_,
__ RememberedSetHelper(object(), address(), value(),
MacroAssembler::kReturnAtEnd);
__ bind(&dont_need_remembered_set);
@ -3720,9 +3714,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_,
__ RememberedSetHelper(object(), address(), value(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);
@ -3767,9 +3759,7 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper(object_,
address_,
value_,
__ RememberedSetHelper(object(), address(), value(),
MacroAssembler::kReturnAtEnd);
} else {
__ ret(0);

View File

@ -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);
};
@ -143,13 +147,13 @@ class RecordWriteStub: public PlatformCodeStub {
Register address,
RememberedSetAction remembered_set_action)
: PlatformCodeStub(isolate),
object_(object),
value_(value),
address_(address),
remembered_set_action_(remembered_set_action),
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);
}
enum Mode {
@ -332,8 +336,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(
@ -342,29 +348,34 @@ class RecordWriteStub: public PlatformCodeStub {
Mode mode);
void InformIncrementalMarker(MacroAssembler* masm);
Major MajorKey() const { return RecordWrite; }
uint32_t MinorKey() const {
return ObjectBits::encode(object_.code()) |
ValueBits::encode(value_.code()) |
AddressBits::encode(address_.code()) |
RememberedSetActionBits::encode(remembered_set_action_);
}
void Activate(Code* code) {
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
}
Register object() const {
return Register::from_code(ObjectBits::decode(minor_key_));
}
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_);
}
class ObjectBits: public BitField<int, 0, 3> {};
class ValueBits: public BitField<int, 3, 3> {};
class AddressBits: public BitField<int, 6, 3> {};
class RememberedSetActionBits: public BitField<RememberedSetAction, 9, 1> {};
Register object_;
Register value_;
Register address_;
RememberedSetAction remembered_set_action_;
RegisterAllocation regs_;
DISALLOW_COPY_AND_ASSIGN(RecordWriteStub);
};