| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // The class 'AssemblerMacros' contains assembler instruction groups that | 4 // The class 'AssemblerMacros' contains assembler instruction groups that |
| 5 // are used in Dart. | 5 // are used in Dart. |
| 6 | 6 |
| 7 #ifndef VM_ASSEMBLER_MACROS_IA32_H_ | 7 #ifndef VM_ASSEMBLER_MACROS_IA32_H_ |
| 8 #define VM_ASSEMBLER_MACROS_IA32_H_ | 8 #define VM_ASSEMBLER_MACROS_IA32_H_ |
| 9 | 9 |
| 10 #ifndef VM_ASSEMBLER_MACROS_H_ | 10 #ifndef VM_ASSEMBLER_MACROS_H_ |
| 11 #error Do not include assembler_macros_ia32.h directly; use assembler_macros.h. | 11 #error Do not include assembler_macros_ia32.h directly; use assembler_macros.h. |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "vm/allocation.h" | 14 #include "vm/allocation.h" |
| 15 #include "vm/constants_ia32.h" | 15 #include "vm/constants_ia32.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 // Forward declarations. | 19 // Forward declarations. |
| 20 class Assembler; | 20 class Assembler; |
| 21 class Class; | 21 class Class; |
| 22 class Label; | 22 class Label; |
| 23 | 23 |
| 24 class AssemblerMacros : public AllStatic { | 24 class AssemblerMacros : public AllStatic { |
| 25 public: | 25 public: |
| 26 // Inlined allocation of an instance of class 'cls', code has no runtime | 26 // Inlined allocation of an instance of class 'cls', code has no runtime |
| 27 // calls. Jump to 'failure' if the instance cannot be allocated here. | 27 // calls. Jump to 'failure' if the instance cannot be allocated here. |
| 28 // Class must be loaded in 'class_reg'. Allocated instance is returned | 28 // Allocated instance is returned in 'instance_reg'. |
| 29 // in 'instance_reg'. Only the class field of the object is initialized. | 29 // Only the tags field of the object is initialized. |
| 30 // 'class_reg' and 'instance_reg' may not be the same register. | |
| 31 static void TryAllocate(Assembler* assembler, | 30 static void TryAllocate(Assembler* assembler, |
| 32 const Class& cls, | 31 const Class& cls, |
| 33 Register class_reg, | |
| 34 Label* failure, | 32 Label* failure, |
| 35 Register instance_reg); | 33 Register instance_reg); |
| 36 | 34 |
| 37 // Set up a dart frame on entry with a frame pointer and PC information to | 35 // Set up a dart frame on entry with a frame pointer and PC information to |
| 38 // enable easy access to the RawInstruction object of code corresponding | 36 // enable easy access to the RawInstruction object of code corresponding |
| 39 // to this frame. | 37 // to this frame. |
| 40 // The dart frame layout is as follows: | 38 // The dart frame layout is as follows: |
| 41 // .... | 39 // .... |
| 42 // ret PC | 40 // ret PC |
| 43 // saved EBP <=== EBP | 41 // saved EBP <=== EBP |
| (...skipping 30 matching lines...) Expand all Loading... |
| 74 // pushl ebp (size is 1 byte) | 72 // pushl ebp (size is 1 byte) |
| 75 // movl ebp, esp (size is 2 bytes) | 73 // movl ebp, esp (size is 2 bytes) |
| 76 // call L (size is 5 bytes) | 74 // call L (size is 5 bytes) |
| 77 // L: | 75 // L: |
| 78 static const intptr_t kOffsetOfSavedPCfromEntrypoint = 8; | 76 static const intptr_t kOffsetOfSavedPCfromEntrypoint = 8; |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 } // namespace dart. | 79 } // namespace dart. |
| 82 | 80 |
| 83 #endif // VM_ASSEMBLER_MACROS_IA32_H_ | 81 #endif // VM_ASSEMBLER_MACROS_IA32_H_ |
| OLD | NEW |