Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: test/cctest/interpreter/test-interpreter.cc

Issue 2652893010: Interpreter tester should accept metadata instead of a vector (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/interpreter/interpreter-tester.cc ('k') | test/cctest/test-feedback-vector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-interpreter.cc
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc
index ad2577aeabae0fb4d6600f41297eee8b31e162e2..1d71c0a15f2963612f04c2d55784b4128ee1d752 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -22,6 +22,9 @@ namespace v8 {
namespace internal {
namespace interpreter {
+static int GetIndex(FeedbackVectorSlot slot) {
+ return TypeFeedbackVector::GetIndex(slot);
+}
TEST(InterpreterReturn) {
HandleAndZoneScope handles;
@@ -272,8 +275,8 @@ TEST(InterpreterShiftOpsSmi) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0);
int lhs = lhs_inputs[l];
@@ -281,11 +284,11 @@ TEST(InterpreterShiftOpsSmi) {
builder.LoadLiteral(Smi::FromInt(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(rhs))
- .BinaryOperation(kShiftOperators[o], reg, vector->GetIndex(slot))
+ .BinaryOperation(kShiftOperators[o], reg, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
Handle<Object> expected_value =
@@ -311,8 +314,8 @@ TEST(InterpreterBinaryOpsSmi) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0);
int lhs = lhs_inputs[l];
@@ -320,12 +323,11 @@ TEST(InterpreterBinaryOpsSmi) {
builder.LoadLiteral(Smi::FromInt(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(rhs))
- .BinaryOperation(kArithmeticOperators[o], reg,
- vector->GetIndex(slot))
+ .BinaryOperation(kArithmeticOperators[o], reg, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
Handle<Object> expected_value =
@@ -352,8 +354,8 @@ TEST(InterpreterBinaryOpsHeapNumber) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0);
double lhs = lhs_inputs[l];
@@ -361,12 +363,11 @@ TEST(InterpreterBinaryOpsHeapNumber) {
builder.LoadLiteral(factory->NewNumber(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(factory->NewNumber(rhs))
- .BinaryOperation(kArithmeticOperators[o], reg,
- vector->GetIndex(slot))
+ .BinaryOperation(kArithmeticOperators[o], reg, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
Handle<Object> expected_value =
@@ -424,23 +425,23 @@ TEST(InterpreterStringAdd) {
BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1);
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0);
builder.LoadLiteral(test_cases[i].lhs)
.StoreAccumulatorInRegister(reg)
.LoadLiteral(test_cases[i].rhs)
- .BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot))
+ .BinaryOperation(Token::Value::ADD, reg, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->SameValue(*test_cases[i].expected_value));
- Object* feedback = vector->Get(slot);
+ Object* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
CHECK_EQ(test_cases[i].expected_feedback,
static_cast<Smi*>(feedback)->value());
@@ -486,28 +487,21 @@ TEST(InterpreterParameter8) {
FeedbackVectorSlot slot5 = feedback_spec.AddInterpreterBinaryOpICSlot();
FeedbackVectorSlot slot6 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
builder.LoadAccumulatorWithRegister(builder.Parameter(0))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(1),
- vector->GetIndex(slot))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(2),
- vector->GetIndex(slot1))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(3),
- vector->GetIndex(slot2))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(4),
- vector->GetIndex(slot3))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(5),
- vector->GetIndex(slot4))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(6),
- vector->GetIndex(slot5))
- .BinaryOperation(Token::Value::ADD, builder.Parameter(7),
- vector->GetIndex(slot6))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(1), GetIndex(slot))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(2), GetIndex(slot1))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(3), GetIndex(slot2))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(4), GetIndex(slot3))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(5), GetIndex(slot4))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(6), GetIndex(slot5))
+ .BinaryOperation(Token::Value::ADD, builder.Parameter(7), GetIndex(slot6))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
typedef Handle<Object> H;
auto callable = tester.GetCallable<H, H, H, H, H, H, H, H>();
@@ -653,23 +647,23 @@ TEST(InterpreterBinaryOpTypeFeedback) {
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- i::NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ i::NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0);
builder.LoadLiteral(test_case.arg1)
.StoreAccumulatorInRegister(reg)
.LoadLiteral(test_case.arg2)
- .BinaryOperation(test_case.op, reg, vector->GetIndex(slot0))
+ .BinaryOperation(test_case.op, reg, GetIndex(slot0))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_val = callable().ToHandleChecked();
- Object* feedback0 = vector->Get(slot0);
+ Object* feedback0 = callable.vector()->Get(slot0);
CHECK(feedback0->IsSmi());
CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value());
CHECK(Object::Equals(test_case.result, return_val).ToChecked());
@@ -757,23 +751,23 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- i::NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ i::NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0);
builder.LoadLiteral(test_case.arg1)
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(test_case.arg2))
- .BinaryOperation(test_case.op, reg, vector->GetIndex(slot0))
+ .BinaryOperation(test_case.op, reg, GetIndex(slot0))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_val = callable().ToHandleChecked();
- Object* feedback0 = vector->Get(slot0);
+ Object* feedback0 = callable.vector()->Get(slot0);
CHECK(feedback0->IsSmi());
CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value());
CHECK(Object::Equals(test_case.result, return_val).ToChecked());
@@ -810,22 +804,22 @@ TEST(InterpreterUnaryOpFeedback) {
i::FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot();
i::FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- i::NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ i::NewTypeFeedbackMetadata(isolate, &feedback_spec);
builder.LoadAccumulatorWithRegister(builder.Parameter(0))
- .CountOperation(test_case.op, vector->GetIndex(slot0))
+ .CountOperation(test_case.op, GetIndex(slot0))
.LoadAccumulatorWithRegister(builder.Parameter(1))
- .CountOperation(test_case.op, vector->GetIndex(slot1))
+ .CountOperation(test_case.op, GetIndex(slot1))
.LoadAccumulatorWithRegister(builder.Parameter(2))
- .CountOperation(test_case.op, vector->GetIndex(slot2))
+ .CountOperation(test_case.op, GetIndex(slot2))
.LoadAccumulatorWithRegister(builder.Parameter(3))
- .CountOperation(test_case.op, vector->GetIndex(slot3))
+ .CountOperation(test_case.op, GetIndex(slot3))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
typedef Handle<Object> H;
auto callable = tester.GetCallable<H, H, H, H>();
@@ -835,22 +829,22 @@ TEST(InterpreterUnaryOpFeedback) {
test_case.number_feedback_value, test_case.any_feedback_value)
.ToHandleChecked();
USE(return_val);
- Object* feedback0 = vector->Get(slot0);
+ Object* feedback0 = callable.vector()->Get(slot0);
CHECK(feedback0->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kSignedSmall,
static_cast<Smi*>(feedback0)->value());
- Object* feedback1 = vector->Get(slot1);
+ Object* feedback1 = callable.vector()->Get(slot1);
CHECK(feedback1->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kNumber,
static_cast<Smi*>(feedback1)->value());
- Object* feedback2 = vector->Get(slot2);
+ Object* feedback2 = callable.vector()->Get(slot2);
CHECK(feedback2->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kNumber,
static_cast<Smi*>(feedback2)->value());
- Object* feedback3 = vector->Get(slot3);
+ Object* feedback3 = callable.vector()->Get(slot3);
CHECK(feedback3->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kAny,
static_cast<Smi*>(feedback3)->value());
@@ -873,18 +867,18 @@ TEST(InterpreterBitwiseTypeFeedback) {
i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot();
i::FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- i::NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ i::NewTypeFeedbackMetadata(isolate, &feedback_spec);
builder.LoadAccumulatorWithRegister(builder.Parameter(0))
- .BinaryOperation(op, builder.Parameter(1), vector->GetIndex(slot0))
- .BinaryOperation(op, builder.Parameter(2), vector->GetIndex(slot1))
- .BinaryOperation(op, builder.Parameter(3), vector->GetIndex(slot2))
+ .BinaryOperation(op, builder.Parameter(1), GetIndex(slot0))
+ .BinaryOperation(op, builder.Parameter(2), GetIndex(slot1))
+ .BinaryOperation(op, builder.Parameter(3), GetIndex(slot2))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
typedef Handle<Object> H;
auto callable = tester.GetCallable<H, H, H, H>();
@@ -896,17 +890,17 @@ TEST(InterpreterBitwiseTypeFeedback) {
Handle<Object> return_val =
callable(arg1, arg2, arg3, arg4).ToHandleChecked();
USE(return_val);
- Object* feedback0 = vector->Get(slot0);
+ Object* feedback0 = callable.vector()->Get(slot0);
CHECK(feedback0->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kSignedSmall,
static_cast<Smi*>(feedback0)->value());
- Object* feedback1 = vector->Get(slot1);
+ Object* feedback1 = callable.vector()->Get(slot1);
CHECK(feedback1->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kNumber,
static_cast<Smi*>(feedback1)->value());
- Object* feedback2 = vector->Get(slot2);
+ Object* feedback2 = callable.vector()->Get(slot2);
CHECK(feedback2->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kAny,
static_cast<Smi*>(feedback2)->value());
@@ -1041,19 +1035,19 @@ TEST(InterpreterLoadNamedProperty) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Handle<i::String> name = factory->NewStringFromAsciiChecked("val");
name = factory->string_table()->LookupString(isolate, name);
BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0);
- builder.LoadNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot))
+ builder.LoadNamedProperty(builder.Parameter(0), name, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })");
@@ -1094,8 +1088,8 @@ TEST(InterpreterLoadKeyedProperty) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Handle<i::String> key = factory->NewStringFromAsciiChecked("key");
key = factory->string_table()->LookupString(isolate, key);
@@ -1103,11 +1097,11 @@ TEST(InterpreterLoadKeyedProperty) {
BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1);
builder.LoadLiteral(key)
- .LoadKeyedProperty(builder.Parameter(0), vector->GetIndex(slot))
+ .LoadKeyedProperty(builder.Parameter(0), GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject("({ key : 123 })");
@@ -1136,8 +1130,8 @@ TEST(InterpreterStoreNamedProperty) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Handle<i::String> name = factory->NewStringFromAsciiChecked("val");
name = factory->string_table()->LookupString(isolate, name);
@@ -1145,12 +1139,11 @@ TEST(InterpreterStoreNamedProperty) {
BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0);
builder.LoadLiteral(Smi::FromInt(999))
- .StoreNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot),
- STRICT)
+ .StoreNamedProperty(builder.Parameter(0), name, GetIndex(slot), STRICT)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })");
// Test IC miss.
@@ -1195,8 +1188,8 @@ TEST(InterpreterStoreKeyedProperty) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Handle<i::String> name = factory->NewStringFromAsciiChecked("val");
name = factory->string_table()->LookupString(isolate, name);
@@ -1206,12 +1199,12 @@ TEST(InterpreterStoreKeyedProperty) {
builder.LoadLiteral(name)
.StoreAccumulatorInRegister(Register(0))
.LoadLiteral(Smi::FromInt(999))
- .StoreKeyedProperty(builder.Parameter(0), Register(0),
- vector->GetIndex(slot), i::SLOPPY)
+ .StoreKeyedProperty(builder.Parameter(0), Register(0), GetIndex(slot),
+ i::SLOPPY)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })");
// Test IC miss.
@@ -1243,11 +1236,11 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) {
FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot();
FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
- int slot_index = vector->GetIndex(slot);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
+ int slot_index = GetIndex(slot);
int call_slot_index = -1;
- call_slot_index = vector->GetIndex(call_slot);
+ call_slot_index = GetIndex(call_slot);
Handle<i::String> name = factory->NewStringFromAsciiChecked("func");
name = factory->string_table()->LookupString(isolate, name);
@@ -1266,7 +1259,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) {
builder.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject(
@@ -1287,7 +1280,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) {
builder.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject(
@@ -1320,7 +1313,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) {
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject(
@@ -1368,7 +1361,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) {
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<Handle<Object>>();
Handle<Object> object = InterpreterTester::NewObject(
@@ -1421,8 +1414,8 @@ TEST(InterpreterJumps) {
FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot();
FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0), scratch(1);
BytecodeLabel label[3];
@@ -1431,18 +1424,17 @@ TEST(InterpreterJumps) {
.StoreAccumulatorInRegister(reg)
.Jump(&label[1]);
SetRegister(builder, reg, 1024, scratch).Bind(&label[0]);
- IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot))
- .Jump(&label[2]);
+ IncrementRegister(builder, reg, 1, scratch, GetIndex(slot)).Jump(&label[2]);
SetRegister(builder, reg, 2048, scratch).Bind(&label[1]);
- IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot1))
+ IncrementRegister(builder, reg, 2, scratch, GetIndex(slot1))
.JumpLoop(&label[0], 0);
SetRegister(builder, reg, 4096, scratch).Bind(&label[2]);
- IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot2))
+ IncrementRegister(builder, reg, 4, scratch, GetIndex(slot2))
.LoadAccumulatorWithRegister(reg)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK_EQ(Smi::cast(*return_value)->value(), 7);
@@ -1462,8 +1454,8 @@ TEST(InterpreterConditionalJumps) {
FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot();
FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0), scratch(1);
BytecodeLabel label[2];
@@ -1473,26 +1465,26 @@ TEST(InterpreterConditionalJumps) {
.StoreAccumulatorInRegister(reg)
.LoadFalse()
.JumpIfFalse(&label[0]);
- IncrementRegister(builder, reg, 1024, scratch, vector->GetIndex(slot))
+ IncrementRegister(builder, reg, 1024, scratch, GetIndex(slot))
.Bind(&label[0])
.LoadTrue()
.JumpIfFalse(&done);
- IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot1))
+ IncrementRegister(builder, reg, 1, scratch, GetIndex(slot1))
.LoadTrue()
.JumpIfTrue(&label[1]);
- IncrementRegister(builder, reg, 2048, scratch, vector->GetIndex(slot2))
+ IncrementRegister(builder, reg, 2048, scratch, GetIndex(slot2))
.Bind(&label[1]);
- IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot3))
+ IncrementRegister(builder, reg, 2, scratch, GetIndex(slot3))
.LoadFalse()
.JumpIfTrue(&done1);
- IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot4))
+ IncrementRegister(builder, reg, 4, scratch, GetIndex(slot4))
.LoadAccumulatorWithRegister(reg)
.Bind(&done)
.Bind(&done1)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK_EQ(Smi::cast(*return_value)->value(), 7);
@@ -1512,8 +1504,8 @@ TEST(InterpreterConditionalJumps2) {
FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot();
FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0), scratch(1);
BytecodeLabel label[2];
@@ -1523,26 +1515,26 @@ TEST(InterpreterConditionalJumps2) {
.StoreAccumulatorInRegister(reg)
.LoadFalse()
.JumpIfFalse(&label[0]);
- IncrementRegister(builder, reg, 1024, scratch, vector->GetIndex(slot))
+ IncrementRegister(builder, reg, 1024, scratch, GetIndex(slot))
.Bind(&label[0])
.LoadTrue()
.JumpIfFalse(&done);
- IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot1))
+ IncrementRegister(builder, reg, 1, scratch, GetIndex(slot1))
.LoadTrue()
.JumpIfTrue(&label[1]);
- IncrementRegister(builder, reg, 2048, scratch, vector->GetIndex(slot2))
+ IncrementRegister(builder, reg, 2048, scratch, GetIndex(slot2))
.Bind(&label[1]);
- IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot3))
+ IncrementRegister(builder, reg, 2, scratch, GetIndex(slot3))
.LoadFalse()
.JumpIfTrue(&done1);
- IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot4))
+ IncrementRegister(builder, reg, 4, scratch, GetIndex(slot4))
.LoadAccumulatorWithRegister(reg)
.Bind(&done)
.Bind(&done1)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK_EQ(Smi::cast(*return_value)->value(), 7);
@@ -1557,8 +1549,8 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register reg(0), scratch(256);
BytecodeLabel done, fake;
@@ -1568,7 +1560,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
// Consume all 8-bit operands
for (int i = 1; i <= 256; i++) {
builder.LoadLiteral(isolate->factory()->NewNumber(i));
- builder.BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot));
+ builder.BinaryOperation(Token::Value::ADD, reg, GetIndex(slot));
builder.StoreAccumulatorInRegister(reg);
}
builder.Jump(&done);
@@ -1578,7 +1570,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
for (int i = 0; i < 6600; i++) {
builder.LoadLiteral(Smi::kZero); // 1-byte
builder.BinaryOperation(Token::Value::ADD, scratch,
- vector->GetIndex(slot)); // 6-bytes
+ GetIndex(slot)); // 6-bytes
builder.StoreAccumulatorInRegister(scratch); // 4-bytes
builder.MoveRegister(scratch, reg); // 6-bytes
}
@@ -1600,7 +1592,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
}
CHECK(found_16bit_constant_jump);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK_EQ(Smi::cast(*return_value)->value(), 256.0 / 2 * (1 + 256));
@@ -1703,24 +1695,24 @@ TEST(InterpreterSmiComparisons) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register r0(0);
builder.LoadLiteral(Smi::FromInt(inputs[i]))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(Smi::FromInt(inputs[j]))
- .CompareOperation(comparison, r0, vector->GetIndex(slot))
+ .CompareOperation(comparison, r0, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CompareC(comparison, inputs[i], inputs[j]));
- Object* feedback = vector->Get(slot);
+ Object* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
CHECK_EQ(CompareOperationFeedback::kSignedSmall,
static_cast<Smi*>(feedback)->value());
@@ -1750,24 +1742,24 @@ TEST(InterpreterHeapNumberComparisons) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register r0(0);
builder.LoadLiteral(factory->NewHeapNumber(inputs[i]))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewHeapNumber(inputs[j]))
- .CompareOperation(comparison, r0, vector->GetIndex(slot))
+ .CompareOperation(comparison, r0, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CompareC(comparison, inputs[i], inputs[j]));
- Object* feedback = vector->Get(slot);
+ Object* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
CHECK_EQ(CompareOperationFeedback::kNumber,
static_cast<Smi*>(feedback)->value());
@@ -1795,25 +1787,25 @@ TEST(InterpreterStringComparisons) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1);
Register r0(0);
builder.LoadLiteral(factory->InternalizeUtf8String(lhs))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->InternalizeUtf8String(rhs))
- .CompareOperation(comparison, r0, vector->GetIndex(slot))
+ .CompareOperation(comparison, r0, GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CompareC(comparison, inputs[i], inputs[j]));
- Object* feedback = vector->Get(slot);
+ Object* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
int const expected_feedback =
Token::IsOrderedRelationalCompareOp(comparison)
@@ -1854,8 +1846,8 @@ TEST(InterpreterMixedComparisons) {
FeedbackVectorSpec feedback_spec(&zone);
FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot();
- Handle<i::TypeFeedbackVector> vector =
- NewTypeFeedbackVector(isolate, &feedback_spec);
+ Handle<i::TypeFeedbackMetadata> metadata =
+ NewTypeFeedbackMetadata(isolate, &feedback_spec);
Register r0(0);
if (pass == 0) {
@@ -1863,26 +1855,26 @@ TEST(InterpreterMixedComparisons) {
builder.LoadLiteral(factory->NewNumber(lhs))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewStringFromAsciiChecked(rhs_cstr))
- .CompareOperation(comparison, r0, vector->GetIndex(slot))
+ .CompareOperation(comparison, r0, GetIndex(slot))
.Return();
} else {
// Comparison with HeapNumber on the rhs and String on the lhs
builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs_cstr))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewNumber(rhs))
- .CompareOperation(comparison, r0, vector->GetIndex(slot))
+ .CompareOperation(comparison, r0, GetIndex(slot))
.Return();
}
Handle<BytecodeArray> bytecode_array =
builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array, vector);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CompareC(comparison, lhs, rhs, true));
- Object* feedback = vector->Get(slot);
+ Object* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
// kNumber | kString gets converted to CompareOperationHint::kAny.
int expected_feedback = CompareOperationFeedback::kNumber |
« no previous file with comments | « test/cctest/interpreter/interpreter-tester.cc ('k') | test/cctest/test-feedback-vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698