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

Unified Diff: src/x64/macro-assembler-x64.h

Issue 196118: X64: Abstract indexing by a smi to the macro assembler. (Closed)
Patch Set: Created 11 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
Index: src/x64/macro-assembler-x64.h
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
index a080f1b3f002f033ff0727b762e221766fea31dd..de2070ab8d02341df16efee65cbdf413b1114252 100644
--- a/src/x64/macro-assembler-x64.h
+++ b/src/x64/macro-assembler-x64.h
@@ -41,6 +41,13 @@ static const Register kScratchRegister = r10;
// Forward declaration.
class JumpTarget;
+struct SmiIndex {
William Hesse 2009/09/15 10:12:09 Are we allowed to create constructors for structs,
Lasse Reichstein 2009/09/15 10:39:08 Yes (I had to check to be sure).
+ SmiIndex(Register index_register, ScaleFactor scale)
+ : reg(index_register),
+ scale(scale) {}
+ Register reg;
+ ScaleFactor scale;
+};
// MacroAssembler implements a collection of frequently used macros.
class MacroAssembler: public Assembler {
@@ -241,7 +248,7 @@ class MacroAssembler: public Assembler {
int32_t constant,
Label* on_not_smi_result);
- // Negating a smi can give a negative zero or too larget positive value.
+ // Negating a smi can give a negative zero or too large positive value.
void SmiNeg(Register dst,
Register src,
Label* on_not_smi_result);
@@ -253,6 +260,7 @@ class MacroAssembler: public Assembler {
Register src1,
Register src2,
Label* on_not_smi_result);
+
// Subtracts smi values and return the result as a smi.
// If dst is src1, then src1 will be destroyed, even if
// the operation is unsuccessful.
@@ -260,6 +268,7 @@ class MacroAssembler: public Assembler {
Register src1,
Register src2,
Label* on_not_smi_result);
+
// Multiplies smi values and return the result as a smi,
// if possible.
// If dst is src1, then src1 will be destroyed, even if
@@ -335,6 +344,19 @@ class MacroAssembler: public Assembler {
Register src2,
Label* on_not_smis);
+ // Converts, if necessary, a smi to a combination of number and
+ // multiplier to be used as a scaled index.
+ // The src register contains a *positive* smi value. The shift is the
+ // power of two to multiply the index value by (e.g.
+ // to index by smi-value * kPointerSize, pass the smi and kPointerSizeLog2).
+ // The returned index register may be either src or dst, depending
+ // on what is most efficient. If src and dst are different registers,
+ // src is always unchanged.
William Hesse 2009/09/15 10:12:09 Don't those two sentences contradict each other?
Lasse Reichstein 2009/09/15 10:39:08 It can happen if an unchanged src combined with a
+ SmiIndex SmiToIndex(Register dst, Register src, int shift);
+
+ // Converts a positive smi to a negative index.
+ SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift);
+
// ---------------------------------------------------------------------------
// Macro instructions

Powered by Google App Engine
This is Rietveld 408576698