| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 28 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| 29 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 29 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| 30 | 30 |
| 31 #include "assembler.h" | 31 #include "assembler.h" |
| 32 #include "type-info.h" | |
| 33 | 32 |
| 34 namespace v8 { | 33 namespace v8 { |
| 35 namespace internal { | 34 namespace internal { |
| 36 | 35 |
| 37 // Flags used for the AllocateInNewSpace functions. | 36 // Flags used for the AllocateInNewSpace functions. |
| 38 enum AllocationFlags { | 37 enum AllocationFlags { |
| 39 // No special flags. | 38 // No special flags. |
| 40 NO_ALLOCATION_FLAGS = 0, | 39 NO_ALLOCATION_FLAGS = 0, |
| 41 // Return the pointer to the allocated already tagged as a heap object. | 40 // Return the pointer to the allocated already tagged as a heap object. |
| 42 TAG_OBJECT = 1 << 0, | 41 TAG_OBJECT = 1 << 0, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 void SmiTag(Register reg) { | 237 void SmiTag(Register reg) { |
| 239 ASSERT(kSmiTag == 0); | 238 ASSERT(kSmiTag == 0); |
| 240 ASSERT(kSmiTagSize == 1); | 239 ASSERT(kSmiTagSize == 1); |
| 241 add(reg, Operand(reg)); | 240 add(reg, Operand(reg)); |
| 242 } | 241 } |
| 243 void SmiUntag(Register reg) { | 242 void SmiUntag(Register reg) { |
| 244 sar(reg, kSmiTagSize); | 243 sar(reg, kSmiTagSize); |
| 245 } | 244 } |
| 246 | 245 |
| 247 // Modifies the register even if it does not contain a Smi! | 246 // Modifies the register even if it does not contain a Smi! |
| 248 void SmiUntag(Register reg, TypeInfo info, Label* non_smi) { | |
| 249 ASSERT(kSmiTagSize == 1); | |
| 250 sar(reg, kSmiTagSize); | |
| 251 if (info.IsSmi()) { | |
| 252 ASSERT(kSmiTag == 0); | |
| 253 j(carry, non_smi); | |
| 254 } | |
| 255 } | |
| 256 | |
| 257 // Modifies the register even if it does not contain a Smi! | |
| 258 void SmiUntag(Register reg, Label* is_smi) { | 247 void SmiUntag(Register reg, Label* is_smi) { |
| 259 ASSERT(kSmiTagSize == 1); | 248 ASSERT(kSmiTagSize == 1); |
| 260 sar(reg, kSmiTagSize); | 249 sar(reg, kSmiTagSize); |
| 261 ASSERT(kSmiTag == 0); | 250 ASSERT(kSmiTag == 0); |
| 262 j(not_carry, is_smi); | 251 j(not_carry, is_smi); |
| 263 } | 252 } |
| 264 | 253 |
| 265 // Jump the register contains a smi. | 254 // Jump the register contains a smi. |
| 266 inline void JumpIfSmi(Register value, Label* smi_label) { | 255 inline void JumpIfSmi(Register value, Label* smi_label) { |
| 267 test(value, Immediate(kSmiTagMask)); | 256 test(value, Immediate(kSmiTagMask)); |
| 268 j(zero, smi_label, not_taken); | 257 j(zero, smi_label, not_taken); |
| 269 } | 258 } |
| 270 // Jump if register contain a non-smi. | 259 // Jump if register contain a non-smi. |
| 271 inline void JumpIfNotSmi(Register value, Label* not_smi_label) { | 260 inline void JumpIfNotSmi(Register value, Label* not_smi_label) { |
| 272 test(value, Immediate(kSmiTagMask)); | 261 test(value, Immediate(kSmiTagMask)); |
| 273 j(not_zero, not_smi_label, not_taken); | 262 j(not_zero, not_smi_label, not_taken); |
| 274 } | 263 } |
| 275 | 264 |
| 276 // Assumes input is a heap object. | |
| 277 void JumpIfNotNumber(Register reg, TypeInfo info, Label* on_not_number); | |
| 278 | |
| 279 // Assumes input is a heap number. Jumps on things out of range. Also jumps | |
| 280 // on the min negative int32. Ignores frational parts. | |
| 281 void ConvertToInt32(Register dst, | |
| 282 Register src, // Can be the same as dst. | |
| 283 Register scratch, // Can be no_reg or dst, but not src. | |
| 284 TypeInfo info, | |
| 285 Label* on_not_int32); | |
| 286 | |
| 287 void LoadPowerOf2(XMMRegister dst, Register scratch, int power); | 265 void LoadPowerOf2(XMMRegister dst, Register scratch, int power); |
| 288 | 266 |
| 289 // Abort execution if argument is not a number. Used in debug code. | 267 // Abort execution if argument is not a number. Used in debug code. |
| 290 void AbortIfNotNumber(Register object); | 268 void AbortIfNotNumber(Register object); |
| 291 | 269 |
| 292 // Abort execution if argument is not a smi. Used in debug code. | 270 // Abort execution if argument is not a smi. Used in debug code. |
| 293 void AbortIfNotSmi(Register object); | 271 void AbortIfNotSmi(Register object); |
| 294 | 272 |
| 295 // Abort execution if argument is a smi. Used in debug code. | 273 // Abort execution if argument is a smi. Used in debug code. |
| 296 void AbortIfSmi(Register object); | 274 void AbortIfSmi(Register object); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } \ | 733 } \ |
| 756 masm-> | 734 masm-> |
| 757 #else | 735 #else |
| 758 #define ACCESS_MASM(masm) masm-> | 736 #define ACCESS_MASM(masm) masm-> |
| 759 #endif | 737 #endif |
| 760 | 738 |
| 761 | 739 |
| 762 } } // namespace v8::internal | 740 } } // namespace v8::internal |
| 763 | 741 |
| 764 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 742 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |