| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // Jump if either or both register are not non-negative smi values. | 525 // Jump if either or both register are not non-negative smi values. |
| 526 void JumpUnlessBothNonNegativeSmi(Register src1, Register src2, | 526 void JumpUnlessBothNonNegativeSmi(Register src1, Register src2, |
| 527 Label* on_not_both_smi, | 527 Label* on_not_both_smi, |
| 528 Label::Distance near_jump = Label::kFar); | 528 Label::Distance near_jump = Label::kFar); |
| 529 | 529 |
| 530 // Operations on tagged smi values. | 530 // Operations on tagged smi values. |
| 531 | 531 |
| 532 // Smis represent a subset of integers. The subset is always equivalent to | 532 // Smis represent a subset of integers. The subset is always equivalent to |
| 533 // a two's complement interpretation of a fixed number of bits. | 533 // a two's complement interpretation of a fixed number of bits. |
| 534 | 534 |
| 535 // Optimistically adds an integer constant to a supposed smi. | |
| 536 // If the src is not a smi, or the result is not a smi, jump to | |
| 537 // the label. | |
| 538 void SmiTryAddConstant(Register dst, | |
| 539 Register src, | |
| 540 Smi* constant, | |
| 541 Label* on_not_smi_result, | |
| 542 Label::Distance near_jump = Label::kFar); | |
| 543 | |
| 544 // Add an integer constant to a tagged smi, giving a tagged smi as result. | 535 // Add an integer constant to a tagged smi, giving a tagged smi as result. |
| 545 // No overflow testing on the result is done. | 536 // No overflow testing on the result is done. |
| 546 void SmiAddConstant(Register dst, Register src, Smi* constant); | 537 void SmiAddConstant(Register dst, Register src, Smi* constant); |
| 547 | 538 |
| 548 // Add an integer constant to a tagged smi, giving a tagged smi as result. | 539 // Add an integer constant to a tagged smi, giving a tagged smi as result. |
| 549 // No overflow testing on the result is done. | 540 // No overflow testing on the result is done. |
| 550 void SmiAddConstant(const Operand& dst, Smi* constant); | 541 void SmiAddConstant(const Operand& dst, Smi* constant); |
| 551 | 542 |
| 552 // Add an integer constant to a tagged smi, giving a tagged smi as result, | 543 // Add an integer constant to a tagged smi, giving a tagged smi as result, |
| 553 // or jumping to a label if the result cannot be represented by a smi. | 544 // or jumping to a label if the result cannot be represented by a smi. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 571 Label::Distance near_jump = Label::kFar); | 562 Label::Distance near_jump = Label::kFar); |
| 572 | 563 |
| 573 // Negating a smi can give a negative zero or too large positive value. | 564 // Negating a smi can give a negative zero or too large positive value. |
| 574 // NOTICE: This operation jumps on success, not failure! | 565 // NOTICE: This operation jumps on success, not failure! |
| 575 void SmiNeg(Register dst, | 566 void SmiNeg(Register dst, |
| 576 Register src, | 567 Register src, |
| 577 Label* on_smi_result, | 568 Label* on_smi_result, |
| 578 Label::Distance near_jump = Label::kFar); | 569 Label::Distance near_jump = Label::kFar); |
| 579 | 570 |
| 580 // Adds smi values and return the result as a smi. | 571 // Adds smi values and return the result as a smi. |
| 581 // If dst is src1, then src1 will be destroyed, even if | 572 // If dst is src1, then src1 will be destroyed if the operation is |
| 582 // the operation is unsuccessful. | 573 // successful, otherwise kept intact. |
| 583 void SmiAdd(Register dst, | 574 void SmiAdd(Register dst, |
| 584 Register src1, | 575 Register src1, |
| 585 Register src2, | 576 Register src2, |
| 586 Label* on_not_smi_result, | 577 Label* on_not_smi_result, |
| 587 Label::Distance near_jump = Label::kFar); | 578 Label::Distance near_jump = Label::kFar); |
| 588 void SmiAdd(Register dst, | 579 void SmiAdd(Register dst, |
| 589 Register src1, | 580 Register src1, |
| 590 const Operand& src2, | 581 const Operand& src2, |
| 591 Label* on_not_smi_result, | 582 Label* on_not_smi_result, |
| 592 Label::Distance near_jump = Label::kFar); | 583 Label::Distance near_jump = Label::kFar); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 774 |
| 784 // Checks if the given register or operand is a unique name | 775 // Checks if the given register or operand is a unique name |
| 785 void JumpIfNotUniqueName(Register reg, Label* not_unique_name, | 776 void JumpIfNotUniqueName(Register reg, Label* not_unique_name, |
| 786 Label::Distance distance = Label::kFar); | 777 Label::Distance distance = Label::kFar); |
| 787 void JumpIfNotUniqueName(Operand operand, Label* not_unique_name, | 778 void JumpIfNotUniqueName(Operand operand, Label* not_unique_name, |
| 788 Label::Distance distance = Label::kFar); | 779 Label::Distance distance = Label::kFar); |
| 789 | 780 |
| 790 // --------------------------------------------------------------------------- | 781 // --------------------------------------------------------------------------- |
| 791 // Macro instructions. | 782 // Macro instructions. |
| 792 | 783 |
| 784 // Load/store with specific representation. |
| 785 void Load(Register dst, const Operand& src, Representation r); |
| 786 void Store(const Operand& dst, Register src, Representation r); |
| 787 |
| 793 // Load a register with a long value as efficiently as possible. | 788 // Load a register with a long value as efficiently as possible. |
| 794 void Set(Register dst, int64_t x); | 789 void Set(Register dst, int64_t x); |
| 795 void Set(const Operand& dst, int64_t x); | 790 void Set(const Operand& dst, int64_t x); |
| 796 | 791 |
| 797 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which | 792 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which |
| 798 // hinders register renaming and makes dependence chains longer. So we use | 793 // hinders register renaming and makes dependence chains longer. So we use |
| 799 // xorps to clear the dst register before cvtsi2sd to solve this issue. | 794 // xorps to clear the dst register before cvtsi2sd to solve this issue. |
| 800 void Cvtlsi2sd(XMMRegister dst, Register src); | 795 void Cvtlsi2sd(XMMRegister dst, Register src); |
| 801 void Cvtlsi2sd(XMMRegister dst, const Operand& src); | 796 void Cvtlsi2sd(XMMRegister dst, const Operand& src); |
| 802 | 797 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 // Call a code stub. | 1236 // Call a code stub. |
| 1242 void CallStub(CodeStub* stub, TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1237 void CallStub(CodeStub* stub, TypeFeedbackId ast_id = TypeFeedbackId::None()); |
| 1243 | 1238 |
| 1244 // Tail call a code stub (jump). | 1239 // Tail call a code stub (jump). |
| 1245 void TailCallStub(CodeStub* stub); | 1240 void TailCallStub(CodeStub* stub); |
| 1246 | 1241 |
| 1247 // Return from a code stub after popping its arguments. | 1242 // Return from a code stub after popping its arguments. |
| 1248 void StubReturn(int argc); | 1243 void StubReturn(int argc); |
| 1249 | 1244 |
| 1250 // Call a runtime routine. | 1245 // Call a runtime routine. |
| 1251 void CallRuntime(const Runtime::Function* f, int num_arguments); | 1246 void CallRuntime(const Runtime::Function* f, |
| 1247 int num_arguments, |
| 1248 SaveFPRegsMode save_doubles = kDontSaveFPRegs); |
| 1252 | 1249 |
| 1253 // Call a runtime function and save the value of XMM registers. | 1250 // Call a runtime function and save the value of XMM registers. |
| 1254 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 1251 void CallRuntimeSaveDoubles(Runtime::FunctionId id) { |
| 1252 const Runtime::Function* function = Runtime::FunctionForId(id); |
| 1253 CallRuntime(function, function->nargs, kSaveFPRegs); |
| 1254 } |
| 1255 | 1255 |
| 1256 // Convenience function: Same as above, but takes the fid instead. | 1256 // Convenience function: Same as above, but takes the fid instead. |
| 1257 void CallRuntime(Runtime::FunctionId id, int num_arguments); | 1257 void CallRuntime(Runtime::FunctionId id, int num_arguments) { |
| 1258 CallRuntime(Runtime::FunctionForId(id), num_arguments); |
| 1259 } |
| 1258 | 1260 |
| 1259 // Convenience function: call an external reference. | 1261 // Convenience function: call an external reference. |
| 1260 void CallExternalReference(const ExternalReference& ext, | 1262 void CallExternalReference(const ExternalReference& ext, |
| 1261 int num_arguments); | 1263 int num_arguments); |
| 1262 | 1264 |
| 1263 // Tail call of a runtime routine (jump). | 1265 // Tail call of a runtime routine (jump). |
| 1264 // Like JumpToExternalReference, but also takes care of passing the number | 1266 // Like JumpToExternalReference, but also takes care of passing the number |
| 1265 // of parameters. | 1267 // of parameters. |
| 1266 void TailCallExternalReference(const ExternalReference& ext, | 1268 void TailCallExternalReference(const ExternalReference& ext, |
| 1267 int num_arguments, | 1269 int num_arguments, |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 masm->popfq(); \ | 1583 masm->popfq(); \ |
| 1582 } \ | 1584 } \ |
| 1583 masm-> | 1585 masm-> |
| 1584 #else | 1586 #else |
| 1585 #define ACCESS_MASM(masm) masm-> | 1587 #define ACCESS_MASM(masm) masm-> |
| 1586 #endif | 1588 #endif |
| 1587 | 1589 |
| 1588 } } // namespace v8::internal | 1590 } } // namespace v8::internal |
| 1589 | 1591 |
| 1590 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1592 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
| OLD | NEW |