OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 }; | 2159 }; |
2160 | 2160 |
2161 | 2161 |
2162 // Use this scope when you need a one-to-one mapping bewteen methods and | 2162 // Use this scope when you need a one-to-one mapping bewteen methods and |
2163 // instructions. This scope prevents the MacroAssembler from being called and | 2163 // instructions. This scope prevents the MacroAssembler from being called and |
2164 // literal pools from being emitted. It also asserts the number of instructions | 2164 // literal pools from being emitted. It also asserts the number of instructions |
2165 // emitted is what you specified when creating the scope. | 2165 // emitted is what you specified when creating the scope. |
2166 class InstructionAccurateScope BASE_EMBEDDED { | 2166 class InstructionAccurateScope BASE_EMBEDDED { |
2167 public: | 2167 public: |
2168 InstructionAccurateScope(MacroAssembler* masm, size_t count = 0) | 2168 InstructionAccurateScope(MacroAssembler* masm, size_t count = 0) |
2169 : masm_(masm), size_(count * kInstructionSize) { | 2169 : masm_(masm) |
| 2170 #ifdef DEBUG |
| 2171 , |
| 2172 size_(count * kInstructionSize) |
| 2173 #endif |
| 2174 { |
2170 masm_->StartBlockConstPool(); | 2175 masm_->StartBlockConstPool(); |
2171 #ifdef DEBUG | 2176 #ifdef DEBUG |
2172 if (count != 0) { | 2177 if (count != 0) { |
2173 masm_->bind(&start_); | 2178 masm_->bind(&start_); |
2174 } | 2179 } |
2175 previous_allow_macro_instructions_ = masm_->allow_macro_instructions(); | 2180 previous_allow_macro_instructions_ = masm_->allow_macro_instructions(); |
2176 masm_->set_allow_macro_instructions(false); | 2181 masm_->set_allow_macro_instructions(false); |
2177 #endif | 2182 #endif |
2178 } | 2183 } |
2179 | 2184 |
2180 ~InstructionAccurateScope() { | 2185 ~InstructionAccurateScope() { |
2181 masm_->EndBlockConstPool(); | 2186 masm_->EndBlockConstPool(); |
2182 #ifdef DEBUG | 2187 #ifdef DEBUG |
2183 if (start_.is_bound()) { | 2188 if (start_.is_bound()) { |
2184 ASSERT(masm_->SizeOfCodeGeneratedSince(&start_) == size_); | 2189 ASSERT(masm_->SizeOfCodeGeneratedSince(&start_) == size_); |
2185 } | 2190 } |
2186 masm_->set_allow_macro_instructions(previous_allow_macro_instructions_); | 2191 masm_->set_allow_macro_instructions(previous_allow_macro_instructions_); |
2187 #endif | 2192 #endif |
2188 } | 2193 } |
2189 | 2194 |
2190 private: | 2195 private: |
2191 MacroAssembler* masm_; | 2196 MacroAssembler* masm_; |
| 2197 #ifdef DEBUG |
2192 size_t size_; | 2198 size_t size_; |
2193 #ifdef DEBUG | |
2194 Label start_; | 2199 Label start_; |
2195 bool previous_allow_macro_instructions_; | 2200 bool previous_allow_macro_instructions_; |
2196 #endif | 2201 #endif |
2197 }; | 2202 }; |
2198 | 2203 |
2199 | 2204 |
2200 inline MemOperand ContextMemOperand(Register context, int index) { | 2205 inline MemOperand ContextMemOperand(Register context, int index) { |
2201 return MemOperand(context, Context::SlotOffset(index)); | 2206 return MemOperand(context, Context::SlotOffset(index)); |
2202 } | 2207 } |
2203 | 2208 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 #error "Unsupported option" | 2265 #error "Unsupported option" |
2261 #define CODE_COVERAGE_STRINGIFY(x) #x | 2266 #define CODE_COVERAGE_STRINGIFY(x) #x |
2262 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 2267 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
2263 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 2268 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
2264 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 2269 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
2265 #else | 2270 #else |
2266 #define ACCESS_MASM(masm) masm-> | 2271 #define ACCESS_MASM(masm) masm-> |
2267 #endif | 2272 #endif |
2268 | 2273 |
2269 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ | 2274 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ |
OLD | NEW |