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

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

Issue 1295693002: Add ObjectPool tag for external labels. Use LoadExternalLabel for native calls... (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 object_pool_index_table_.Insert( 260 object_pool_index_table_.Insert(
261 ObjIndexPair(entry, object_pool_.length() - 1)); 261 ObjIndexPair(entry, object_pool_.length() - 1));
262 } 262 }
263 return object_pool_.length() - 1; 263 return object_pool_.length() - 1;
264 } 264 }
265 265
266 266
267 intptr_t ObjectPoolWrapper::AddExternalLabel(const ExternalLabel* label, 267 intptr_t ObjectPoolWrapper::AddExternalLabel(const ExternalLabel* label,
268 Patchability patchable) { 268 Patchability patchable) {
269 return AddObject(ObjectPool::Entry(label->address(), 269 return AddObject(ObjectPool::Entry(label->address(),
270 ObjectPool::kImmediate), 270 ObjectPool::kExternalLabel),
271 patchable); 271 patchable);
272 } 272 }
273 273
274 274
275 intptr_t ObjectPoolWrapper::FindObject(ObjectPool::Entry entry, 275 intptr_t ObjectPoolWrapper::FindObject(ObjectPool::Entry entry,
276 Patchability patchable) { 276 Patchability patchable) {
277 // If the object is not patchable, check if we've already got it in the 277 // If the object is not patchable, check if we've already got it in the
278 // object pool. 278 // object pool.
279 if (patchable == kNotPatchable) { 279 if (patchable == kNotPatchable) {
280 intptr_t idx = object_pool_index_table_.Lookup(entry); 280 intptr_t idx = object_pool_index_table_.Lookup(entry);
(...skipping 13 matching lines...) Expand all
294 294
295 intptr_t ObjectPoolWrapper::FindImmediate(uword imm) { 295 intptr_t ObjectPoolWrapper::FindImmediate(uword imm) {
296 return FindObject(ObjectPool::Entry(imm, ObjectPool::kImmediate), 296 return FindObject(ObjectPool::Entry(imm, ObjectPool::kImmediate),
297 kNotPatchable); 297 kNotPatchable);
298 } 298 }
299 299
300 300
301 intptr_t ObjectPoolWrapper::FindExternalLabel(const ExternalLabel* label, 301 intptr_t ObjectPoolWrapper::FindExternalLabel(const ExternalLabel* label,
302 Patchability patchable) { 302 Patchability patchable) {
303 return FindObject(ObjectPool::Entry(label->address(), 303 return FindObject(ObjectPool::Entry(label->address(),
304 ObjectPool::kImmediate), 304 ObjectPool::kExternalLabel),
305 patchable); 305 patchable);
306 } 306 }
307 307
308 308
309 RawObjectPool* ObjectPoolWrapper::MakeObjectPool() { 309 RawObjectPool* ObjectPoolWrapper::MakeObjectPool() {
310 intptr_t len = object_pool_.length(); 310 intptr_t len = object_pool_.length();
311 if (len == 0) { 311 if (len == 0) {
312 return Object::empty_object_pool().raw(); 312 return Object::empty_object_pool().raw();
313 } 313 }
314 const ObjectPool& result = ObjectPool::Handle(ObjectPool::New(len)); 314 const ObjectPool& result = ObjectPool::Handle(ObjectPool::New(len));
315 const TypedData& info_array = TypedData::Handle(result.info_array()); 315 const TypedData& info_array = TypedData::Handle(result.info_array());
316 for (intptr_t i = 0; i < len; ++i) { 316 for (intptr_t i = 0; i < len; ++i) {
317 ObjectPool::EntryType info = object_pool_[i].type_; 317 ObjectPool::EntryType info = object_pool_[i].type_;
318 info_array.SetInt8(i, static_cast<int8_t>(info)); 318 info_array.SetInt8(i, static_cast<int8_t>(info));
319 if (info == ObjectPool::kTaggedObject) { 319 if (info == ObjectPool::kTaggedObject) {
320 result.SetObjectAt(i, *object_pool_[i].obj_); 320 result.SetObjectAt(i, *object_pool_[i].obj_);
321 } else { 321 } else {
322 result.SetRawValueAt(i, object_pool_[i].raw_value_); 322 result.SetRawValueAt(i, object_pool_[i].raw_value_);
323 } 323 }
324 } 324 }
325 return result.raw(); 325 return result.raw();
326 } 326 }
327 327
328 328
329 } // namespace dart 329 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/objectpool_view.html ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698