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

Side by Side Diff: runtime/vm/assembler.cc

Issue 136563002: Landing: Write protect executable pages in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler.h ('k') | runtime/vm/assembler_arm.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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/assembler.h" 5 #include "vm/assembler.h"
6 6
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/memory_region.h" 10 #include "vm/memory_region.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 void Process(const MemoryRegion& region, intptr_t position) { 144 void Process(const MemoryRegion& region, intptr_t position) {
145 // Patch the handle into the code. Once the instructions are installed into 145 // Patch the handle into the code. Once the instructions are installed into
146 // a raw code object and the pointer offsets are setup, the handle is 146 // a raw code object and the pointer offsets are setup, the handle is
147 // resolved. 147 // resolved.
148 region.Store<const Object*>(position, &object_); 148 region.Store<const Object*>(position, &object_);
149 pointer_offsets_->Add(position); 149 pointer_offsets_->Add(position);
150 } 150 }
151 151
152 virtual bool IsPointerOffset() const { return true; }
153
152 private: 154 private:
153 ZoneGrowableArray<intptr_t>* pointer_offsets_; 155 ZoneGrowableArray<intptr_t>* pointer_offsets_;
154 const Object& object_; 156 const Object& object_;
155 }; 157 };
156 158
157 159
160 intptr_t AssemblerBuffer::CountPointerOffsets() const {
161 intptr_t count = 0;
162 AssemblerFixup* current = fixup_;
163 while (current != NULL) {
164 if (current->IsPointerOffset()) ++count;
165 current = current->previous_;
166 }
167 return count;
168 }
169
170
158 void AssemblerBuffer::EmitObject(const Object& object) { 171 void AssemblerBuffer::EmitObject(const Object& object) {
159 // Since we are going to store the handle as part of the fixup information 172 // Since we are going to store the handle as part of the fixup information
160 // the handle needs to be a zone handle. 173 // the handle needs to be a zone handle.
161 ASSERT(object.IsNotTemporaryScopedHandle()); 174 ASSERT(object.IsNotTemporaryScopedHandle());
162 ASSERT(object.IsOld()); 175 ASSERT(object.IsOld());
163 EmitFixup(new PatchCodeWithHandle(pointer_offsets_, object)); 176 EmitFixup(new PatchCodeWithHandle(pointer_offsets_, object));
164 cursor_ += kWordSize; // Reserve space for pointer. 177 cursor_ += kWordSize; // Reserve space for pointer.
165 } 178 }
166 179
167 180
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 226
214 for (intptr_t i = 0; i < comments_.length(); i++) { 227 for (intptr_t i = 0; i < comments_.length(); i++) {
215 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); 228 comments.SetPCOffsetAt(i, comments_[i]->pc_offset());
216 comments.SetCommentAt(i, comments_[i]->comment()); 229 comments.SetCommentAt(i, comments_[i]->comment());
217 } 230 }
218 231
219 return comments; 232 return comments;
220 } 233 }
221 234
222 } // namespace dart 235 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler.h ('k') | runtime/vm/assembler_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698