2015-09-10 16:21:34 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "src/v8.h"
|
|
|
|
|
2019-02-14 21:10:30 +00:00
|
|
|
#include "src/hash-seed-inl.h"
|
2015-09-10 16:21:34 +00:00
|
|
|
#include "src/interpreter/bytecode-array-builder.h"
|
|
|
|
#include "src/interpreter/bytecode-array-iterator.h"
|
2019-05-23 08:51:46 +00:00
|
|
|
#include "src/objects/objects-inl.h"
|
2018-11-03 00:13:22 +00:00
|
|
|
#include "src/objects/smi.h"
|
2017-12-13 12:19:44 +00:00
|
|
|
#include "test/unittests/interpreter/bytecode-utils.h"
|
2015-09-10 16:21:34 +00:00
|
|
|
#include "test/unittests/test-utils.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
namespace interpreter {
|
|
|
|
|
|
|
|
class BytecodeArrayIteratorTest : public TestWithIsolateAndZone {
|
|
|
|
public:
|
2018-09-13 09:22:50 +00:00
|
|
|
BytecodeArrayIteratorTest() = default;
|
|
|
|
~BytecodeArrayIteratorTest() override = default;
|
2015-09-10 16:21:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
|
|
|
|
// Use a builder to create an array with containing multiple bytecodes
|
|
|
|
// with 0, 1 and 2 operands.
|
2017-10-19 15:12:42 +00:00
|
|
|
FeedbackVectorSpec feedback_spec(zone());
|
2017-11-15 14:36:57 +00:00
|
|
|
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
|
2017-02-10 17:22:45 +00:00
|
|
|
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
|
2019-02-14 21:10:30 +00:00
|
|
|
HashSeed(isolate()));
|
2017-10-27 19:53:15 +00:00
|
|
|
double heap_num_0 = 2.718;
|
|
|
|
double heap_num_1 = 2.0 * Smi::kMaxValue;
|
2018-11-03 00:13:22 +00:00
|
|
|
Smi zero = Smi::zero();
|
|
|
|
Smi smi_0 = Smi::FromInt(64);
|
|
|
|
Smi smi_1 = Smi::FromInt(-65536);
|
2015-09-10 16:21:34 +00:00
|
|
|
Register reg_0(0);
|
|
|
|
Register reg_1(1);
|
2017-12-13 12:19:44 +00:00
|
|
|
RegisterList pair = BytecodeUtils::NewRegisterList(0, 2);
|
|
|
|
RegisterList triple = BytecodeUtils::NewRegisterList(0, 3);
|
2016-04-01 12:08:53 +00:00
|
|
|
Register param = Register::FromParameterIndex(2, builder.parameter_count());
|
2017-02-10 17:22:45 +00:00
|
|
|
const AstRawString* name = ast_factory.GetOneByteString("abc");
|
2016-11-10 11:25:17 +00:00
|
|
|
uint32_t name_index = 2;
|
2017-10-19 15:12:42 +00:00
|
|
|
uint32_t load_feedback_slot = feedback_spec.AddLoadICSlot().ToInt();
|
|
|
|
uint32_t forin_feedback_slot = feedback_spec.AddForInSlot().ToInt();
|
|
|
|
uint32_t load_global_feedback_slot =
|
|
|
|
feedback_spec.AddLoadGlobalICSlot(TypeofMode::NOT_INSIDE_TYPEOF).ToInt();
|
2015-09-10 16:21:34 +00:00
|
|
|
|
|
|
|
builder.LoadLiteral(heap_num_0)
|
2016-05-12 19:18:07 +00:00
|
|
|
.StoreAccumulatorInRegister(reg_0)
|
2015-09-10 16:21:34 +00:00
|
|
|
.LoadLiteral(heap_num_1)
|
2016-05-12 19:18:07 +00:00
|
|
|
.StoreAccumulatorInRegister(reg_0)
|
2015-09-10 16:21:34 +00:00
|
|
|
.LoadLiteral(zero)
|
2016-05-12 19:18:07 +00:00
|
|
|
.StoreAccumulatorInRegister(reg_0)
|
2015-09-10 16:21:34 +00:00
|
|
|
.LoadLiteral(smi_0)
|
2016-07-05 13:44:05 +00:00
|
|
|
.StackCheck(0)
|
2016-05-12 19:18:07 +00:00
|
|
|
.StoreAccumulatorInRegister(reg_0)
|
2015-09-10 16:21:34 +00:00
|
|
|
.LoadLiteral(smi_1)
|
2016-07-05 13:44:05 +00:00
|
|
|
.StackCheck(1)
|
2016-05-12 19:18:07 +00:00
|
|
|
.StoreAccumulatorInRegister(reg_1)
|
2015-09-10 16:21:34 +00:00
|
|
|
.LoadAccumulatorWithRegister(reg_0)
|
2016-08-08 01:15:22 +00:00
|
|
|
.BinaryOperation(Token::Value::ADD, reg_0, 2)
|
2016-05-12 19:18:07 +00:00
|
|
|
.StoreAccumulatorInRegister(reg_1)
|
2017-10-19 15:12:42 +00:00
|
|
|
.LoadNamedProperty(reg_1, name, load_feedback_slot)
|
2016-08-08 01:15:22 +00:00
|
|
|
.BinaryOperation(Token::Value::ADD, reg_0, 3)
|
2016-04-01 12:08:53 +00:00
|
|
|
.StoreAccumulatorInRegister(param)
|
2016-10-05 16:44:38 +00:00
|
|
|
.CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, pair)
|
2017-10-19 15:12:42 +00:00
|
|
|
.ForInPrepare(triple, forin_feedback_slot)
|
2016-09-30 09:02:59 +00:00
|
|
|
.CallRuntime(Runtime::kLoadIC_Miss, reg_0)
|
2016-02-04 15:06:25 +00:00
|
|
|
.Debugger()
|
2017-10-19 15:12:42 +00:00
|
|
|
.LoadGlobal(name, load_global_feedback_slot,
|
|
|
|
TypeofMode::NOT_INSIDE_TYPEOF)
|
2015-09-10 16:21:34 +00:00
|
|
|
.Return();
|
|
|
|
|
|
|
|
// Test iterator sees the expected output from the builder.
|
2018-05-02 15:30:06 +00:00
|
|
|
ast_factory.Internalize(isolate());
|
2016-08-18 13:42:05 +00:00
|
|
|
BytecodeArrayIterator iterator(builder.ToBytecodeArray(isolate()));
|
2016-04-01 12:08:53 +00:00
|
|
|
const int kPrefixByteSize = 1;
|
|
|
|
int offset = 0;
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2017-10-27 19:53:15 +00:00
|
|
|
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_0);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2017-10-27 19:53:15 +00:00
|
|
|
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_1);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaZero);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaZero, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(Smi::FromInt(iterator.GetImmediateOperand(0)), smi_0);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaSmi, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStackCheck);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(Bytecodes::NumberOfOperands(iterator.current_bytecode()), 0);
|
2016-07-05 13:44:05 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStackCheck, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple);
|
|
|
|
EXPECT_EQ(Smi::FromInt(iterator.GetImmediateOperand(0)), smi_1);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaSmi, OperandScale::kQuadruple) +
|
|
|
|
kPrefixByteSize;
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStackCheck);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(Bytecodes::NumberOfOperands(iterator.current_bytecode()), 0);
|
2016-07-05 13:44:05 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStackCheck, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kAdd);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-27 15:57:35 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-08-08 01:15:22 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kAdd, OperandScale::kSingle);
|
2016-05-27 15:57:35 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaNamedProperty);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
|
|
|
|
EXPECT_EQ(iterator.GetIndexOperand(1), name_index);
|
2017-10-19 15:12:42 +00:00
|
|
|
EXPECT_EQ(iterator.GetIndexOperand(2), load_feedback_slot);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-05-25 10:45:14 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaNamedProperty, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kAdd);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-05-25 09:55:26 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-08-08 01:15:22 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kAdd, OperandScale::kSingle);
|
2016-05-25 09:55:26 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), param.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 1);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kCallRuntimeForPair);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadLookupSlotForCall);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(1).index(), param.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(1), 1);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterCountOperand(2), 1u);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(3).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(3), 2);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset +=
|
|
|
|
Bytecodes::Size(Bytecode::kCallRuntimeForPair, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kForInPrepare);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperandRange(0), 3);
|
2017-10-19 15:12:42 +00:00
|
|
|
EXPECT_EQ(iterator.GetIndexOperand(1), forin_feedback_slot);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kForInPrepare, OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadIC_Miss);
|
|
|
|
EXPECT_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index());
|
|
|
|
EXPECT_EQ(iterator.GetRegisterCountOperand(2), 1u);
|
2015-10-02 18:13:41 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kCallRuntime, OperandScale::kSingle);
|
2015-10-02 18:13:41 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kDebugger);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2016-02-04 15:06:25 +00:00
|
|
|
CHECK(!iterator.done());
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kDebugger, OperandScale::kSingle);
|
2016-02-04 15:06:25 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaGlobal);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
2017-10-19 15:12:42 +00:00
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
EXPECT_EQ(iterator.current_bytecode_size(), 3);
|
|
|
|
EXPECT_EQ(iterator.GetIndexOperand(1), load_global_feedback_slot);
|
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaGlobal, OperandScale::kSingle);
|
2016-03-21 17:08:21 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2017-09-01 10:49:06 +00:00
|
|
|
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kReturn);
|
|
|
|
EXPECT_EQ(iterator.current_offset(), offset);
|
|
|
|
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK(!iterator.done());
|
|
|
|
iterator.Advance();
|
|
|
|
CHECK(iterator.done());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace interpreter
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|