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"
|
|
|
|
|
|
|
|
#include "src/interpreter/bytecode-array-builder.h"
|
|
|
|
#include "src/interpreter/bytecode-array-iterator.h"
|
2017-01-09 13:43:28 +00:00
|
|
|
#include "src/objects-inl.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:
|
|
|
|
BytecodeArrayIteratorTest() {}
|
|
|
|
~BytecodeArrayIteratorTest() override {}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
|
|
|
|
// Use a builder to create an array with containing multiple bytecodes
|
|
|
|
// with 0, 1 and 2 operands.
|
2016-04-01 12:08:53 +00:00
|
|
|
BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, 0);
|
2017-02-10 17:22:45 +00:00
|
|
|
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
|
|
|
|
isolate()->heap()->HashSeed());
|
|
|
|
const AstValue* heap_num_0 = ast_factory.NewNumber(2.718);
|
|
|
|
const AstValue* heap_num_1 = ast_factory.NewNumber(2.0 * Smi::kMaxValue);
|
2016-10-07 13:05:07 +00:00
|
|
|
Smi* zero = Smi::kZero;
|
2015-09-10 16:21:34 +00:00
|
|
|
Smi* smi_0 = Smi::FromInt(64);
|
|
|
|
Smi* smi_1 = Smi::FromInt(-65536);
|
|
|
|
Register reg_0(0);
|
|
|
|
Register reg_1(1);
|
2016-10-05 16:44:38 +00:00
|
|
|
RegisterList pair(0, 2);
|
|
|
|
RegisterList triple(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;
|
|
|
|
uint32_t feedback_slot = 97;
|
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)
|
2016-02-17 10:30:10 +00:00
|
|
|
.LoadNamedProperty(reg_1, name, 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)
|
|
|
|
.ForInPrepare(reg_0, triple)
|
2016-09-30 09:02:59 +00:00
|
|
|
.CallRuntime(Runtime::kLoadIC_Miss, reg_0)
|
2016-02-04 15:06:25 +00:00
|
|
|
.Debugger()
|
2016-11-16 18:17:22 +00:00
|
|
|
.LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
|
2015-09-10 16:21:34 +00:00
|
|
|
.Return();
|
|
|
|
|
|
|
|
// Test iterator sees the expected output from the builder.
|
2017-02-10 17:22:45 +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;
|
|
|
|
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2017-02-10 17:22:45 +00:00
|
|
|
CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(
|
|
|
|
heap_num_0->value()));
|
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();
|
|
|
|
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2017-02-10 17:22:45 +00:00
|
|
|
CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(
|
|
|
|
heap_num_1->value()));
|
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();
|
|
|
|
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaZero);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_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();
|
|
|
|
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2015-10-01 17:22:58 +00:00
|
|
|
CHECK_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();
|
|
|
|
|
2016-07-05 13:44:05 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStackCheck);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(Bytecodes::NumberOfOperands(iterator.current_bytecode()), 0);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStackCheck, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple);
|
|
|
|
CHECK_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();
|
|
|
|
|
2016-07-05 13:44:05 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStackCheck);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(Bytecodes::NumberOfOperands(iterator.current_bytecode()), 0);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStackCheck, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
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();
|
|
|
|
|
2016-05-27 15:57:35 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
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();
|
|
|
|
|
2016-05-12 19:18:07 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
2016-05-25 10:45:14 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaNamedProperty);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
|
2015-10-22 14:55:32 +00:00
|
|
|
CHECK_EQ(iterator.GetIndexOperand(1), name_index);
|
|
|
|
CHECK_EQ(iterator.GetIndexOperand(2), 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();
|
|
|
|
|
2016-05-25 09:55:26 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
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();
|
|
|
|
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), param.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntimeForPair);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadLookupSlotForCall);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(1).index(), param.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(1), 1);
|
2016-11-11 12:12:31 +00:00
|
|
|
CHECK_EQ(iterator.GetRegisterCountOperand(2), 1u);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(3).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(3), 2);
|
|
|
|
CHECK(!iterator.done());
|
|
|
|
offset +=
|
|
|
|
Bytecodes::Size(Bytecode::kCallRuntimeForPair, OperandScale::kSingle);
|
|
|
|
iterator.Advance();
|
|
|
|
|
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kForInPrepare);
|
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
|
2016-07-29 11:14:55 +00:00
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index());
|
|
|
|
CHECK_EQ(iterator.GetRegisterOperandRange(1), 3);
|
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();
|
|
|
|
|
2015-10-02 18:13:41 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
|
2016-06-21 14:37:16 +00:00
|
|
|
CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadIC_Miss);
|
2015-10-02 18:13:41 +00:00
|
|
|
CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index());
|
2016-11-11 12:12:31 +00:00
|
|
|
CHECK_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();
|
|
|
|
|
2016-02-04 15:06:25 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kDebugger);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_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();
|
|
|
|
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaGlobal);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple);
|
2016-11-16 18:17:22 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode_size(), 10);
|
|
|
|
CHECK_EQ(iterator.GetIndexOperand(1), 0x10000000u);
|
2016-04-01 12:08:53 +00:00
|
|
|
offset += Bytecodes::Size(Bytecode::kLdaGlobal, OperandScale::kQuadruple) +
|
|
|
|
kPrefixByteSize;
|
2016-03-21 17:08:21 +00:00
|
|
|
iterator.Advance();
|
|
|
|
|
2015-09-10 16:21:34 +00:00
|
|
|
CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
|
2016-04-01 12:08:53 +00:00
|
|
|
CHECK_EQ(iterator.current_offset(), offset);
|
2016-03-21 17:08:21 +00:00
|
|
|
CHECK_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
|