Commit 7d4b5893 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

Handlify bytecode array accessor's constant getters.

This in in preparation for generic (off-heap/on-heap) bytecode
array accessor.

Bug: v8:7790
Change-Id: Ib419831ba1db95ab938179723ef5f130f01ae0d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1635895
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62222}
parent b9591a58
......@@ -1333,7 +1333,7 @@ void BytecodeGraphBuilder::VisitLdaSmi() {
void BytecodeGraphBuilder::VisitLdaConstant() {
Node* node = jsgraph()->Constant(
handle(bytecode_iterator().GetConstantForIndexOperand(0), isolate()));
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
environment()->BindAccumulator(node);
}
......@@ -1390,8 +1390,8 @@ Node* BytecodeGraphBuilder::BuildLoadGlobal(Handle<Name> name,
void BytecodeGraphBuilder::VisitLdaGlobal() {
PrepareEagerCheckpoint();
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(0)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
Node* node =
BuildLoadGlobal(name, feedback_slot_index, TypeofMode::NOT_INSIDE_TYPEOF);
......@@ -1400,8 +1400,8 @@ void BytecodeGraphBuilder::VisitLdaGlobal() {
void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
PrepareEagerCheckpoint();
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(0)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
Node* node =
BuildLoadGlobal(name, feedback_slot_index, TypeofMode::INSIDE_TYPEOF);
......@@ -1410,8 +1410,8 @@ void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
void BytecodeGraphBuilder::VisitStaGlobal() {
PrepareEagerCheckpoint();
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(0)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
VectorSlotPair feedback =
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
Node* value = environment()->LookupAccumulator();
......@@ -1537,7 +1537,7 @@ void BytecodeGraphBuilder::VisitStaCurrentContextSlot() {
void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
PrepareEagerCheckpoint();
Node* name = jsgraph()->Constant(
handle(bytecode_iterator().GetConstantForIndexOperand(0), isolate()));
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
const Operator* op =
javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
? Runtime::kLoadLookupSlot
......@@ -1622,7 +1622,7 @@ void BytecodeGraphBuilder::BuildLdaLookupContextSlot(TypeofMode typeof_mode) {
set_environment(slow_environment);
{
Node* name = jsgraph()->Constant(
handle(bytecode_iterator().GetConstantForIndexOperand(0), isolate()));
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
const Operator* op =
javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
......@@ -1657,9 +1657,8 @@ void BytecodeGraphBuilder::BuildLdaLookupGlobalSlot(TypeofMode typeof_mode) {
// Fast path, do a global load.
{
PrepareEagerCheckpoint();
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t feedback_slot_index = bytecode_iterator().GetIndexOperand(1);
Node* node = BuildLoadGlobal(name, feedback_slot_index, typeof_mode);
environment()->BindAccumulator(node, Environment::kAttachFrameState);
......@@ -1675,7 +1674,7 @@ void BytecodeGraphBuilder::BuildLdaLookupGlobalSlot(TypeofMode typeof_mode) {
set_environment(slow_environment);
{
Node* name = jsgraph()->Constant(
handle(bytecode_iterator().GetConstantForIndexOperand(0), isolate()));
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
const Operator* op =
javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
......@@ -1705,7 +1704,7 @@ void BytecodeGraphBuilder::VisitStaLookupSlot() {
PrepareEagerCheckpoint();
Node* value = environment()->LookupAccumulator();
Node* name = jsgraph()->Constant(
handle(bytecode_iterator().GetConstantForIndexOperand(0), isolate()));
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
int bytecode_flags = bytecode_iterator().GetFlagOperand(1);
LanguageMode language_mode = static_cast<LanguageMode>(
interpreter::StoreLookupSlotFlags::LanguageModeBit::decode(
......@@ -1729,8 +1728,8 @@ void BytecodeGraphBuilder::VisitLdaNamedProperty() {
PrepareEagerCheckpoint();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(1)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
VectorSlotPair feedback =
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
const Operator* op = javascript()->LoadNamed(name, feedback);
......@@ -1753,8 +1752,8 @@ void BytecodeGraphBuilder::VisitLdaNamedPropertyNoFeedback() {
PrepareEagerCheckpoint();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(1)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
const Operator* op = javascript()->LoadNamed(name, VectorSlotPair());
Node* node = NewNode(op, object);
environment()->BindAccumulator(node, Environment::kAttachFrameState);
......@@ -1788,8 +1787,8 @@ void BytecodeGraphBuilder::BuildNamedStore(StoreMode store_mode) {
Node* value = environment()->LookupAccumulator();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(1)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
VectorSlotPair feedback =
CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
......@@ -1828,8 +1827,8 @@ void BytecodeGraphBuilder::VisitStaNamedPropertyNoFeedback() {
Node* value = environment()->LookupAccumulator();
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<Name> name(
Name::cast(bytecode_iterator().GetConstantForIndexOperand(1)), isolate());
Handle<Name> name = Handle<Name>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
LanguageMode language_mode =
static_cast<LanguageMode>(bytecode_iterator().GetFlagOperand(2));
const Operator* op =
......@@ -1902,10 +1901,8 @@ void BytecodeGraphBuilder::VisitPopContext() {
}
void BytecodeGraphBuilder::VisitCreateClosure() {
Handle<SharedFunctionInfo> shared_info(
SharedFunctionInfo::cast(
bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<SharedFunctionInfo> shared_info = Handle<SharedFunctionInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
AllocationType allocation =
interpreter::CreateClosureFlags::PretenuredBit::decode(
bytecode_iterator().GetFlagOperand(2))
......@@ -1923,9 +1920,8 @@ void BytecodeGraphBuilder::VisitCreateClosure() {
}
void BytecodeGraphBuilder::VisitCreateBlockContext() {
Handle<ScopeInfo> scope_info(
ScopeInfo::cast(bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
const Operator* op = javascript()->CreateBlockContext(scope_info);
Node* context = NewNode(op);
......@@ -1933,9 +1929,8 @@ void BytecodeGraphBuilder::VisitCreateBlockContext() {
}
void BytecodeGraphBuilder::VisitCreateFunctionContext() {
Handle<ScopeInfo> scope_info(
ScopeInfo::cast(bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(1);
const Operator* op =
javascript()->CreateFunctionContext(scope_info, slots, FUNCTION_SCOPE);
......@@ -1944,9 +1939,8 @@ void BytecodeGraphBuilder::VisitCreateFunctionContext() {
}
void BytecodeGraphBuilder::VisitCreateEvalContext() {
Handle<ScopeInfo> scope_info(
ScopeInfo::cast(bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(1);
const Operator* op =
javascript()->CreateFunctionContext(scope_info, slots, EVAL_SCOPE);
......@@ -1957,9 +1951,8 @@ void BytecodeGraphBuilder::VisitCreateEvalContext() {
void BytecodeGraphBuilder::VisitCreateCatchContext() {
interpreter::Register reg = bytecode_iterator().GetRegisterOperand(0);
Node* exception = environment()->LookupRegister(reg);
Handle<ScopeInfo> scope_info(
ScopeInfo::cast(bytecode_iterator().GetConstantForIndexOperand(1)),
isolate());
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
const Operator* op = javascript()->CreateCatchContext(scope_info);
Node* context = NewNode(op, exception);
......@@ -1969,9 +1962,8 @@ void BytecodeGraphBuilder::VisitCreateCatchContext() {
void BytecodeGraphBuilder::VisitCreateWithContext() {
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<ScopeInfo> scope_info(
ScopeInfo::cast(bytecode_iterator().GetConstantForIndexOperand(1)),
isolate());
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
const Operator* op = javascript()->CreateWithContext(scope_info);
Node* context = NewNode(op, object);
......@@ -1997,9 +1989,8 @@ void BytecodeGraphBuilder::VisitCreateRestParameter() {
}
void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
Handle<String> constant_pattern(
String::cast(bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<String> constant_pattern = Handle<String>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
int const slot_id = bytecode_iterator().GetIndexOperand(1);
VectorSlotPair pair = CreateVectorSlotPair(slot_id);
int literal_flags = bytecode_iterator().GetFlagOperand(2);
......@@ -2009,10 +2000,9 @@ void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
}
void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
Handle<ArrayBoilerplateDescription> array_boilerplate_description(
ArrayBoilerplateDescription::cast(
bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<ArrayBoilerplateDescription> array_boilerplate_description =
Handle<ArrayBoilerplateDescription>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
int const slot_id = bytecode_iterator().GetIndexOperand(1);
VectorSlotPair pair = CreateVectorSlotPair(slot_id);
int bytecode_flags = bytecode_iterator().GetFlagOperand(2);
......@@ -2046,10 +2036,9 @@ void BytecodeGraphBuilder::VisitCreateArrayFromIterable() {
}
void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
Handle<ObjectBoilerplateDescription> constant_properties(
ObjectBoilerplateDescription::cast(
bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<ObjectBoilerplateDescription> constant_properties =
Handle<ObjectBoilerplateDescription>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
int const slot_id = bytecode_iterator().GetIndexOperand(1);
VectorSlotPair pair = CreateVectorSlotPair(slot_id);
int bytecode_flags = bytecode_iterator().GetFlagOperand(2);
......@@ -2082,10 +2071,9 @@ void BytecodeGraphBuilder::VisitCloneObject() {
}
void BytecodeGraphBuilder::VisitGetTemplateObject() {
Handle<TemplateObjectDescription> description(
TemplateObjectDescription::cast(
bytecode_iterator().GetConstantForIndexOperand(0)),
isolate());
Handle<TemplateObjectDescription> description =
Handle<TemplateObjectDescription>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
FeedbackSlot slot = bytecode_iterator().GetSlotOperand(1);
FeedbackNexus nexus(feedback_vector(), slot);
......@@ -2587,7 +2575,7 @@ void BytecodeGraphBuilder::VisitThrowReferenceErrorIfHole() {
Node* check_for_hole = NewNode(simplified()->ReferenceEqual(), accumulator,
jsgraph()->TheHoleConstant());
Node* name = jsgraph()->Constant(
handle(bytecode_iterator().GetConstantForIndexOperand(0), isolate()));
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
BuildHoleCheckAndThrow(check_for_hole,
Runtime::kThrowAccessedUninitializedVariable, name);
}
......
......@@ -533,7 +533,7 @@ void SerializerForBackgroundCompilation::VisitLdaConstant(
BytecodeArrayIterator* iterator) {
environment()->accumulator_hints().Clear();
environment()->accumulator_hints().AddConstant(
handle(iterator->GetConstantForIndexOperand(0), broker()->isolate()));
iterator->GetConstantForIndexOperand(0, broker()->isolate()));
}
void SerializerForBackgroundCompilation::VisitLdar(
......@@ -560,9 +560,8 @@ void SerializerForBackgroundCompilation::VisitMov(
void SerializerForBackgroundCompilation::VisitCreateClosure(
BytecodeArrayIterator* iterator) {
Handle<SharedFunctionInfo> shared(
SharedFunctionInfo::cast(iterator->GetConstantForIndexOperand(0)),
broker()->isolate());
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>::cast(
iterator->GetConstantForIndexOperand(0, broker()->isolate()));
Handle<FeedbackCell> feedback_cell =
environment()->function().feedback_vector->GetClosureFeedbackCell(
......@@ -1242,8 +1241,8 @@ void SerializerForBackgroundCompilation::ProcessNamedPropertyAccess(
BytecodeArrayIterator* iterator, AccessMode mode) {
Hints const& receiver =
environment()->register_hints(iterator->GetRegisterOperand(0));
Handle<Name> name(Name::cast(iterator->GetConstantForIndexOperand(1)),
broker()->isolate());
Handle<Name> name = Handle<Name>::cast(
iterator->GetConstantForIndexOperand(1, broker()->isolate()));
FeedbackSlot slot = iterator->GetSlotOperand(2);
ProcessNamedPropertyAccess(receiver, NameRef(broker(), name), slot, mode);
}
......
......@@ -197,13 +197,22 @@ Runtime::FunctionId BytecodeArrayAccessor::GetIntrinsicIdOperand(
static_cast<IntrinsicsHelper::IntrinsicId>(raw_id));
}
Object BytecodeArrayAccessor::GetConstantAtIndex(int index) const {
return bytecode_array()->constant_pool().get(index);
Handle<Object> BytecodeArrayAccessor::GetConstantAtIndex(
int index, Isolate* isolate) const {
return handle(bytecode_array()->constant_pool().get(index), isolate);
}
Object BytecodeArrayAccessor::GetConstantForIndexOperand(
int operand_index) const {
return GetConstantAtIndex(GetIndexOperand(operand_index));
bool BytecodeArrayAccessor::IsConstantAtIndexSmi(int index) const {
return bytecode_array()->constant_pool().get(index).IsSmi();
}
Smi BytecodeArrayAccessor::GetConstantAtIndexAsSmi(int index) const {
return Smi::cast(bytecode_array()->constant_pool().get(index));
}
Handle<Object> BytecodeArrayAccessor::GetConstantForIndexOperand(
int operand_index, Isolate* isolate) const {
return GetConstantAtIndex(GetIndexOperand(operand_index), isolate);
}
int BytecodeArrayAccessor::GetJumpTargetOffset() const {
......@@ -215,7 +224,7 @@ int BytecodeArrayAccessor::GetJumpTargetOffset() const {
}
return GetAbsoluteOffset(relative_offset);
} else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) {
Smi smi = Smi::cast(GetConstantForIndexOperand(0));
Smi smi = GetConstantAtIndexAsSmi(GetIndexOperand(0));
return GetAbsoluteOffset(smi.value());
} else {
UNREACHABLE();
......@@ -315,19 +324,16 @@ bool JumpTableTargetOffsets::iterator::operator!=(
}
void JumpTableTargetOffsets::iterator::UpdateAndAdvanceToValid() {
if (table_offset_ >= table_end_) return;
Object current = accessor_->GetConstantAtIndex(table_offset_);
while (!current.IsSmi()) {
DCHECK(current.IsTheHole());
while (table_offset_ < table_end_ &&
!accessor_->IsConstantAtIndexSmi(table_offset_)) {
++table_offset_;
++index_;
if (table_offset_ >= table_end_) break;
current = accessor_->GetConstantAtIndex(table_offset_);
}
// Make sure we haven't reached the end of the table with a hole in current.
if (current.IsSmi()) {
current_ = Smi::cast(current);
if (table_offset_ < table_end_) {
DCHECK(accessor_->IsConstantAtIndexSmi(table_offset_));
current_ = accessor_->GetConstantAtIndexAsSmi(table_offset_);
}
}
......
......@@ -5,6 +5,7 @@
#ifndef V8_INTERPRETER_BYTECODE_ARRAY_ACCESSOR_H_
#define V8_INTERPRETER_BYTECODE_ARRAY_ACCESSOR_H_
#include "src/base/optional.h"
#include "src/common/globals.h"
#include "src/handles/handles.h"
#include "src/interpreter/bytecode-register.h"
......@@ -93,8 +94,11 @@ class V8_EXPORT_PRIVATE BytecodeArrayAccessor {
Runtime::FunctionId GetRuntimeIdOperand(int operand_index) const;
Runtime::FunctionId GetIntrinsicIdOperand(int operand_index) const;
uint32_t GetNativeContextIndexOperand(int operand_index) const;
Object GetConstantAtIndex(int offset) const;
Object GetConstantForIndexOperand(int operand_index) const;
Handle<Object> GetConstantAtIndex(int offset, Isolate* isolate) const;
bool IsConstantAtIndexSmi(int offset) const;
Smi GetConstantAtIndexAsSmi(int offset) const;
Handle<Object> GetConstantForIndexOperand(int operand_index,
Isolate* isolate) const;
// Returns the absolute offset of the branch target at the current bytecode.
// It is an error to call this method if the bytecode is not for a jump or
......
......@@ -650,7 +650,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpConstant);
CHECK_EQ(iterator.GetConstantForIndexOperand(0),
CHECK_EQ(*(iterator.GetConstantForIndexOperand(0, isolate())),
Smi::FromInt(kFarJumpDistance));
iterator.Advance();
......@@ -658,7 +658,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfTrueConstant);
CHECK_EQ(iterator.GetConstantForIndexOperand(0),
CHECK_EQ(*(iterator.GetConstantForIndexOperand(0, isolate())),
Smi::FromInt(kFarJumpDistance - 5));
iterator.Advance();
......@@ -666,7 +666,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfFalseConstant);
CHECK_EQ(iterator.GetConstantForIndexOperand(0),
CHECK_EQ(*(iterator.GetConstantForIndexOperand(0, isolate())),
Smi::FromInt(kFarJumpDistance - 10));
iterator.Advance();
......@@ -674,7 +674,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrueConstant);
CHECK_EQ(iterator.GetConstantForIndexOperand(0),
CHECK_EQ(*(iterator.GetConstantForIndexOperand(0, isolate())),
Smi::FromInt(kFarJumpDistance - 15));
iterator.Advance();
......@@ -683,7 +683,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
CHECK_EQ(iterator.current_bytecode(),
Bytecode::kJumpIfToBooleanFalseConstant);
CHECK_EQ(iterator.GetConstantForIndexOperand(0),
CHECK_EQ(*(iterator.GetConstantForIndexOperand(0, isolate())),
Smi::FromInt(kFarJumpDistance - 20));
iterator.Advance();
}
......
......@@ -81,7 +81,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_0);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_0);
CHECK(!iterator.done());
offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle);
iterator.Advance();
......@@ -98,7 +99,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
EXPECT_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_1);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_1);
CHECK(!iterator.done());
offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle);
iterator.Advance();
......
......@@ -184,7 +184,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesFirst) {
EXPECT_EQ(iterator.current_index(), 0);
EXPECT_EQ(iterator.current_offset(), 0);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_0);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_0);
ASSERT_TRUE(iterator.IsValid());
}
......@@ -331,7 +332,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, RandomAccessValid) {
EXPECT_EQ(iterator.current_index(), 2);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_1);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_1);
ASSERT_TRUE(iterator.IsValid());
iterator.GoToIndex(18);
......@@ -488,7 +490,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArray) {
EXPECT_EQ(iterator.current_index(), 0);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_0);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_0);
ASSERT_TRUE(iterator.IsValid());
offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle);
++iterator;
......@@ -507,7 +510,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArray) {
EXPECT_EQ(iterator.current_index(), 2);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_1);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_1);
ASSERT_TRUE(iterator.IsValid());
offset += Bytecodes::Size(Bytecode::kLdaConstant, OperandScale::kSingle);
++iterator;
......@@ -968,7 +972,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArrayBackwards) {
EXPECT_EQ(iterator.current_index(), 2);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_1);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_1);
ASSERT_TRUE(iterator.IsValid());
--iterator;
......@@ -987,7 +992,8 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArrayBackwards) {
EXPECT_EQ(iterator.current_index(), 0);
EXPECT_EQ(iterator.current_offset(), offset);
EXPECT_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0).Number(), heap_num_0);
EXPECT_EQ(iterator.GetConstantForIndexOperand(0, isolate())->Number(),
heap_num_0);
ASSERT_TRUE(iterator.IsValid());
--iterator;
ASSERT_FALSE(iterator.IsValid());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment