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

Side by Side Diff: src/IceAssembler.h

Issue 1197223002: Subzero: Use C++11 member initializers where practical. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rebase Created 5 years, 6 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
« no previous file with comments | « no previous file | src/IceAssembler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===// 1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===//
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 // 5 //
6 // Modified by the Subzero authors. 6 // Modified by the Subzero authors.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // The Subzero Code Generator 10 // The Subzero Code Generator
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 void extendCapacity(); 150 void extendCapacity();
151 }; 151 };
152 152
153 class Assembler { 153 class Assembler {
154 Assembler(const Assembler &) = delete; 154 Assembler(const Assembler &) = delete;
155 Assembler &operator=(const Assembler &) = delete; 155 Assembler &operator=(const Assembler &) = delete;
156 156
157 public: 157 public:
158 Assembler() 158 Assembler() : Allocator(), Buffer(*this) {}
159 : Allocator(), FunctionName(""), IsInternal(false), Preliminary(false),
160 Buffer(*this) {}
161 virtual ~Assembler() = default; 159 virtual ~Assembler() = default;
162 160
163 // Allocate a chunk of bytes using the per-Assembler allocator. 161 // Allocate a chunk of bytes using the per-Assembler allocator.
164 uintptr_t allocateBytes(size_t bytes) { 162 uintptr_t allocateBytes(size_t bytes) {
165 // For now, alignment is not related to NaCl bundle alignment, since 163 // For now, alignment is not related to NaCl bundle alignment, since
166 // the buffer's GetPosition is relative to the base. So NaCl bundle 164 // the buffer's GetPosition is relative to the base. So NaCl bundle
167 // alignment checks can be relative to that base. Later, the buffer 165 // alignment checks can be relative to that base. Later, the buffer
168 // will be copied out to a ".text" section (or an in memory-buffer 166 // will be copied out to a ".text" section (or an in memory-buffer
169 // that can be mprotect'ed with executable permission), and that 167 // that can be mprotect'ed with executable permission), and that
170 // second buffer should be aligned for NaCl. 168 // second buffer should be aligned for NaCl.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Roll back to a (smaller) size. 208 // Roll back to a (smaller) size.
211 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); } 209 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); }
212 void setPreliminary(bool Value) { Preliminary = Value; } 210 void setPreliminary(bool Value) { Preliminary = Value; }
213 bool getPreliminary() const { return Preliminary; } 211 bool getPreliminary() const { return Preliminary; }
214 212
215 private: 213 private:
216 ArenaAllocator<32 * 1024> Allocator; 214 ArenaAllocator<32 * 1024> Allocator;
217 // FunctionName and IsInternal are transferred from the original Cfg 215 // FunctionName and IsInternal are transferred from the original Cfg
218 // object, since the Cfg object may be deleted by the time the 216 // object, since the Cfg object may be deleted by the time the
219 // assembler buffer is emitted. 217 // assembler buffer is emitted.
220 IceString FunctionName; 218 IceString FunctionName = "";
221 bool IsInternal; 219 bool IsInternal = false;
222 // Preliminary indicates whether a preliminary pass is being made 220 // Preliminary indicates whether a preliminary pass is being made
223 // for calculating bundle padding (Preliminary=true), versus the 221 // for calculating bundle padding (Preliminary=true), versus the
224 // final pass where all changes to label bindings, label links, and 222 // final pass where all changes to label bindings, label links, and
225 // relocation fixups are fully committed (Preliminary=false). 223 // relocation fixups are fully committed (Preliminary=false).
226 bool Preliminary; 224 bool Preliminary = false;
227 225
228 protected: 226 protected:
229 // Buffer's constructor uses the Allocator, so it needs to appear after it. 227 // Buffer's constructor uses the Allocator, so it needs to appear after it.
230 // TODO(jpp): dependencies on construction order are a nice way of shooting 228 // TODO(jpp): dependencies on construction order are a nice way of shooting
231 // yourself in the foot. Fix this. 229 // yourself in the foot. Fix this.
232 AssemblerBuffer Buffer; 230 AssemblerBuffer Buffer;
233 }; 231 };
234 232
235 } // end of namespace Ice 233 } // end of namespace Ice
236 234
237 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ 235 #endif // SUBZERO_SRC_ICEASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/IceAssembler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698