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

Side by Side Diff: src/IceAssembler.cpp

Issue 1341423002: Reflow comments to use the full width. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix spelling and rebase Created 5 years, 3 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 | « src/IceAssembler.h ('k') | src/IceAssemblerX86Base.h » ('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.cpp - Assembler base class ----------------===// 1 //===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===//
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 // This is forked from Dart revision 39313. 8 // This is forked from Dart revision 39313.
9 // Please update the revision if we merge back changes from Dart. 9 // Please update the revision if we merge back changes from Dart.
10 // https://code.google.com/p/dart/wiki/GettingTheSource 10 // https://code.google.com/p/dart/wiki/GettingTheSource
(...skipping 30 matching lines...) Expand all
41 new (Assemblr.allocate<AssemblerFixup>()) AssemblerFixup(); 41 new (Assemblr.allocate<AssemblerFixup>()) AssemblerFixup();
42 F->set_position(0); 42 F->set_position(0);
43 F->set_kind(Kind); 43 F->set_kind(Kind);
44 F->set_value(Value); 44 F->set_value(Value);
45 if (!Assemblr.getPreliminary()) 45 if (!Assemblr.getPreliminary())
46 Fixups.push_back(F); 46 Fixups.push_back(F);
47 return F; 47 return F;
48 } 48 }
49 49
50 void AssemblerBuffer::EnsureCapacity::validate(AssemblerBuffer *buffer) { 50 void AssemblerBuffer::EnsureCapacity::validate(AssemblerBuffer *buffer) {
51 // In debug mode, we save the assembler buffer along with the gap 51 // In debug mode, we save the assembler buffer along with the gap size before
52 // size before we start emitting to the buffer. This allows us to 52 // we start emitting to the buffer. This allows us to check that any single
53 // check that any single generated instruction doesn't overflow the 53 // generated instruction doesn't overflow the limit implied by the minimum
54 // limit implied by the minimum gap size. 54 // gap size.
55 Gap = computeGap(); 55 Gap = computeGap();
56 // Make sure that extending the capacity leaves a big enough gap 56 // Make sure that extending the capacity leaves a big enough gap for any kind
57 // for any kind of instruction. 57 // of instruction.
58 assert(Gap >= kMinimumGap); 58 assert(Gap >= kMinimumGap);
59 // Mark the buffer as having ensured the capacity. 59 // Mark the buffer as having ensured the capacity.
60 assert(!buffer->hasEnsuredCapacity()); // Cannot nest. 60 assert(!buffer->hasEnsuredCapacity()); // Cannot nest.
61 buffer->HasEnsuredCapacity = true; 61 buffer->HasEnsuredCapacity = true;
62 } 62 }
63 63
64 AssemblerBuffer::EnsureCapacity::~EnsureCapacity() { 64 AssemblerBuffer::EnsureCapacity::~EnsureCapacity() {
65 // Unmark the buffer, so we cannot emit after this. 65 // Unmark the buffer, so we cannot emit after this.
66 Buffer->HasEnsuredCapacity = false; 66 Buffer->HasEnsuredCapacity = false;
67 // Make sure the generated instruction doesn't take up more 67 // Make sure the generated instruction doesn't take up more space than the
68 // space than the minimum gap. 68 // minimum gap.
69 intptr_t delta = Gap - computeGap(); 69 intptr_t delta = Gap - computeGap();
70 (void)delta; 70 (void)delta;
71 assert(delta <= kMinimumGap); 71 assert(delta <= kMinimumGap);
72 } 72 }
73 73
74 AssemblerBuffer::AssemblerBuffer(Assembler &Asm) : Assemblr(Asm) { 74 AssemblerBuffer::AssemblerBuffer(Assembler &Asm) : Assemblr(Asm) {
75 const intptr_t OneKB = 1024; 75 const intptr_t OneKB = 1024;
76 static const intptr_t kInitialBufferCapacity = 4 * OneKB; 76 static const intptr_t kInitialBufferCapacity = 4 * OneKB;
77 Contents = NewContents(Assemblr, kInitialBufferCapacity); 77 Contents = NewContents(Assemblr, kInitialBufferCapacity);
78 Cursor = Contents; 78 Cursor = Contents;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const intptr_t FixupSize = 4; 126 const intptr_t FixupSize = 4;
127 for (const AssemblerFixup *NextFixup : fixups()) { 127 for (const AssemblerFixup *NextFixup : fixups()) {
128 intptr_t NextFixupLoc = NextFixup->position(); 128 intptr_t NextFixupLoc = NextFixup->position();
129 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { 129 for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) {
130 Str << "\t.byte 0x"; 130 Str << "\t.byte 0x";
131 Str.write_hex(Buffer.load<uint8_t>(i)); 131 Str.write_hex(Buffer.load<uint8_t>(i));
132 Str << "\n"; 132 Str << "\n";
133 } 133 }
134 Str << "\t.long "; 134 Str << "\t.long ";
135 // For PCRel fixups, we write the pc-offset from a symbol into the Buffer 135 // For PCRel fixups, we write the pc-offset from a symbol into the Buffer
136 // (e.g., -4), but we don't represent that in the fixup's offset. 136 // (e.g., -4), but we don't represent that in the fixup's offset. Otherwise
137 // Otherwise the fixup holds the true offset, and so does the Buffer. 137 // the fixup holds the true offset, and so does the Buffer. Just load the
138 // Just load the offset from the buffer. 138 // offset from the buffer.
139 NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc)); 139 NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc));
140 if (fixupIsPCRel(NextFixup->kind())) 140 if (fixupIsPCRel(NextFixup->kind()))
141 Str << " - ."; 141 Str << " - .";
142 Str << "\n"; 142 Str << "\n";
143 CurPosition = NextFixupLoc + FixupSize; 143 CurPosition = NextFixupLoc + FixupSize;
144 assert(CurPosition <= EndPosition); 144 assert(CurPosition <= EndPosition);
145 } 145 }
146 // Handle any bytes that are not prefixed by a fixup. 146 // Handle any bytes that are not prefixed by a fixup.
147 for (intptr_t i = CurPosition; i < EndPosition; ++i) { 147 for (intptr_t i = CurPosition; i < EndPosition; ++i) {
148 Str << "\t.byte 0x"; 148 Str << "\t.byte 0x";
149 Str.write_hex(Buffer.load<uint8_t>(i)); 149 Str.write_hex(Buffer.load<uint8_t>(i));
150 Str << "\n"; 150 Str << "\n";
151 } 151 }
152 } 152 }
153 153
154 } // end of namespace Ice 154 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssembler.h ('k') | src/IceAssemblerX86Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698