OLD | NEW |
---|---|
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 23 matching lines...) Expand all Loading... | |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 // Default scratch register used by MacroAssembler (and other code that needs | 36 // Default scratch register used by MacroAssembler (and other code that needs |
37 // a spare register). The register isn't callee save, and not used by the | 37 // a spare register). The register isn't callee save, and not used by the |
38 // function calling convention. | 38 // function calling convention. |
39 static const Register kScratchRegister = r10; | 39 static const Register kScratchRegister = r10; |
40 | 40 |
41 // Forward declaration. | 41 // Forward declaration. |
42 class JumpTarget; | 42 class JumpTarget; |
43 | 43 |
44 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).
| |
45 SmiIndex(Register index_register, ScaleFactor scale) | |
46 : reg(index_register), | |
47 scale(scale) {} | |
48 Register reg; | |
49 ScaleFactor scale; | |
50 }; | |
44 | 51 |
45 // MacroAssembler implements a collection of frequently used macros. | 52 // MacroAssembler implements a collection of frequently used macros. |
46 class MacroAssembler: public Assembler { | 53 class MacroAssembler: public Assembler { |
47 public: | 54 public: |
48 MacroAssembler(void* buffer, int size); | 55 MacroAssembler(void* buffer, int size); |
49 | 56 |
50 void LoadRoot(Register destination, Heap::RootListIndex index); | 57 void LoadRoot(Register destination, Heap::RootListIndex index); |
51 void CompareRoot(Register with, Heap::RootListIndex index); | 58 void CompareRoot(Register with, Heap::RootListIndex index); |
52 void PushRoot(Heap::RootListIndex index); | 59 void PushRoot(Heap::RootListIndex index); |
53 | 60 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 Label* on_not_smi_result); | 241 Label* on_not_smi_result); |
235 | 242 |
236 // Subtract an integer constant from a tagged smi, giving a tagged smi as | 243 // Subtract an integer constant from a tagged smi, giving a tagged smi as |
237 // result, or jumping to a label if the result cannot be represented by a smi. | 244 // result, or jumping to a label if the result cannot be represented by a smi. |
238 // If the label is NULL, no testing on the result is done. | 245 // If the label is NULL, no testing on the result is done. |
239 void SmiSubConstant(Register dst, | 246 void SmiSubConstant(Register dst, |
240 Register src, | 247 Register src, |
241 int32_t constant, | 248 int32_t constant, |
242 Label* on_not_smi_result); | 249 Label* on_not_smi_result); |
243 | 250 |
244 // Negating a smi can give a negative zero or too larget positive value. | 251 // Negating a smi can give a negative zero or too large positive value. |
245 void SmiNeg(Register dst, | 252 void SmiNeg(Register dst, |
246 Register src, | 253 Register src, |
247 Label* on_not_smi_result); | 254 Label* on_not_smi_result); |
248 | 255 |
249 // Adds smi values and return the result as a smi. | 256 // Adds smi values and return the result as a smi. |
250 // If dst is src1, then src1 will be destroyed, even if | 257 // If dst is src1, then src1 will be destroyed, even if |
251 // the operation is unsuccessful. | 258 // the operation is unsuccessful. |
252 void SmiAdd(Register dst, | 259 void SmiAdd(Register dst, |
253 Register src1, | 260 Register src1, |
254 Register src2, | 261 Register src2, |
255 Label* on_not_smi_result); | 262 Label* on_not_smi_result); |
263 | |
256 // Subtracts smi values and return the result as a smi. | 264 // Subtracts smi values and return the result as a smi. |
257 // If dst is src1, then src1 will be destroyed, even if | 265 // If dst is src1, then src1 will be destroyed, even if |
258 // the operation is unsuccessful. | 266 // the operation is unsuccessful. |
259 void SmiSub(Register dst, | 267 void SmiSub(Register dst, |
260 Register src1, | 268 Register src1, |
261 Register src2, | 269 Register src2, |
262 Label* on_not_smi_result); | 270 Label* on_not_smi_result); |
271 | |
263 // Multiplies smi values and return the result as a smi, | 272 // Multiplies smi values and return the result as a smi, |
264 // if possible. | 273 // if possible. |
265 // If dst is src1, then src1 will be destroyed, even if | 274 // If dst is src1, then src1 will be destroyed, even if |
266 // the operation is unsuccessful. | 275 // the operation is unsuccessful. |
267 void SmiMul(Register dst, | 276 void SmiMul(Register dst, |
268 Register src1, | 277 Register src1, |
269 Register src2, | 278 Register src2, |
270 Label* on_not_smi_result); | 279 Label* on_not_smi_result); |
271 | 280 |
272 // Divides one smi by another and returns the quotient. | 281 // Divides one smi by another and returns the quotient. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 | 337 |
329 // Specialized operations | 338 // Specialized operations |
330 | 339 |
331 // Select the non-smi register of two registers where exactly one is a | 340 // Select the non-smi register of two registers where exactly one is a |
332 // smi. If neither are smis, jump to the failure label. | 341 // smi. If neither are smis, jump to the failure label. |
333 void SelectNonSmi(Register dst, | 342 void SelectNonSmi(Register dst, |
334 Register src1, | 343 Register src1, |
335 Register src2, | 344 Register src2, |
336 Label* on_not_smis); | 345 Label* on_not_smis); |
337 | 346 |
347 // Converts, if necessary, a smi to a combination of number and | |
348 // multiplier to be used as a scaled index. | |
349 // The src register contains a *positive* smi value. The shift is the | |
350 // power of two to multiply the index value by (e.g. | |
351 // to index by smi-value * kPointerSize, pass the smi and kPointerSizeLog2). | |
352 // The returned index register may be either src or dst, depending | |
353 // on what is most efficient. If src and dst are different registers, | |
354 // 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
| |
355 SmiIndex SmiToIndex(Register dst, Register src, int shift); | |
356 | |
357 // Converts a positive smi to a negative index. | |
358 SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift); | |
359 | |
338 // --------------------------------------------------------------------------- | 360 // --------------------------------------------------------------------------- |
339 // Macro instructions | 361 // Macro instructions |
340 | 362 |
341 // Expression support | 363 // Expression support |
342 void Set(Register dst, int64_t x); | 364 void Set(Register dst, int64_t x); |
343 void Set(const Operand& dst, int64_t x); | 365 void Set(const Operand& dst, int64_t x); |
344 | 366 |
345 // Handle support | 367 // Handle support |
346 bool IsUnsafeSmi(Smi* value); | 368 bool IsUnsafeSmi(Smi* value); |
347 bool IsUnsafeSmi(Handle<Object> value) { | 369 bool IsUnsafeSmi(Handle<Object> value) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 } \ | 667 } \ |
646 masm-> | 668 masm-> |
647 #else | 669 #else |
648 #define ACCESS_MASM(masm) masm-> | 670 #define ACCESS_MASM(masm) masm-> |
649 #endif | 671 #endif |
650 | 672 |
651 | 673 |
652 } } // namespace v8::internal | 674 } } // namespace v8::internal |
653 | 675 |
654 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 676 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |