mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[DBC simulator] Rename class Bytecode to SimulatorBytecode.
This frees the name Bytecode that will become the name of a new VM class. Class Code will only refer to compiled code and Bytecode will refer to kernel bytecode. Change-Id: If64a5d688f0bf75220e67ef2932f4141782e9dc3 Reviewed-on: https://dart-review.googlesource.com/c/82703 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Régis Crelier <regis@google.com>
This commit is contained in:
parent
37e5873fd1
commit
27127b364a
|
@ -21,14 +21,15 @@ DECLARE_FLAG(bool, inline_alloc);
|
|||
void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) {
|
||||
const uword end = data + length;
|
||||
while (data < end) {
|
||||
*reinterpret_cast<int32_t*>(data) = Bytecode::kTrap;
|
||||
*reinterpret_cast<int32_t*>(data) = SimulatorBytecode::kTrap;
|
||||
data += sizeof(int32_t);
|
||||
}
|
||||
}
|
||||
|
||||
#define DEFINE_EMIT(Name, Signature, Fmt0, Fmt1, Fmt2) \
|
||||
void Assembler::Name(PARAMS_##Signature) { \
|
||||
Emit(Bytecode::FENCODE_##Signature(Bytecode::k##Name ENCODE_##Signature)); \
|
||||
Emit(SimulatorBytecode::FENCODE_##Signature( \
|
||||
SimulatorBytecode::k##Name ENCODE_##Signature)); \
|
||||
}
|
||||
|
||||
#define PARAMS_0
|
||||
|
@ -75,7 +76,7 @@ const char* Assembler::RegisterName(Register reg) {
|
|||
}
|
||||
|
||||
static int32_t EncodeJump(int32_t relative_pc) {
|
||||
return Bytecode::kJump | (relative_pc << 8);
|
||||
return SimulatorBytecode::kJump | (relative_pc << 8);
|
||||
}
|
||||
|
||||
static int32_t OffsetToPC(int32_t offset) {
|
||||
|
@ -108,7 +109,7 @@ void Assembler::Bind(Label* label) {
|
|||
|
||||
void Assembler::Stop(const char* message) {
|
||||
// TODO(vegorov) support passing a message to the bytecode.
|
||||
Emit(Bytecode::kTrap);
|
||||
Emit(SimulatorBytecode::kTrap);
|
||||
}
|
||||
|
||||
void Assembler::PushConstant(const Object& obj) {
|
||||
|
|
|
@ -47,7 +47,7 @@ class Assembler : public AssemblerBase {
|
|||
|
||||
static const char* FpuRegisterName(FpuRegister reg) { return "?"; }
|
||||
|
||||
static uword GetBreakInstructionFiller() { return Bytecode::kTrap; }
|
||||
static uword GetBreakInstructionFiller() { return SimulatorBytecode::kTrap; }
|
||||
|
||||
static bool IsSafe(const Object& value) { return true; }
|
||||
static bool IsSafeSmi(const Object& value) { return false; }
|
||||
|
|
|
@ -516,20 +516,23 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
|
|||
}
|
||||
|
||||
if (!compiler->is_optimizing()) {
|
||||
const Bytecode::Opcode eq_op = needs_number_check()
|
||||
? Bytecode::kIfEqStrictNumTOS
|
||||
: Bytecode::kIfEqStrictTOS;
|
||||
const Bytecode::Opcode ne_op = needs_number_check()
|
||||
? Bytecode::kIfNeStrictNumTOS
|
||||
: Bytecode::kIfNeStrictTOS;
|
||||
const SimulatorBytecode::Opcode eq_op =
|
||||
needs_number_check() ? SimulatorBytecode::kIfEqStrictNumTOS
|
||||
: SimulatorBytecode::kIfEqStrictTOS;
|
||||
const SimulatorBytecode::Opcode ne_op =
|
||||
needs_number_check() ? SimulatorBytecode::kIfNeStrictNumTOS
|
||||
: SimulatorBytecode::kIfNeStrictTOS;
|
||||
__ Emit(comparison == Token::kEQ_STRICT ? eq_op : ne_op);
|
||||
} else {
|
||||
const Bytecode::Opcode eq_op =
|
||||
needs_number_check() ? Bytecode::kIfEqStrictNum : Bytecode::kIfEqStrict;
|
||||
const Bytecode::Opcode ne_op =
|
||||
needs_number_check() ? Bytecode::kIfNeStrictNum : Bytecode::kIfNeStrict;
|
||||
__ Emit(Bytecode::Encode((comparison == Token::kEQ_STRICT) ? eq_op : ne_op,
|
||||
locs()->in(0).reg(), locs()->in(1).reg()));
|
||||
const SimulatorBytecode::Opcode eq_op =
|
||||
needs_number_check() ? SimulatorBytecode::kIfEqStrictNum
|
||||
: SimulatorBytecode::kIfEqStrict;
|
||||
const SimulatorBytecode::Opcode ne_op =
|
||||
needs_number_check() ? SimulatorBytecode::kIfNeStrictNum
|
||||
: SimulatorBytecode::kIfNeStrict;
|
||||
__ Emit(SimulatorBytecode::Encode(
|
||||
(comparison == Token::kEQ_STRICT) ? eq_op : ne_op, locs()->in(0).reg(),
|
||||
locs()->in(1).reg()));
|
||||
}
|
||||
|
||||
if (needs_number_check() && token_pos().IsReal()) {
|
||||
|
@ -1868,43 +1871,43 @@ static Token::Kind FlipCondition(Token::Kind kind) {
|
|||
}
|
||||
}
|
||||
|
||||
static Bytecode::Opcode OpcodeForSmiCondition(Token::Kind kind) {
|
||||
static SimulatorBytecode::Opcode OpcodeForSmiCondition(Token::Kind kind) {
|
||||
switch (kind) {
|
||||
case Token::kEQ:
|
||||
return Bytecode::kIfEqStrict;
|
||||
return SimulatorBytecode::kIfEqStrict;
|
||||
case Token::kNE:
|
||||
return Bytecode::kIfNeStrict;
|
||||
return SimulatorBytecode::kIfNeStrict;
|
||||
case Token::kLT:
|
||||
return Bytecode::kIfLt;
|
||||
return SimulatorBytecode::kIfLt;
|
||||
case Token::kGT:
|
||||
return Bytecode::kIfGt;
|
||||
return SimulatorBytecode::kIfGt;
|
||||
case Token::kLTE:
|
||||
return Bytecode::kIfLe;
|
||||
return SimulatorBytecode::kIfLe;
|
||||
case Token::kGTE:
|
||||
return Bytecode::kIfGe;
|
||||
return SimulatorBytecode::kIfGe;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return Bytecode::kTrap;
|
||||
return SimulatorBytecode::kTrap;
|
||||
}
|
||||
}
|
||||
|
||||
static Bytecode::Opcode OpcodeForDoubleCondition(Token::Kind kind) {
|
||||
static SimulatorBytecode::Opcode OpcodeForDoubleCondition(Token::Kind kind) {
|
||||
switch (kind) {
|
||||
case Token::kEQ:
|
||||
return Bytecode::kIfDEq;
|
||||
return SimulatorBytecode::kIfDEq;
|
||||
case Token::kNE:
|
||||
return Bytecode::kIfDNe;
|
||||
return SimulatorBytecode::kIfDNe;
|
||||
case Token::kLT:
|
||||
return Bytecode::kIfDLt;
|
||||
return SimulatorBytecode::kIfDLt;
|
||||
case Token::kGT:
|
||||
return Bytecode::kIfDGt;
|
||||
return SimulatorBytecode::kIfDGt;
|
||||
case Token::kLTE:
|
||||
return Bytecode::kIfDLe;
|
||||
return SimulatorBytecode::kIfDLe;
|
||||
case Token::kGTE:
|
||||
return Bytecode::kIfDGe;
|
||||
return SimulatorBytecode::kIfDGe;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return Bytecode::kTrap;
|
||||
return SimulatorBytecode::kTrap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1926,7 +1929,8 @@ static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler,
|
|||
if (compiler->is_optimizing()) {
|
||||
const Register left = locs->in(0).reg();
|
||||
const Register right = locs->in(1).reg();
|
||||
__ Emit(Bytecode::Encode(OpcodeForSmiCondition(comparison), left, right));
|
||||
__ Emit(SimulatorBytecode::Encode(OpcodeForSmiCondition(comparison), left,
|
||||
right));
|
||||
return condition;
|
||||
} else {
|
||||
switch (kind) {
|
||||
|
@ -1967,7 +1971,8 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
|
|||
// TODO(fschneider): Change the block order instead in DBC so that the
|
||||
// false block in always the fall-through block.
|
||||
Condition condition = NEXT_IS_TRUE;
|
||||
__ Emit(Bytecode::Encode(OpcodeForDoubleCondition(comparison), left, right));
|
||||
__ Emit(SimulatorBytecode::Encode(OpcodeForDoubleCondition(comparison), left,
|
||||
right));
|
||||
return condition;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace dart {
|
||||
|
||||
// clang-format off
|
||||
// List of Dart Bytecode instructions.
|
||||
// List of Simulator Bytecode instructions.
|
||||
//
|
||||
// INTERPRETER STATE
|
||||
//
|
||||
|
@ -943,7 +943,7 @@ namespace dart {
|
|||
|
||||
typedef uint32_t Instr;
|
||||
|
||||
class Bytecode {
|
||||
class SimulatorBytecode {
|
||||
public:
|
||||
enum Opcode {
|
||||
#define DECLARE_BYTECODE(name, encoding, op1, op2, op3) k##name,
|
||||
|
@ -1015,18 +1015,18 @@ class Bytecode {
|
|||
}
|
||||
|
||||
DART_FORCE_INLINE static bool IsTrap(Instr instr) {
|
||||
return DecodeOpcode(instr) == Bytecode::kTrap;
|
||||
return DecodeOpcode(instr) == SimulatorBytecode::kTrap;
|
||||
}
|
||||
|
||||
DART_FORCE_INLINE static bool IsCallOpcode(Instr instr) {
|
||||
switch (DecodeOpcode(instr)) {
|
||||
case Bytecode::kStaticCall:
|
||||
case Bytecode::kIndirectStaticCall:
|
||||
case Bytecode::kInstanceCall1:
|
||||
case Bytecode::kInstanceCall2:
|
||||
case Bytecode::kInstanceCall1Opt:
|
||||
case Bytecode::kInstanceCall2Opt:
|
||||
case Bytecode::kDebugBreak:
|
||||
case SimulatorBytecode::kStaticCall:
|
||||
case SimulatorBytecode::kIndirectStaticCall:
|
||||
case SimulatorBytecode::kInstanceCall1:
|
||||
case SimulatorBytecode::kInstanceCall2:
|
||||
case SimulatorBytecode::kInstanceCall1Opt:
|
||||
case SimulatorBytecode::kInstanceCall2Opt:
|
||||
case SimulatorBytecode::kDebugBreak:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -1036,14 +1036,14 @@ class Bytecode {
|
|||
|
||||
DART_FORCE_INLINE static bool IsFastSmiOpcode(Instr instr) {
|
||||
switch (DecodeOpcode(instr)) {
|
||||
case Bytecode::kAddTOS:
|
||||
case Bytecode::kSubTOS:
|
||||
case Bytecode::kMulTOS:
|
||||
case Bytecode::kBitOrTOS:
|
||||
case Bytecode::kBitAndTOS:
|
||||
case Bytecode::kEqualTOS:
|
||||
case Bytecode::kLessThanTOS:
|
||||
case Bytecode::kGreaterThanTOS:
|
||||
case SimulatorBytecode::kAddTOS:
|
||||
case SimulatorBytecode::kSubTOS:
|
||||
case SimulatorBytecode::kMulTOS:
|
||||
case SimulatorBytecode::kBitOrTOS:
|
||||
case SimulatorBytecode::kBitAndTOS:
|
||||
case SimulatorBytecode::kEqualTOS:
|
||||
case SimulatorBytecode::kLessThanTOS:
|
||||
case SimulatorBytecode::kGreaterThanTOS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -1060,7 +1060,7 @@ class Bytecode {
|
|||
|
||||
private:
|
||||
DISALLOW_ALLOCATION();
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecode);
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(SimulatorBytecode);
|
||||
};
|
||||
|
||||
// Various dummy declarations to make shared code compile.
|
||||
|
|
|
@ -1597,8 +1597,8 @@ CodeBreakpoint::CodeBreakpoint(const Code& code,
|
|||
#if !defined(TARGET_ARCH_DBC)
|
||||
saved_value_(Code::null())
|
||||
#else
|
||||
saved_value_(Bytecode::kTrap),
|
||||
saved_value_fastsmi_(Bytecode::kTrap)
|
||||
saved_value_(SimulatorBytecode::kTrap),
|
||||
saved_value_fastsmi_(SimulatorBytecode::kTrap)
|
||||
#endif
|
||||
{
|
||||
ASSERT(!code.IsNull());
|
||||
|
|
|
@ -40,13 +40,14 @@ void CodeBreakpoint::PatchCode() {
|
|||
// DebugBreak has an A operand matching the call it replaces.
|
||||
// This ensures that Return instructions continue to work - as they
|
||||
// look at calls to figure out how many arguments to drop.
|
||||
*CallInstructionFromReturnAddress(pc_) = Bytecode::Encode(
|
||||
Bytecode::kDebugBreak, Bytecode::DecodeArgc(saved_value_), 0, 0);
|
||||
*CallInstructionFromReturnAddress(pc_) = SimulatorBytecode::Encode(
|
||||
SimulatorBytecode::kDebugBreak,
|
||||
SimulatorBytecode::DecodeArgc(saved_value_), 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case RawPcDescriptors::kRuntimeCall: {
|
||||
*CallInstructionFromReturnAddress(pc_) = Bytecode::kDebugBreak;
|
||||
*CallInstructionFromReturnAddress(pc_) = SimulatorBytecode::kDebugBreak;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -56,13 +57,15 @@ void CodeBreakpoint::PatchCode() {
|
|||
|
||||
// If this call is the fall-through for a fast Smi op, also disable the fast
|
||||
// Smi op.
|
||||
if ((Bytecode::DecodeOpcode(saved_value_) == Bytecode::kInstanceCall2) &&
|
||||
Bytecode::IsFastSmiOpcode(*FastSmiInstructionFromReturnAddress(pc_))) {
|
||||
if ((SimulatorBytecode::DecodeOpcode(saved_value_) ==
|
||||
SimulatorBytecode::kInstanceCall2) &&
|
||||
SimulatorBytecode::IsFastSmiOpcode(
|
||||
*FastSmiInstructionFromReturnAddress(pc_))) {
|
||||
saved_value_fastsmi_ = *FastSmiInstructionFromReturnAddress(pc_);
|
||||
*FastSmiInstructionFromReturnAddress(pc_) =
|
||||
Bytecode::Encode(Bytecode::kNop, 0, 0, 0);
|
||||
SimulatorBytecode::Encode(SimulatorBytecode::kNop, 0, 0, 0);
|
||||
} else {
|
||||
saved_value_fastsmi_ = Bytecode::kTrap;
|
||||
saved_value_fastsmi_ = SimulatorBytecode::kTrap;
|
||||
}
|
||||
}
|
||||
is_enabled_ = true;
|
||||
|
@ -85,9 +88,10 @@ void CodeBreakpoint::RestoreCode() {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
if (saved_value_fastsmi_ != Bytecode::kTrap) {
|
||||
if (saved_value_fastsmi_ != SimulatorBytecode::kTrap) {
|
||||
Instr current_instr = *FastSmiInstructionFromReturnAddress(pc_);
|
||||
ASSERT(Bytecode::DecodeOpcode(current_instr) == Bytecode::kNop);
|
||||
ASSERT(SimulatorBytecode::DecodeOpcode(current_instr) ==
|
||||
SimulatorBytecode::kNop);
|
||||
*FastSmiInstructionFromReturnAddress(pc_) = saved_value_fastsmi_;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,21 +16,21 @@
|
|||
namespace dart {
|
||||
|
||||
static bool HasLoadFromPool(Instr instr) {
|
||||
switch (Bytecode::DecodeOpcode(instr)) {
|
||||
case Bytecode::kLoadConstant:
|
||||
case Bytecode::kPushConstant:
|
||||
case Bytecode::kStaticCall:
|
||||
case Bytecode::kIndirectStaticCall:
|
||||
case Bytecode::kInstanceCall1:
|
||||
case Bytecode::kInstanceCall2:
|
||||
case Bytecode::kInstanceCall1Opt:
|
||||
case Bytecode::kInstanceCall2Opt:
|
||||
case Bytecode::kStoreStaticTOS:
|
||||
case Bytecode::kPushStatic:
|
||||
case Bytecode::kAllocate:
|
||||
case Bytecode::kInstantiateType:
|
||||
case Bytecode::kInstantiateTypeArgumentsTOS:
|
||||
case Bytecode::kAssertAssignable:
|
||||
switch (SimulatorBytecode::DecodeOpcode(instr)) {
|
||||
case SimulatorBytecode::kLoadConstant:
|
||||
case SimulatorBytecode::kPushConstant:
|
||||
case SimulatorBytecode::kStaticCall:
|
||||
case SimulatorBytecode::kIndirectStaticCall:
|
||||
case SimulatorBytecode::kInstanceCall1:
|
||||
case SimulatorBytecode::kInstanceCall2:
|
||||
case SimulatorBytecode::kInstanceCall1Opt:
|
||||
case SimulatorBytecode::kInstanceCall2Opt:
|
||||
case SimulatorBytecode::kStoreStaticTOS:
|
||||
case SimulatorBytecode::kPushStatic:
|
||||
case SimulatorBytecode::kAllocate:
|
||||
case SimulatorBytecode::kInstantiateType:
|
||||
case SimulatorBytecode::kInstantiateTypeArgumentsTOS:
|
||||
case SimulatorBytecode::kAssertAssignable:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -40,9 +40,9 @@ static bool HasLoadFromPool(Instr instr) {
|
|||
static bool GetLoadedObjectAt(uword pc,
|
||||
const ObjectPool& object_pool,
|
||||
Object* obj) {
|
||||
Instr instr = Bytecode::At(pc);
|
||||
Instr instr = SimulatorBytecode::At(pc);
|
||||
if (HasLoadFromPool(instr)) {
|
||||
uint16_t index = Bytecode::DecodeD(instr);
|
||||
uint16_t index = SimulatorBytecode::DecodeD(instr);
|
||||
if (object_pool.TypeAt(index) == ObjectPool::kTaggedObject) {
|
||||
*obj = object_pool.ObjectAt(index);
|
||||
return true;
|
||||
|
@ -59,10 +59,10 @@ CallPattern::CallPattern(uword pc, const Code& code)
|
|||
ic_data_(ICData::Handle()) {
|
||||
ASSERT(code.ContainsInstructionAt(end_));
|
||||
const uword call_pc = end_ - sizeof(Instr);
|
||||
Instr call_instr = Bytecode::At(call_pc);
|
||||
ASSERT(Bytecode::IsCallOpcode(call_instr));
|
||||
Instr call_instr = SimulatorBytecode::At(call_pc);
|
||||
ASSERT(SimulatorBytecode::IsCallOpcode(call_instr));
|
||||
ic_data_load_end_ = call_pc;
|
||||
target_code_pool_index_ = Bytecode::DecodeD(call_instr);
|
||||
target_code_pool_index_ = SimulatorBytecode::DecodeD(call_instr);
|
||||
}
|
||||
|
||||
NativeCallPattern::NativeCallPattern(uword pc, const Code& code)
|
||||
|
@ -72,10 +72,11 @@ NativeCallPattern::NativeCallPattern(uword pc, const Code& code)
|
|||
trampoline_pool_index_(-1) {
|
||||
ASSERT(code.ContainsInstructionAt(end_));
|
||||
const uword call_pc = end_ - sizeof(Instr);
|
||||
Instr call_instr = Bytecode::At(call_pc);
|
||||
ASSERT(Bytecode::DecodeOpcode(call_instr) == Bytecode::kNativeCall);
|
||||
native_function_pool_index_ = Bytecode::DecodeB(call_instr);
|
||||
trampoline_pool_index_ = Bytecode::DecodeA(call_instr);
|
||||
Instr call_instr = SimulatorBytecode::At(call_pc);
|
||||
ASSERT(SimulatorBytecode::DecodeOpcode(call_instr) ==
|
||||
SimulatorBytecode::kNativeCall);
|
||||
native_function_pool_index_ = SimulatorBytecode::DecodeB(call_instr);
|
||||
trampoline_pool_index_ = SimulatorBytecode::DecodeA(call_instr);
|
||||
}
|
||||
|
||||
NativeFunctionWrapper NativeCallPattern::target() const {
|
||||
|
@ -160,10 +161,12 @@ void CallPattern::SetTargetCode(const Code& target_code) const {
|
|||
}
|
||||
|
||||
void CallPattern::InsertDeoptCallAt(uword pc) {
|
||||
const uint8_t argc = Bytecode::IsCallOpcode(Bytecode::At(pc))
|
||||
? Bytecode::DecodeArgc(Bytecode::At(pc))
|
||||
: 0;
|
||||
*reinterpret_cast<Instr*>(pc) = Bytecode::Encode(Bytecode::kDeopt, argc, 0);
|
||||
const uint8_t argc =
|
||||
SimulatorBytecode::IsCallOpcode(SimulatorBytecode::At(pc))
|
||||
? SimulatorBytecode::DecodeArgc(SimulatorBytecode::At(pc))
|
||||
: 0;
|
||||
*reinterpret_cast<Instr*>(pc) =
|
||||
SimulatorBytecode::Encode(SimulatorBytecode::kDeopt, argc, 0);
|
||||
}
|
||||
|
||||
SwitchableCallPattern::SwitchableCallPattern(uword pc, const Code& code)
|
||||
|
|
|
@ -1023,8 +1023,8 @@ DART_NOINLINE static bool InvokeNative(Thread* thread,
|
|||
USE(rB); \
|
||||
USE(rC)
|
||||
#define DECODE_A_B_C \
|
||||
rB = ((op >> Bytecode::kBShift) & Bytecode::kBMask); \
|
||||
rC = ((op >> Bytecode::kCShift) & Bytecode::kCMask);
|
||||
rB = ((op >> SimulatorBytecode::kBShift) & SimulatorBytecode::kBMask); \
|
||||
rC = ((op >> SimulatorBytecode::kCShift) & SimulatorBytecode::kCMask);
|
||||
|
||||
#define DECLARE_A_B_Y \
|
||||
uint16_t rB; \
|
||||
|
@ -1032,8 +1032,8 @@ DART_NOINLINE static bool InvokeNative(Thread* thread,
|
|||
USE(rB); \
|
||||
USE(rY)
|
||||
#define DECODE_A_B_Y \
|
||||
rB = ((op >> Bytecode::kBShift) & Bytecode::kBMask); \
|
||||
rY = ((op >> Bytecode::kYShift) & Bytecode::kYMask);
|
||||
rB = ((op >> SimulatorBytecode::kBShift) & SimulatorBytecode::kBMask); \
|
||||
rY = ((op >> SimulatorBytecode::kYShift) & SimulatorBytecode::kYMask);
|
||||
|
||||
#define DECLARE_0
|
||||
#define DECODE_0
|
||||
|
@ -1044,7 +1044,7 @@ DART_NOINLINE static bool InvokeNative(Thread* thread,
|
|||
#define DECLARE___D \
|
||||
uint32_t rD; \
|
||||
USE(rD)
|
||||
#define DECODE___D rD = (op >> Bytecode::kDShift);
|
||||
#define DECODE___D rD = (op >> SimulatorBytecode::kDShift);
|
||||
|
||||
#define DECLARE_A_D DECLARE___D
|
||||
#define DECODE_A_D DECODE___D
|
||||
|
@ -1052,12 +1052,13 @@ DART_NOINLINE static bool InvokeNative(Thread* thread,
|
|||
#define DECLARE_A_X \
|
||||
int32_t rD; \
|
||||
USE(rD)
|
||||
#define DECODE_A_X rD = (static_cast<int32_t>(op) >> Bytecode::kDShift);
|
||||
#define DECODE_A_X \
|
||||
rD = (static_cast<int32_t>(op) >> SimulatorBytecode::kDShift);
|
||||
|
||||
#define SMI_FASTPATH_ICDATA_INC \
|
||||
do { \
|
||||
ASSERT(Bytecode::IsCallOpcode(*pc)); \
|
||||
const uint16_t kidx = Bytecode::DecodeD(*pc); \
|
||||
ASSERT(SimulatorBytecode::IsCallOpcode(*pc)); \
|
||||
const uint16_t kidx = SimulatorBytecode::DecodeD(*pc); \
|
||||
const RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx)); \
|
||||
RawObject** entries = icdata->ptr()->ic_data_->ptr()->data(); \
|
||||
SimulatorHelpers::IncrementICUsageCount(entries, 0, 2); \
|
||||
|
@ -1766,10 +1767,10 @@ RawObject* Simulator::Call(const Code& code,
|
|||
RawObject** args = SP - argc + 1;
|
||||
const intptr_t receiver_cid = SimulatorHelpers::GetClassId(args[0]);
|
||||
for (intptr_t i = 0; i < 2 * cids_length; i += 2) {
|
||||
const intptr_t icdata_cid = Bytecode::DecodeD(*(pc + i));
|
||||
const intptr_t icdata_cid = SimulatorBytecode::DecodeD(*(pc + i));
|
||||
if (receiver_cid == icdata_cid) {
|
||||
RawFunction* target =
|
||||
RAW_CAST(Function, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + i + 1))));
|
||||
RawFunction* target = RAW_CAST(
|
||||
Function, LOAD_CONSTANT(SimulatorBytecode::DecodeD(*(pc + i + 1))));
|
||||
*++SP = target;
|
||||
pc++;
|
||||
break;
|
||||
|
@ -1787,11 +1788,11 @@ RawObject* Simulator::Call(const Code& code,
|
|||
const intptr_t receiver_cid = SimulatorHelpers::GetClassId(args[0]);
|
||||
for (intptr_t i = 0; i < 3 * cids_length; i += 3) {
|
||||
// Note unsigned types to get an unsigned range compare.
|
||||
const uintptr_t cid_start = Bytecode::DecodeD(*(pc + i));
|
||||
const uintptr_t cids = Bytecode::DecodeD(*(pc + i + 1));
|
||||
const uintptr_t cid_start = SimulatorBytecode::DecodeD(*(pc + i));
|
||||
const uintptr_t cids = SimulatorBytecode::DecodeD(*(pc + i + 1));
|
||||
if (receiver_cid - cid_start < cids) {
|
||||
RawFunction* target =
|
||||
RAW_CAST(Function, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + i + 2))));
|
||||
RawFunction* target = RAW_CAST(
|
||||
Function, LOAD_CONSTANT(SimulatorBytecode::DecodeD(*(pc + i + 2))));
|
||||
*++SP = target;
|
||||
pc++;
|
||||
break;
|
||||
|
@ -2616,7 +2617,7 @@ RawObject* Simulator::Call(const Code& code,
|
|||
}
|
||||
|
||||
// Look at the caller to determine how many arguments to pop.
|
||||
const uint8_t argc = Bytecode::DecodeArgc(pc[-1]);
|
||||
const uint8_t argc = SimulatorBytecode::DecodeArgc(pc[-1]);
|
||||
|
||||
// Restore SP, FP and PP. Push result and dispatch.
|
||||
SP = FrameArguments(FP, argc);
|
||||
|
@ -2659,7 +2660,7 @@ RawObject* Simulator::Call(const Code& code,
|
|||
{
|
||||
BYTECODE(StoreFieldExt, A_D);
|
||||
// The offset is stored in the following nop-instruction which is skipped.
|
||||
const uint16_t offset_in_words = Bytecode::DecodeD(*pc++);
|
||||
const uint16_t offset_in_words = SimulatorBytecode::DecodeD(*pc++);
|
||||
RawInstance* instance = reinterpret_cast<RawInstance*>(FP[rA]);
|
||||
RawObject* value = FP[rD];
|
||||
|
||||
|
@ -2694,7 +2695,7 @@ RawObject* Simulator::Call(const Code& code,
|
|||
{
|
||||
BYTECODE(LoadFieldExt, A_D);
|
||||
// The offset is stored in the following nop-instruction which is skipped.
|
||||
const uint16_t offset_in_words = Bytecode::DecodeD(*pc++);
|
||||
const uint16_t offset_in_words = SimulatorBytecode::DecodeD(*pc++);
|
||||
const uint16_t instance_reg = rD;
|
||||
RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]);
|
||||
FP[rA] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words];
|
||||
|
@ -2820,7 +2821,7 @@ RawObject* Simulator::Call(const Code& code,
|
|||
thread->heap()->new_space()->TryAllocateInTLAB(thread, instance_size);
|
||||
if (LIKELY(start != 0)) {
|
||||
RawObject* type_args = SP[0];
|
||||
const intptr_t type_args_offset = Bytecode::DecodeD(*pc);
|
||||
const intptr_t type_args_offset = SimulatorBytecode::DecodeD(*pc);
|
||||
// Writes both the tags and the initial identity hash on 64 bit platforms.
|
||||
tags = RawObject::NewBit::update(true, tags);
|
||||
*reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
|
||||
|
@ -3163,9 +3164,9 @@ RawObject* Simulator::Call(const Code& code,
|
|||
const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
|
||||
const intptr_t num_cases = rD;
|
||||
for (intptr_t i = 0; i < num_cases; i++) {
|
||||
ASSERT(Bytecode::DecodeOpcode(pc[i]) == Bytecode::kNop);
|
||||
intptr_t test_target = Bytecode::DecodeA(pc[i]);
|
||||
intptr_t test_cid = Bytecode::DecodeD(pc[i]);
|
||||
ASSERT(SimulatorBytecode::DecodeOpcode(pc[i]) == SimulatorBytecode::kNop);
|
||||
intptr_t test_target = SimulatorBytecode::DecodeA(pc[i]);
|
||||
intptr_t test_cid = SimulatorBytecode::DecodeD(pc[i]);
|
||||
if (cid == test_cid) {
|
||||
if (test_target != 0) {
|
||||
pc += 1; // Match true.
|
||||
|
@ -3213,7 +3214,7 @@ RawObject* Simulator::Call(const Code& code,
|
|||
const intptr_t actual_cid =
|
||||
reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
|
||||
const uintptr_t cid_start = rD;
|
||||
const uintptr_t cid_range = Bytecode::DecodeD(*pc);
|
||||
const uintptr_t cid_range = SimulatorBytecode::DecodeD(*pc);
|
||||
// Unsigned comparison. Skip either just the nop or both the nop and the
|
||||
// following instruction.
|
||||
pc += (actual_cid - cid_start <= cid_range) ? 2 : 1;
|
||||
|
@ -3224,9 +3225,9 @@ RawObject* Simulator::Call(const Code& code,
|
|||
BYTECODE(CheckBitTest, A_D);
|
||||
const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
|
||||
const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
|
||||
const intptr_t cid_min = Bytecode::DecodeD(*pc);
|
||||
const intptr_t cid_mask =
|
||||
Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + 1)))));
|
||||
const intptr_t cid_min = SimulatorBytecode::DecodeD(*pc);
|
||||
const intptr_t cid_mask = Smi::Value(
|
||||
RAW_CAST(Smi, LOAD_CONSTANT(SimulatorBytecode::DecodeD(*(pc + 1)))));
|
||||
if (LIKELY(!is_smi)) {
|
||||
const intptr_t cid_max = Utils::HighestBit(cid_mask) + cid_min;
|
||||
const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
|
||||
|
@ -3253,7 +3254,7 @@ RawObject* Simulator::Call(const Code& code,
|
|||
if (LIKELY(!is_smi)) {
|
||||
const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
|
||||
for (intptr_t i = 0; i < cids_length; i++) {
|
||||
const intptr_t desired_cid = Bytecode::DecodeD(*(pc + i));
|
||||
const intptr_t desired_cid = SimulatorBytecode::DecodeD(*(pc + i));
|
||||
if (cid == desired_cid) {
|
||||
pc++;
|
||||
break;
|
||||
|
@ -3277,8 +3278,8 @@ RawObject* Simulator::Call(const Code& code,
|
|||
const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
|
||||
for (intptr_t i = 0; i < cids_length; i += 2) {
|
||||
// Note unsigned type to get unsigned range check below.
|
||||
const uintptr_t cid_start = Bytecode::DecodeD(*(pc + i));
|
||||
const uintptr_t cids = Bytecode::DecodeD(*(pc + i + 1));
|
||||
const uintptr_t cid_start = SimulatorBytecode::DecodeD(*(pc + i));
|
||||
const uintptr_t cids = SimulatorBytecode::DecodeD(*(pc + i + 1));
|
||||
if (cid - cid_start < cids) {
|
||||
pc++;
|
||||
break;
|
||||
|
@ -3890,8 +3891,9 @@ RawObject* Simulator::Call(const Code& code,
|
|||
pc = SavedCallerPC(FP);
|
||||
|
||||
const bool has_dart_caller = (reinterpret_cast<uword>(pc) & 2) == 0;
|
||||
const intptr_t argc = has_dart_caller ? Bytecode::DecodeArgc(pc[-1])
|
||||
: (reinterpret_cast<uword>(pc) >> 2);
|
||||
const intptr_t argc = has_dart_caller
|
||||
? SimulatorBytecode::DecodeArgc(pc[-1])
|
||||
: (reinterpret_cast<uword>(pc) >> 2);
|
||||
const bool has_function_type_args =
|
||||
has_dart_caller && SimulatorHelpers::ArgDescTypeArgsLen(argdesc_) > 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue