mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:57:35 +00:00
f7c7076fe8
This was broken by the move to the global object pool. TEST=--disassemble Change-Id: I2cbff1e2fa1a56d8d4d98d447a5726c0764e1a0e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244460 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "vm/instructions.h"
|
|
|
|
#include "vm/object.h"
|
|
#if defined(DART_PRECOMPILER)
|
|
#include "vm/compiler/aot/precompiler.h"
|
|
#endif
|
|
|
|
namespace dart {
|
|
|
|
bool ObjectAtPoolIndex(const Code& code, intptr_t index, Object* obj) {
|
|
#if defined(DART_PRECOMPILER)
|
|
if (FLAG_precompiled_mode) {
|
|
Precompiler* precompiler = Precompiler::Instance();
|
|
if (precompiler != nullptr) {
|
|
compiler::ObjectPoolBuilder* pool =
|
|
precompiler->global_object_pool_builder();
|
|
if (index < pool->CurrentLength()) {
|
|
compiler::ObjectPoolBuilderEntry& entry = pool->EntryAt(index);
|
|
if (entry.type() == compiler::ObjectPoolBuilderEntry::kTaggedObject) {
|
|
*obj = entry.obj_->ptr();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
#endif
|
|
const ObjectPool& pool = ObjectPool::Handle(code.GetObjectPool());
|
|
if (!pool.IsNull() && (index < pool.Length()) &&
|
|
(pool.TypeAt(index) == ObjectPool::EntryType::kTaggedObject)) {
|
|
*obj = pool.ObjectAt(index);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace dart
|