| OLD | NEW | 
|---|
| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 237     comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); | 237     comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); | 
| 238     comments.SetCommentAt(i, comments_[i]->comment()); | 238     comments.SetCommentAt(i, comments_[i]->comment()); | 
| 239   } | 239   } | 
| 240 | 240 | 
| 241   return comments; | 241   return comments; | 
| 242 } | 242 } | 
| 243 | 243 | 
| 244 | 244 | 
| 245 intptr_t ObjectPoolWrapper::AddObject(const Object& obj, | 245 intptr_t ObjectPoolWrapper::AddObject(const Object& obj, | 
| 246                                       Patchability patchable) { | 246                                       Patchability patchable) { | 
|  | 247   ASSERT(obj.IsNotTemporaryScopedHandle()); | 
| 247   return AddObject(ObjectPoolWrapperEntry(&obj), patchable); | 248   return AddObject(ObjectPoolWrapperEntry(&obj), patchable); | 
| 248 } | 249 } | 
| 249 | 250 | 
| 250 | 251 | 
| 251 intptr_t ObjectPoolWrapper::AddImmediate(uword imm) { | 252 intptr_t ObjectPoolWrapper::AddImmediate(uword imm) { | 
| 252   return AddObject(ObjectPoolWrapperEntry(imm, ObjectPool::kImmediate), | 253   return AddObject(ObjectPoolWrapperEntry(imm, ObjectPool::kImmediate), | 
| 253                    kNotPatchable); | 254                    kNotPatchable); | 
| 254 } | 255 } | 
| 255 | 256 | 
| 256 intptr_t ObjectPoolWrapper::AddObject(ObjectPoolWrapperEntry entry, | 257 intptr_t ObjectPoolWrapper::AddObject(ObjectPoolWrapperEntry entry, | 
| 257                                       Patchability patchable) { | 258                                       Patchability patchable) { | 
|  | 259   ASSERT((entry.type_ != ObjectPool::kTaggedObject) || | 
|  | 260          (entry.obj_->IsNotTemporaryScopedHandle() && | 
|  | 261           (entry.equivalence_ == NULL || | 
|  | 262            entry.equivalence_->IsNotTemporaryScopedHandle()))); | 
| 258   object_pool_.Add(entry); | 263   object_pool_.Add(entry); | 
| 259   if (patchable == kNotPatchable) { | 264   if (patchable == kNotPatchable) { | 
| 260     // The object isn't patchable. Record the index for fast lookup. | 265     // The object isn't patchable. Record the index for fast lookup. | 
| 261     object_pool_index_table_.Insert( | 266     object_pool_index_table_.Insert( | 
| 262         ObjIndexPair(entry, object_pool_.length() - 1)); | 267         ObjIndexPair(entry, object_pool_.length() - 1)); | 
| 263   } | 268   } | 
| 264   return object_pool_.length() - 1; | 269   return object_pool_.length() - 1; | 
| 265 } | 270 } | 
| 266 | 271 | 
| 267 | 272 | 
| 268 intptr_t ObjectPoolWrapper::FindObject(ObjectPoolWrapperEntry entry, | 273 intptr_t ObjectPoolWrapper::FindObject(ObjectPoolWrapperEntry entry, | 
| 269                                        Patchability patchable) { | 274                                        Patchability patchable) { | 
| 270   // If the object is not patchable, check if we've already got it in the | 275   // If the object is not patchable, check if we've already got it in the | 
| 271   // object pool. | 276   // object pool. | 
| 272   if (patchable == kNotPatchable) { | 277   if (patchable == kNotPatchable) { | 
| 273     intptr_t idx = object_pool_index_table_.Lookup(entry); | 278     intptr_t idx = object_pool_index_table_.Lookup(entry); | 
| 274     if (idx != ObjIndexPair::kNoIndex) { | 279     if (idx != ObjIndexPair::kNoIndex) { | 
| 275       return idx; | 280       return idx; | 
| 276     } | 281     } | 
| 277   } | 282   } | 
| 278 |  | 
| 279   return AddObject(entry, patchable); | 283   return AddObject(entry, patchable); | 
| 280 } | 284 } | 
| 281 | 285 | 
| 282 | 286 | 
| 283 intptr_t ObjectPoolWrapper::FindObject(const Object& obj, | 287 intptr_t ObjectPoolWrapper::FindObject(const Object& obj, | 
| 284                                        Patchability patchable) { | 288                                        Patchability patchable) { | 
| 285   return FindObject(ObjectPoolWrapperEntry(&obj), patchable); | 289   return FindObject(ObjectPoolWrapperEntry(&obj), patchable); | 
| 286 } | 290 } | 
| 287 | 291 | 
| 288 | 292 | 
| 289 intptr_t ObjectPoolWrapper::FindObject(const Object& obj, | 293 intptr_t ObjectPoolWrapper::FindObject(const Object& obj, | 
| 290                                        const Object& equivalence) { | 294                                        const Object& equivalence) { | 
| 291   return FindObject(ObjectPoolWrapperEntry(&obj, &equivalence), | 295   return FindObject(ObjectPoolWrapperEntry(&obj, &equivalence), kNotPatchable); | 
| 292                     kNotPatchable); |  | 
| 293 } | 296 } | 
| 294 | 297 | 
| 295 | 298 | 
| 296 intptr_t ObjectPoolWrapper::FindImmediate(uword imm) { | 299 intptr_t ObjectPoolWrapper::FindImmediate(uword imm) { | 
| 297   return FindObject(ObjectPoolWrapperEntry(imm, ObjectPool::kImmediate), | 300   return FindObject(ObjectPoolWrapperEntry(imm, ObjectPool::kImmediate), | 
| 298                     kNotPatchable); | 301                     kNotPatchable); | 
| 299 } | 302 } | 
| 300 | 303 | 
| 301 | 304 | 
| 302 intptr_t ObjectPoolWrapper::FindNativeEntry(const ExternalLabel* label, | 305 intptr_t ObjectPoolWrapper::FindNativeEntry(const ExternalLabel* label, | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 321       result.SetObjectAt(i, *object_pool_[i].obj_); | 324       result.SetObjectAt(i, *object_pool_[i].obj_); | 
| 322     } else { | 325     } else { | 
| 323       result.SetRawValueAt(i, object_pool_[i].raw_value_); | 326       result.SetRawValueAt(i, object_pool_[i].raw_value_); | 
| 324     } | 327     } | 
| 325   } | 328   } | 
| 326   return result.raw(); | 329   return result.raw(); | 
| 327 } | 330 } | 
| 328 | 331 | 
| 329 | 332 | 
| 330 }  // namespace dart | 333 }  // namespace dart | 
| OLD | NEW | 
|---|