a6a48f2e52
Demote newly introduced VM class NativeEntryData from a VM instance class to a simple TypedData wrapper class. Change-Id: I44aacee33500c93eb283d2d349cd7a24dd94de65 Reviewed-on: https://dart-review.googlesource.com/74323 Commit-Queue: Régis Crelier <regis@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
36 lines
1.3 KiB
C++
36 lines
1.3 KiB
C++
// Copyright (c) 2018, 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/globals.h"
|
|
#if !defined(DART_PRECOMPILED_RUNTIME)
|
|
|
|
#include "vm/instructions.h"
|
|
#include "vm/instructions_kbc.h"
|
|
|
|
#include "vm/constants_kbc.h"
|
|
#include "vm/native_entry.h"
|
|
|
|
namespace dart {
|
|
|
|
RawTypedData* KBCNativeCallPattern::GetNativeEntryDataAt(uword pc,
|
|
const Code& bytecode) {
|
|
ASSERT(bytecode.ContainsInstructionAt(pc));
|
|
const uword call_pc = pc - sizeof(KBCInstr);
|
|
KBCInstr call_instr = KernelBytecode::At(call_pc);
|
|
ASSERT(KernelBytecode::DecodeOpcode(call_instr) ==
|
|
KernelBytecode::kNativeCall);
|
|
intptr_t native_entry_data_pool_index = KernelBytecode::DecodeD(call_instr);
|
|
const ObjectPool& object_pool = ObjectPool::Handle(bytecode.GetObjectPool());
|
|
TypedData& native_entry_data = TypedData::Handle();
|
|
native_entry_data ^= object_pool.ObjectAt(native_entry_data_pool_index);
|
|
// Native calls to recognized functions should never be patched.
|
|
ASSERT(NativeEntryData(native_entry_data).kind() ==
|
|
MethodRecognizer::kUnknown);
|
|
return native_entry_data.raw();
|
|
}
|
|
|
|
} // namespace dart
|
|
|
|
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|