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/assembler.cpp

Issue 930733002: Subzero: Add sandboxing for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a sandboxing test. Rebase. Created 5 years, 10 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/assembler.h ('k') | src/assembler_ia32.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/assembler.cpp - Assembler base class -------------------===// 1 //===- subzero/src/assembler.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 22 matching lines...) Expand all
33 return result; 33 return result;
34 } 34 }
35 35
36 AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind, 36 AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind,
37 const Constant *Value) { 37 const Constant *Value) {
38 AssemblerFixup *F = 38 AssemblerFixup *F =
39 new (assembler_.Allocate<AssemblerFixup>()) AssemblerFixup(); 39 new (assembler_.Allocate<AssemblerFixup>()) AssemblerFixup();
40 F->set_position(0); 40 F->set_position(0);
41 F->set_kind(Kind); 41 F->set_kind(Kind);
42 F->set_value(Value); 42 F->set_value(Value);
43 fixups_.push_back(F); 43 if (!assembler_.getPreliminary())
44 fixups_.push_back(F);
44 return F; 45 return F;
45 } 46 }
46 47
47 #ifndef NDEBUG 48 #ifndef NDEBUG
48 AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer *buffer) { 49 AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer *buffer) {
49 if (buffer->cursor() >= buffer->limit()) 50 if (buffer->cursor() >= buffer->limit())
50 buffer->ExtendCapacity(); 51 buffer->ExtendCapacity();
51 // In debug mode, we save the assembler buffer along with the gap 52 // In debug mode, we save the assembler buffer along with the gap
52 // size before we start emitting to the buffer. This allows us to 53 // size before we start emitting to the buffer. This allows us to
53 // check that any single generated instruction doesn't overflow the 54 // check that any single generated instruction doesn't overflow the
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 145 }
145 // Handle any bytes that are not prefixed by a fixup. 146 // Handle any bytes that are not prefixed by a fixup.
146 for (intptr_t i = CurPosition; i < EndPosition; ++i) { 147 for (intptr_t i = CurPosition; i < EndPosition; ++i) {
147 Str << "\t.byte 0x"; 148 Str << "\t.byte 0x";
148 Str.write_hex(buffer_.Load<uint8_t>(i)); 149 Str.write_hex(buffer_.Load<uint8_t>(i));
149 Str << "\n"; 150 Str << "\n";
150 } 151 }
151 } 152 }
152 153
153 } // end of namespace Ice 154 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698