| Index: src/x64/macro-assembler-x64.h
|
| diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
|
| index 4e8d70d77e278c95af03953221a7b068ad66f1c2..92fe5fc2d5eecb1f7e470d0b79e8f156c3ec82c5 100644
|
| --- a/src/x64/macro-assembler-x64.h
|
| +++ b/src/x64/macro-assembler-x64.h
|
| @@ -126,6 +126,215 @@ class MacroAssembler: public Assembler {
|
| // Store the code object for the given builtin in the target register.
|
| void GetBuiltinEntry(Register target, Builtins::JavaScript id);
|
|
|
| +
|
| + // ---------------------------------------------------------------------------
|
| + // Smi tagging, untagging and operations on tagged smis.
|
| +
|
| + // Conversions between tagged smi values and non-tagged integer values.
|
| +
|
| + // Tag an integer value. The result must be known to be a valid smi value.
|
| + // Only uses the low 32 bits of the src register.
|
| + void Integer32ToSmi(Register dst, Register src);
|
| +
|
| + // Tag an integer value if possible, or jump the integer value cannot be
|
| + // represented as a smi. Only uses the low 32 bit of the src registers.
|
| + void Integer32ToSmi(Register dst, Register src, Label* on_overflow);
|
| +
|
| + // Adds constant to src and tags the result as a smi.
|
| + // Result must be a valid smi.
|
| + void Integer64AddToSmi(Register dst, Register src, int constant);
|
| +
|
| + // Convert smi to 32-bit integer. I.e., not sign extended into
|
| + // high 32 bits of destination.
|
| + void SmiToInteger32(Register dst, Register src);
|
| +
|
| + // Convert smi to 64-bit integer (sign extended if necessary).
|
| + void SmiToInteger64(Register dst, Register src);
|
| +
|
| + // Multiply a positive smi's integer value by a power of two.
|
| + // Provides result as 64-bit integer value.
|
| + void PositiveSmiTimesPowerOfTwoToInteger64(Register dst,
|
| + Register src,
|
| + int power);
|
| +
|
| + // Functions performing a check on a known or potential smi. Returns
|
| + // a condition that is satisfied if the check is successful.
|
| +
|
| + // Is the value a tagged smi.
|
| + Condition CheckSmi(Register src);
|
| +
|
| + // Is the value not a tagged smi.
|
| + Condition CheckNotSmi(Register src);
|
| +
|
| + // Is the value a positive tagged smi.
|
| + Condition CheckPositiveSmi(Register src);
|
| +
|
| + // Is the value not a positive tagged smi.
|
| + Condition CheckNotPositiveSmi(Register src);
|
| +
|
| + // Are both values are tagged smis.
|
| + Condition CheckBothSmi(Register first, Register second);
|
| +
|
| + // Is one of the values not a tagged smi.
|
| + Condition CheckNotBothSmi(Register first, Register second);
|
| +
|
| + // Is the value the minimum smi value (since we are using
|
| + // two's complement numbers, negating the value is known to yield
|
| + // a non-smi value).
|
| + Condition CheckIsMinSmi(Register src);
|
| +
|
| + // Check whether a tagged smi is equal to a constant.
|
| + Condition CheckSmiEqualsConstant(Register src, int constant);
|
| +
|
| + // Checks whether an 32-bit integer value is a valid for conversion
|
| + // to a smi.
|
| + Condition CheckInteger32ValidSmiValue(Register src);
|
| +
|
| + // Test-and-jump functions. Typically combines a check function
|
| + // above with a conditional jump.
|
| +
|
| + // Jump if the value cannot be represented by a smi.
|
| + void JumpIfNotValidSmiValue(Register src, Label* on_invalid);
|
| +
|
| + // Jump to label if the value is a tagged smi.
|
| + void JumpIfSmi(Register src, Label* on_smi);
|
| +
|
| + // Jump to label if the value is not a tagged smi.
|
| + void JumpIfNotSmi(Register src, Label* on_not_smi);
|
| +
|
| + // Jump to label if the value is not a positive tagged smi.
|
| + void JumpIfNotPositiveSmi(Register src, Label* on_not_smi);
|
| +
|
| + // Jump to label if the value is a tagged smi with value equal
|
| + // to the constant.
|
| + void JumpIfSmiEqualsConstant(Register src, int constant, Label* on_equals);
|
| +
|
| + // Jump if either or both register are not smi values.
|
| + void JumpIfNotBothSmi(Register src1, Register src2, Label* on_not_both_smi);
|
| +
|
| + // Operations on tagged smi values.
|
| +
|
| + // Smis represent a subset of integers. The subset is always equivalent to
|
| + // a two's complement interpretation of a fixed number of bits.
|
| +
|
| + // Optimistically adds an integer constant to a supposed smi.
|
| + // If the src is not a smi, or the result is not a smi, jump to
|
| + // the label.
|
| + void SmiTryAddConstant(Register dst,
|
| + Register src,
|
| + int32_t constant,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Add an integer constant to a tagged smi, giving a tagged smi as result,
|
| + // or jumping to a label if the result cannot be represented by a smi.
|
| + // If the label is NULL, no testing on the result is done.
|
| + void SmiAddConstant(Register dst,
|
| + Register src,
|
| + int32_t constant,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Subtract an integer constant from a tagged smi, giving a tagged smi as
|
| + // result, or jumping to a label if the result cannot be represented by a smi.
|
| + // If the label is NULL, no testing on the result is done.
|
| + void SmiSubConstant(Register dst,
|
| + Register src,
|
| + int32_t constant,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Negating a smi can give a negative zero or too larget positive value.
|
| + void SmiNeg(Register dst,
|
| + Register src,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Adds smi values and return the result as a smi.
|
| + // If dst is src1, then src1 will be destroyed, even if
|
| + // the operation is unsuccessful.
|
| + void SmiAdd(Register dst,
|
| + 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.
|
| + void SmiSub(Register dst,
|
| + 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
|
| + // the operation is unsuccessful.
|
| + void SmiMul(Register dst,
|
| + Register src1,
|
| + Register src2,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Divides one smi by another and returns the quotient.
|
| + // Clobbers rax and rdx registers.
|
| + void SmiDiv(Register dst,
|
| + Register src1,
|
| + Register src2,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Divides one smi by another and returns the remainder.
|
| + // Clobbers rax and rdx registers.
|
| + void SmiMod(Register dst,
|
| + Register src1,
|
| + Register src2,
|
| + Label* on_not_smi_result);
|
| +
|
| + // Bitwise operations.
|
| + void SmiNot(Register dst, Register src);
|
| + void SmiAnd(Register dst, Register src1, Register src2);
|
| + void SmiOr(Register dst, Register src1, Register src2);
|
| + void SmiXor(Register dst, Register src1, Register src2);
|
| + void SmiAndConstant(Register dst, Register src1, int constant);
|
| + void SmiOrConstant(Register dst, Register src1, int constant);
|
| + void SmiXorConstant(Register dst, Register src1, int constant);
|
| +
|
| + void SmiShiftLeftConstant(Register dst,
|
| + Register src,
|
| + int shift_value,
|
| + Label* on_not_smi_result);
|
| + void SmiShiftLogicRightConstant(Register dst,
|
| + Register src,
|
| + int shift_value,
|
| + Label* on_not_smi_result);
|
| + void SmiShiftArithmeticRightConstant(Register dst,
|
| + Register src,
|
| + int shift_value);
|
| +
|
| + // Shifts a smi value to the left, and returns the result if that is a smi.
|
| + // Uses and clobbers rcx, so dst may not be rcx.
|
| + void SmiShiftLeft(Register dst,
|
| + Register src1,
|
| + Register src2,
|
| + Label* on_not_smi_result);
|
| + // Shifts a smi value to the right, shifting in zero bits at the top, and
|
| + // returns the unsigned intepretation of the result if that is a smi.
|
| + // Uses and clobbers rcx, so dst may not be rcx.
|
| + void SmiShiftLogicRight(Register dst,
|
| + Register src1,
|
| + Register src2,
|
| + Label* on_not_smi_result);
|
| + // Shifts a smi value to the right, sign extending the top, and
|
| + // returns the signed intepretation of the result. That will always
|
| + // be a valid smi value, since it's numerically smaller than the
|
| + // original.
|
| + // Uses and clobbers rcx, so dst may not be rcx.
|
| + void SmiShiftArithmeticRight(Register dst,
|
| + Register src1,
|
| + Register src2);
|
| +
|
| + // Specialized operations
|
| +
|
| + // Select the non-smi register of two registers where exactly one is a
|
| + // smi. If neither are smis, jump to the failure label.
|
| + void SelectNonSmi(Register dst,
|
| + Register src1,
|
| + Register src2,
|
| + Label* on_not_smis);
|
| +
|
| // ---------------------------------------------------------------------------
|
| // Macro instructions
|
|
|
|
|