Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
instructions.cc
Go to the documentation of this file.
1// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
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.
4
5#include "vm/instructions.h"
6
7#include "vm/object.h"
8#if defined(DART_PRECOMPILER)
10#endif
11
12namespace dart {
13
14bool ObjectAtPoolIndex(const Code& code, intptr_t index, Object* obj) {
15#if defined(DART_PRECOMPILER)
16 if (FLAG_precompiled_mode) {
17 Precompiler* precompiler = Precompiler::Instance();
18 if (precompiler != nullptr) {
20 precompiler->global_object_pool_builder();
21 if (index < pool->CurrentLength()) {
22 compiler::ObjectPoolBuilderEntry& entry = pool->EntryAt(index);
24 *obj = entry.obj_->ptr();
25 return true;
26 }
27 }
28 }
29 return false;
30 }
31#endif
32 const ObjectPool& pool = ObjectPool::Handle(code.GetObjectPool());
33 if (!pool.IsNull() && (index < pool.Length()) &&
34 (pool.TypeAt(index) == ObjectPool::EntryType::kTaggedObject)) {
35 *obj = pool.ObjectAt(index);
36 return true;
37 }
38 return false;
39}
40
41} // namespace dart
AutoreleasePool pool
ObjectPtr ptr() const
Definition object.h:332
static Object & Handle()
Definition object.h:407
static Precompiler * Instance()
compiler::ObjectPoolBuilder * global_object_pool_builder()
bool ObjectAtPoolIndex(const Code &code, intptr_t index, Object *obj)