Index: src/x64/macro-assembler-x64.h |
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h |
index ca13ca3955423c54f3bcc5136186b4adc9ba3600..44782265d54b33cded38e701949c5048f0a01956 100644 |
--- a/src/x64/macro-assembler-x64.h |
+++ b/src/x64/macro-assembler-x64.h |
@@ -375,6 +375,18 @@ class MacroAssembler: public Assembler { |
// --------------------------------------------------------------------------- |
// Smi tagging, untagging and operations on tagged smis. |
+ class SmiFunctionInvoker { |
danno
2013/08/07 18:41:26
I think approach works, but I think you can get aw
haitao.feng
2013/08/12 09:54:24
Thanks for the recommendation. I used a slightly d
|
+ public: |
+ explicit SmiFunctionInvoker(Label* label) : label_(label) { } |
+ virtual ~SmiFunctionInvoker() { } |
+ virtual void Bailout() { } |
+ virtual Label* on_not_smi_result() { return label_; } |
+ virtual bool reserve_source_operands() { return true; } |
+ virtual bool check_minus_zero() { return true; } |
+ private: |
+ Label* label_; |
+ }; |
+ |
void InitializeSmiConstantRegister() { |
movq(kSmiConstantRegister, |
reinterpret_cast<uint64_t>(Smi::FromInt(kSmiConstantRegisterValue)), |
@@ -484,10 +496,17 @@ class MacroAssembler: public Assembler { |
// Jump if the value cannot be represented by a smi. |
void JumpIfNotValidSmiValue(Register src, Label* on_invalid, |
Label::Distance near_jump = Label::kFar); |
+ // Jump if the value can be represented by a smi. |
+ void JumpIfValidSmiValue(Register src, Label* on_valid, |
+ Label::Distance near_jump = Label::kFar); |
// Jump if the unsigned integer value cannot be represented by a smi. |
void JumpIfUIntNotValidSmiValue(Register src, Label* on_invalid, |
Label::Distance near_jump = Label::kFar); |
+ // Jump if the unsigned integer value can be represented by a smi. |
+ void JumpIfUIntValidSmiValue(Register src, Label* on_valid, |
+ Label::Distance near_jump = Label::kFar); |
+ |
// Jump to label if the value is a tagged smi. |
void JumpIfSmi(Register src, |
@@ -650,7 +669,8 @@ class MacroAssembler: public Assembler { |
void SmiShiftLeftConstant(Register dst, |
Register src, |
- int shift_value); |
+ int shift_value, |
+ SmiFunctionInvoker& env); |
void SmiShiftLogicalRightConstant(Register dst, |
Register src, |
int shift_value, |
@@ -664,7 +684,8 @@ class MacroAssembler: public Assembler { |
// Uses and clobbers rcx, so dst may not be rcx. |
void SmiShiftLeft(Register dst, |
Register src1, |
- Register src2); |
+ 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. |
@@ -722,6 +743,9 @@ class MacroAssembler: public Assembler { |
void Push(Smi* smi); |
void Test(const Operand& dst, Smi* source); |
+ void PushInt64AsTwoSmis(Register src, Register scratch = kScratchRegister); |
+ void PopInt64AsTwoSmis(Register dst, Register scratch = kScratchRegister); |
+ static bool IsUnsafeSmiOperator(Token::Value op); |
// --------------------------------------------------------------------------- |
// String macros. |