OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 void jmp(Label* L) { b(L, al); } | 918 void jmp(Label* L) { b(L, al); } |
919 | 919 |
920 // Check the code size generated from label to here. | 920 // Check the code size generated from label to here. |
921 int InstructionsGeneratedSince(Label* l) { | 921 int InstructionsGeneratedSince(Label* l) { |
922 return (pc_offset() - l->pos()) / kInstrSize; | 922 return (pc_offset() - l->pos()) / kInstrSize; |
923 } | 923 } |
924 | 924 |
925 // Check whether an immediate fits an addressing mode 1 instruction. | 925 // Check whether an immediate fits an addressing mode 1 instruction. |
926 bool ImmediateFitsAddrMode1Instruction(int32_t imm32); | 926 bool ImmediateFitsAddrMode1Instruction(int32_t imm32); |
927 | 927 |
928 // Postpone the generation of the constant pool for the specified number of | 928 // Class for scoping postponing the constant pool generation. |
929 // instructions. | 929 class BlockConstPoolScope { |
930 void BlockConstPoolFor(int instructions); | 930 public: |
| 931 explicit BlockConstPoolScope(Assembler* assem) : assem_(assem) { |
| 932 assem_->const_pool_blocked_nesting_++; |
| 933 } |
| 934 ~BlockConstPoolScope() { |
| 935 assem_->const_pool_blocked_nesting_--; |
| 936 } |
| 937 |
| 938 private: |
| 939 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockConstPoolScope); |
| 940 |
| 941 Assembler* assem_; |
| 942 }; |
931 | 943 |
932 // Debugging | 944 // Debugging |
933 | 945 |
934 // Mark address of the ExitJSFrame code. | 946 // Mark address of the ExitJSFrame code. |
935 void RecordJSReturn(); | 947 void RecordJSReturn(); |
936 | 948 |
937 // Record a comment relocation entry that can be used by a disassembler. | 949 // Record a comment relocation entry that can be used by a disassembler. |
938 // Use --debug_code to enable. | 950 // Use --debug_code to enable. |
939 void RecordComment(const char* msg); | 951 void RecordComment(const char* msg); |
940 | 952 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 // Pools are emitted after function return and in dead code at (more or less) | 1027 // Pools are emitted after function return and in dead code at (more or less) |
1016 // regular intervals of kDistBetweenPools bytes | 1028 // regular intervals of kDistBetweenPools bytes |
1017 static const int kDistBetweenPools = 1*KB; | 1029 static const int kDistBetweenPools = 1*KB; |
1018 | 1030 |
1019 // Constants in pools are accessed via pc relative addressing, which can | 1031 // Constants in pools are accessed via pc relative addressing, which can |
1020 // reach +/-4KB thereby defining a maximum distance between the instruction | 1032 // reach +/-4KB thereby defining a maximum distance between the instruction |
1021 // and the accessed constant. We satisfy this constraint by limiting the | 1033 // and the accessed constant. We satisfy this constraint by limiting the |
1022 // distance between pools. | 1034 // distance between pools. |
1023 static const int kMaxDistBetweenPools = 4*KB - 2*kBufferCheckInterval; | 1035 static const int kMaxDistBetweenPools = 4*KB - 2*kBufferCheckInterval; |
1024 | 1036 |
1025 // Emission of the constant pool may be blocked in some code sequences | 1037 // Emission of the constant pool may be blocked in some code sequences. |
1026 int no_const_pool_before_; // block emission before this pc offset | 1038 int const_pool_blocked_nesting_; // Block emission if this is not zero. |
| 1039 int no_const_pool_before_; // Block emission before this pc offset. |
1027 | 1040 |
1028 // Keep track of the last emitted pool to guarantee a maximal distance | 1041 // Keep track of the last emitted pool to guarantee a maximal distance |
1029 int last_const_pool_end_; // pc offset following the last constant pool | 1042 int last_const_pool_end_; // pc offset following the last constant pool |
1030 | 1043 |
1031 // Relocation info generation | 1044 // Relocation info generation |
1032 // Each relocation is encoded as a variable size value | 1045 // Each relocation is encoded as a variable size value |
1033 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; | 1046 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; |
1034 RelocInfoWriter reloc_info_writer; | 1047 RelocInfoWriter reloc_info_writer; |
1035 // Relocation info records are also used during code generation as temporary | 1048 // Relocation info records are also used during code generation as temporary |
1036 // containers for constants and code target addresses until they are emitted | 1049 // containers for constants and code target addresses until they are emitted |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 void bind_to(Label* L, int pos); | 1081 void bind_to(Label* L, int pos); |
1069 void link_to(Label* L, Label* appendix); | 1082 void link_to(Label* L, Label* appendix); |
1070 void next(Label* L); | 1083 void next(Label* L); |
1071 | 1084 |
1072 // Record reloc info for current pc_ | 1085 // Record reloc info for current pc_ |
1073 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1086 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
1074 | 1087 |
1075 friend class RegExpMacroAssemblerARM; | 1088 friend class RegExpMacroAssemblerARM; |
1076 friend class RelocInfo; | 1089 friend class RelocInfo; |
1077 friend class CodePatcher; | 1090 friend class CodePatcher; |
| 1091 friend class BlockConstPoolScope; |
1078 }; | 1092 }; |
1079 | 1093 |
1080 } } // namespace v8::internal | 1094 } } // namespace v8::internal |
1081 | 1095 |
1082 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1096 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |