Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: src/a64/macro-assembler-a64.h

Issue 181873002: A64: Move veneer emission checking in the Assembler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove the force_emit parameter in CheckVeneerPool Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/a64/lithium-codegen-a64.cc ('k') | src/a64/macro-assembler-a64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 // different ranges. While the Assembler will fail to assemble a branch 2163 // different ranges. While the Assembler will fail to assemble a branch
2164 // exceeding its range, the MacroAssembler offers a mechanism to resolve 2164 // exceeding its range, the MacroAssembler offers a mechanism to resolve
2165 // branches to too distant targets, either by tweaking the generated code to 2165 // branches to too distant targets, either by tweaking the generated code to
2166 // use branch instructions with wider ranges or generating veneers. 2166 // use branch instructions with wider ranges or generating veneers.
2167 // 2167 //
2168 // Currently branches to distant targets are resolved using unconditional 2168 // Currently branches to distant targets are resolved using unconditional
2169 // branch isntructions with a range of +-128MB. If that becomes too little 2169 // branch isntructions with a range of +-128MB. If that becomes too little
2170 // (!), the mechanism can be extended to generate special veneers for really 2170 // (!), the mechanism can be extended to generate special veneers for really
2171 // far targets. 2171 // far targets.
2172 2172
2173 // Returns true if we should emit a veneer as soon as possible for a branch
2174 // which can at most reach to specified pc.
2175 bool ShouldEmitVeneer(int max_reachable_pc,
2176 int margin = kVeneerDistanceMargin);
2177
2178 // The maximum code size generated for a veneer. Currently one branch
2179 // instruction. This is for code size checking purposes, and can be extended
2180 // in the future for example if we decide to add nops between the veneers.
2181 static const int kMaxVeneerCodeSize = 1 * kInstructionSize;
2182
2183 // Emits veneers for branches that are approaching their maximum range.
2184 // If need_protection is true, the veneers are protected by a branch jumping
2185 // over the code.
2186 void EmitVeneers(bool need_protection);
2187 void EmitVeneersGuard();
2188 // Checks wether veneers need to be emitted at this point.
2189 void CheckVeneers(bool need_protection);
2190
2191 // Helps resolve branching to labels potentially out of range. 2173 // Helps resolve branching to labels potentially out of range.
2192 // If the label is not bound, it registers the information necessary to later 2174 // If the label is not bound, it registers the information necessary to later
2193 // be able to emit a veneer for this branch if necessary. 2175 // be able to emit a veneer for this branch if necessary.
2194 // If the label is bound, it returns true if the label (or the previous link 2176 // If the label is bound, it returns true if the label (or the previous link
2195 // in the label chain) is out of range. In that case the caller is responsible 2177 // in the label chain) is out of range. In that case the caller is responsible
2196 // for generating appropriate code. 2178 // for generating appropriate code.
2197 // Otherwise it returns false. 2179 // Otherwise it returns false.
2198 // This function also checks wether veneers need to be emitted. 2180 // This function also checks wether veneers need to be emitted.
2199 bool NeedExtraInstructionsOrRegisterBranch(Label *label, 2181 bool NeedExtraInstructionsOrRegisterBranch(Label *label,
2200 ImmBranchType branch_type); 2182 ImmBranchType branch_type);
2201
2202 private:
2203 // We generate a veneer for a branch if we reach within this distance of the
2204 // limit of the range.
2205 static const int kVeneerDistanceMargin = 4 * KB;
2206 int unresolved_branches_first_limit() const {
2207 ASSERT(!unresolved_branches_.empty());
2208 return unresolved_branches_.begin()->first;
2209 }
2210 }; 2183 };
2211 2184
2212 2185
2213 // Use this scope when you need a one-to-one mapping bewteen methods and 2186 // Use this scope when you need a one-to-one mapping bewteen methods and
2214 // instructions. This scope prevents the MacroAssembler from being called and 2187 // instructions. This scope prevents the MacroAssembler from being called and
2215 // literal pools from being emitted. It also asserts the number of instructions 2188 // literal pools from being emitted. It also asserts the number of instructions
2216 // emitted is what you specified when creating the scope. 2189 // emitted is what you specified when creating the scope.
2217 class InstructionAccurateScope BASE_EMBEDDED { 2190 class InstructionAccurateScope BASE_EMBEDDED {
2218 public: 2191 public:
2219 InstructionAccurateScope(MacroAssembler* masm, size_t count = 0) 2192 InstructionAccurateScope(MacroAssembler* masm, size_t count = 0)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 #error "Unsupported option" 2292 #error "Unsupported option"
2320 #define CODE_COVERAGE_STRINGIFY(x) #x 2293 #define CODE_COVERAGE_STRINGIFY(x) #x
2321 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 2294 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
2322 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 2295 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
2323 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 2296 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
2324 #else 2297 #else
2325 #define ACCESS_MASM(masm) masm-> 2298 #define ACCESS_MASM(masm) masm->
2326 #endif 2299 #endif
2327 2300
2328 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_ 2301 #endif // V8_A64_MACRO_ASSEMBLER_A64_H_
OLDNEW
« no previous file with comments | « src/a64/lithium-codegen-a64.cc ('k') | src/a64/macro-assembler-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698