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

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

Issue 1253373002: VM: Hoist handle allocation out of loop when creating the object pool. (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
« no previous file with comments | « no previous file | runtime/vm/object.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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 for (intptr_t i = 0; i < len; ++i) { 316 for (intptr_t i = 0; i < len; ++i) {
316 ObjectPool::EntryType info = object_pool_[i].type_; 317 ObjectPool::EntryType info = object_pool_[i].type_;
317 result.SetInfoAt(i, info); 318 info_array.SetInt8(i, static_cast<int8_t>(info));
318 if (info == ObjectPool::kTaggedObject) { 319 if (info == ObjectPool::kTaggedObject) {
319 result.SetObjectAt(i, *object_pool_[i].obj_); 320 result.SetObjectAt(i, *object_pool_[i].obj_);
320 } else { 321 } else {
321 result.SetRawValueAt(i, object_pool_[i].raw_value_); 322 result.SetRawValueAt(i, object_pool_[i].raw_value_);
322 } 323 }
323 } 324 }
324 return result.raw(); 325 return result.raw();
325 } 326 }
326 327
327 328
328 } // namespace dart 329 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698