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

Unified Diff: src/mips/code-stubs-mips.cc

Issue 536193002: MIPS: Minor-key-ify remaining code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips/code-stubs-mips.h ('k') | src/mips64/code-stubs-mips64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index a333dcbc29c77d8a6b66c6e570c57611d0a28c65..0c9f0b0f1aaff94a9a0610455146d3e06f8832ea 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -145,108 +145,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
}
-// Takes a Smi and converts to an IEEE 64 bit floating point value in two
-// registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and
-// 52 fraction bits (20 in the first word, 32 in the second). Zeros is a
-// scratch register. Destroys the source register. No GC occurs during this
-// stub so you don't have to set up the frame.
-class ConvertToDoubleStub : public PlatformCodeStub {
- public:
- ConvertToDoubleStub(Isolate* isolate,
- Register result_reg_1,
- Register result_reg_2,
- Register source_reg,
- Register scratch_reg)
- : PlatformCodeStub(isolate),
- result1_(result_reg_1),
- result2_(result_reg_2),
- source_(source_reg),
- zeros_(scratch_reg) { }
-
- private:
- Register result1_;
- Register result2_;
- Register source_;
- Register zeros_;
-
- // Minor key encoding in 16 bits.
- class ModeBits: public BitField<OverwriteMode, 0, 2> {};
- class OpBits: public BitField<Token::Value, 2, 14> {};
-
- Major MajorKey() const { return ConvertToDouble; }
- uint32_t MinorKey() const {
- // Encode the parameters in a unique 16 bit value.
- return result1_.code() +
- (result2_.code() << 4) +
- (source_.code() << 8) +
- (zeros_.code() << 12);
- }
-
- void Generate(MacroAssembler* masm);
-};
-
-
-void ConvertToDoubleStub::Generate(MacroAssembler* masm) {
- Register exponent, mantissa;
- if (kArchEndian == kLittle) {
- exponent = result1_;
- mantissa = result2_;
- } else {
- exponent = result2_;
- mantissa = result1_;
- }
- Label not_special;
- // Convert from Smi to integer.
- __ sra(source_, source_, kSmiTagSize);
- // Move sign bit from source to destination. This works because the sign bit
- // in the exponent word of the double has the same position and polarity as
- // the 2's complement sign bit in a Smi.
- STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u);
- __ And(exponent, source_, Operand(HeapNumber::kSignMask));
- // Subtract from 0 if source was negative.
- __ subu(at, zero_reg, source_);
- __ Movn(source_, at, exponent);
-
- // We have -1, 0 or 1, which we treat specially. Register source_ contains
- // absolute value: it is either equal to 1 (special case of -1 and 1),
- // greater than 1 (not a special case) or less than 1 (special case of 0).
- __ Branch(&not_special, gt, source_, Operand(1));
-
- // For 1 or -1 we need to or in the 0 exponent (biased to 1023).
- const uint32_t exponent_word_for_1 =
- HeapNumber::kExponentBias << HeapNumber::kExponentShift;
- // Safe to use 'at' as dest reg here.
- __ Or(at, exponent, Operand(exponent_word_for_1));
- __ Movn(exponent, at, source_); // Write exp when source not 0.
- // 1, 0 and -1 all have 0 for the second word.
- __ Ret(USE_DELAY_SLOT);
- __ mov(mantissa, zero_reg);
-
- __ bind(&not_special);
- // Count leading zeros.
- // Gets the wrong answer for 0, but we already checked for that case above.
- __ Clz(zeros_, source_);
- // Compute exponent and or it into the exponent register.
- // We use mantissa as a scratch register here.
- __ li(mantissa, Operand(31 + HeapNumber::kExponentBias));
- __ subu(mantissa, mantissa, zeros_);
- __ sll(mantissa, mantissa, HeapNumber::kExponentShift);
- __ Or(exponent, exponent, mantissa);
-
- // Shift up the source chopping the top bit off.
- __ Addu(zeros_, zeros_, Operand(1));
- // This wouldn't work for 1.0 or -1.0 as the shift would be 32 which means 0.
- __ sllv(source_, source_, zeros_);
- // Compute lower part of fraction (last 12 bits).
- __ sll(mantissa, source_, HeapNumber::kMantissaBitsInTopWord);
- // And the top (top 20 bits).
- __ srl(source_, source_, 32 - HeapNumber::kMantissaBitsInTopWord);
-
- __ Ret(USE_DELAY_SLOT);
- __ or_(exponent, exponent, source_);
-}
-
-
void DoubleToIStub::Generate(MacroAssembler* masm) {
Label out_of_range, only_low, negate, done;
Register input_reg = source();
@@ -403,32 +301,32 @@ void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
// We test for the special value that has a different exponent.
STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u);
// Test sign, and save for later conditionals.
- __ And(sign_, the_int_, Operand(0x80000000u));
- __ Branch(&max_negative_int, eq, the_int_, Operand(0x80000000u));
+ __ And(sign(), the_int(), Operand(0x80000000u));
+ __ Branch(&max_negative_int, eq, the_int(), Operand(0x80000000u));
// Set up the correct exponent in scratch_. All non-Smi int32s have the same.
// A non-Smi integer is 1.xxx * 2^30 so the exponent is 30 (biased).
uint32_t non_smi_exponent =
(HeapNumber::kExponentBias + 30) << HeapNumber::kExponentShift;
- __ li(scratch_, Operand(non_smi_exponent));
+ __ li(scratch(), Operand(non_smi_exponent));
// Set the sign bit in scratch_ if the value was negative.
- __ or_(scratch_, scratch_, sign_);
+ __ or_(scratch(), scratch(), sign());
// Subtract from 0 if the value was negative.
- __ subu(at, zero_reg, the_int_);
- __ Movn(the_int_, at, sign_);
+ __ subu(at, zero_reg, the_int());
+ __ Movn(the_int(), at, sign());
// We should be masking the implict first digit of the mantissa away here,
// but it just ends up combining harmlessly with the last digit of the
// exponent that happens to be 1. The sign bit is 0 so we shift 10 to get
// the most significant 1 to hit the last bit of the 12 bit sign and exponent.
DCHECK(((1 << HeapNumber::kExponentShift) & non_smi_exponent) != 0);
const int shift_distance = HeapNumber::kNonMantissaBitsInTopWord - 2;
- __ srl(at, the_int_, shift_distance);
- __ or_(scratch_, scratch_, at);
- __ sw(scratch_, FieldMemOperand(the_heap_number_,
+ __ srl(at, the_int(), shift_distance);
+ __ or_(scratch(), scratch(), at);
+ __ sw(scratch(), FieldMemOperand(the_heap_number(),
HeapNumber::kExponentOffset));
- __ sll(scratch_, the_int_, 32 - shift_distance);
+ __ sll(scratch(), the_int(), 32 - shift_distance);
__ Ret(USE_DELAY_SLOT);
- __ sw(scratch_, FieldMemOperand(the_heap_number_,
+ __ sw(scratch(), FieldMemOperand(the_heap_number(),
HeapNumber::kMantissaOffset));
__ bind(&max_negative_int);
@@ -437,13 +335,13 @@ void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
// The actual mantissa bits stored are all 0 because the implicit most
// significant 1 bit is not stored.
non_smi_exponent += 1 << HeapNumber::kExponentShift;
- __ li(scratch_, Operand(HeapNumber::kSignMask | non_smi_exponent));
- __ sw(scratch_,
- FieldMemOperand(the_heap_number_, HeapNumber::kExponentOffset));
- __ mov(scratch_, zero_reg);
+ __ li(scratch(), Operand(HeapNumber::kSignMask | non_smi_exponent));
+ __ sw(scratch(),
+ FieldMemOperand(the_heap_number(), HeapNumber::kExponentOffset));
+ __ mov(scratch(), zero_reg);
__ Ret(USE_DELAY_SLOT);
- __ sw(scratch_,
- FieldMemOperand(the_heap_number_, HeapNumber::kMantissaOffset));
+ __ sw(scratch(),
+ FieldMemOperand(the_heap_number(), HeapNumber::kMantissaOffset));
}
@@ -4228,7 +4126,7 @@ void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
// Stop if found the property.
__ Branch(&in_dictionary, eq, entry_key, Operand(key));
- if (i != kTotalProbes - 1 && mode_ == NEGATIVE_LOOKUP) {
+ if (i != kTotalProbes - 1 && mode() == NEGATIVE_LOOKUP) {
// Check if the entry name is not a unique name.
__ lw(entry_key, FieldMemOperand(entry_key, HeapObject::kMapOffset));
__ lbu(entry_key,
@@ -4241,7 +4139,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) {
__ Ret(USE_DELAY_SLOT);
__ mov(result, zero_reg);
}
@@ -4285,11 +4183,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ beq(zero_reg, zero_reg, &skip_to_incremental_compacting);
__ nop();
- 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);
}
__ Ret();
@@ -4311,7 +4209,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;
__ lw(regs_.scratch0(), MemOperand(regs_.address(), 0));
@@ -4331,10 +4229,10 @@ 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);
@@ -4349,7 +4247,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());
Register address =
@@ -4365,7 +4263,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());
}
@@ -4393,10 +4291,10 @@ 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();
@@ -4437,10 +4335,10 @@ 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();
« no previous file with comments | « src/mips/code-stubs-mips.h ('k') | src/mips64/code-stubs-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698