Index: test/cctest/interpreter/test-interpreter.cc |
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc |
index 69cf0e18bd48dfa507f248e563083519be77c5d0..32921cfb03c88710d1f67e166f121029271c3f95 100644 |
--- a/test/cctest/interpreter/test-interpreter.cc |
+++ b/test/cctest/interpreter/test-interpreter.cc |
@@ -928,7 +928,8 @@ TEST(InterpreterStoreKeyedProperty) { |
CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); |
} |
-static void TestInterpreterCall(TailCallMode tail_call_mode) { |
+static void TestInterpreterCall(TailCallMode tail_call_mode, |
+ bool has_feedback_slot) { |
HandleAndZoneScope handles; |
i::Isolate* isolate = handles.main_isolate(); |
i::Factory* factory = isolate->factory(); |
@@ -936,10 +937,15 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
i::FeedbackVectorSpec feedback_spec(&zone); |
i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
+ i::FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); |
Handle<i::TypeFeedbackVector> vector = |
i::NewTypeFeedbackVector(isolate, &feedback_spec); |
int slot_index = vector->GetIndex(slot); |
+ int call_slot_index = -1; |
+ if (has_feedback_slot) { |
+ call_slot_index = vector->GetIndex(call_slot); |
+ } |
Handle<i::String> name = factory->NewStringFromAsciiChecked("func"); |
name = factory->string_table()->LookupString(isolate, name); |
@@ -949,9 +955,16 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
0, 1); |
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) |
- .StoreAccumulatorInRegister(Register(0)) |
- .Call(Register(0), builder.Parameter(0), 1, 0, tail_call_mode) |
- .Return(); |
+ .StoreAccumulatorInRegister(Register(0)); |
+ |
+ if (has_feedback_slot) { |
+ builder.CallIC(Register(0), builder.Parameter(0), 1, call_slot_index, |
+ tail_call_mode); |
+ } else { |
+ builder.Call(Register(0), builder.Parameter(0), 1, tail_call_mode); |
+ } |
+ |
+ builder.Return(); |
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
@@ -968,9 +981,14 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
0, 1); |
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) |
- .StoreAccumulatorInRegister(Register(0)) |
- .Call(Register(0), builder.Parameter(0), 1, 0, tail_call_mode) |
- .Return(); |
+ .StoreAccumulatorInRegister(Register(0)); |
+ if (has_feedback_slot) { |
+ builder.CallIC(Register(0), builder.Parameter(0), 1, call_slot_index, |
+ tail_call_mode); |
+ } else { |
+ builder.Call(Register(0), builder.Parameter(0), 1, tail_call_mode); |
+ } |
+ builder.Return(); |
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
@@ -996,9 +1014,17 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
.LoadLiteral(Smi::FromInt(51)) |
.StoreAccumulatorInRegister(Register(2)) |
.LoadLiteral(Smi::FromInt(11)) |
- .StoreAccumulatorInRegister(Register(3)) |
- .Call(Register(0), Register(1), 3, 0, tail_call_mode) |
- .Return(); |
+ .StoreAccumulatorInRegister(Register(3)); |
+ |
+ if (has_feedback_slot) { |
+ builder.CallIC(Register(0), Register(1), 3, call_slot_index, |
+ tail_call_mode); |
+ } else { |
+ builder.Call(Register(0), Register(1), 3, tail_call_mode); |
+ } |
+ |
+ builder.Return(); |
+ |
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
@@ -1039,9 +1065,17 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
.LoadLiteral(factory->NewStringFromAsciiChecked("i")) |
.StoreAccumulatorInRegister(Register(10)) |
.LoadLiteral(factory->NewStringFromAsciiChecked("j")) |
- .StoreAccumulatorInRegister(Register(11)) |
- .Call(Register(0), Register(1), 11, 0, tail_call_mode) |
- .Return(); |
+ .StoreAccumulatorInRegister(Register(11)); |
+ |
+ if (has_feedback_slot) { |
+ builder.CallIC(Register(0), Register(1), 11, call_slot_index, |
+ tail_call_mode); |
+ } else { |
+ builder.Call(Register(0), Register(1), 11, tail_call_mode); |
+ } |
+ |
+ builder.Return(); |
+ |
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
@@ -1061,9 +1095,13 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
} |
} |
-TEST(InterpreterCall) { TestInterpreterCall(TailCallMode::kDisallow); } |
+TEST(InterpreterCall) { TestInterpreterCall(TailCallMode::kDisallow, false); } |
+ |
+TEST(InterpreterTailCall) { TestInterpreterCall(TailCallMode::kAllow, false); } |
+ |
+TEST(InterpreterCallIC) { TestInterpreterCall(TailCallMode::kDisallow, true); } |
-TEST(InterpreterTailCall) { TestInterpreterCall(TailCallMode::kAllow); } |
+TEST(InterpreterTailCallIC) { TestInterpreterCall(TailCallMode::kAllow, true); } |
static BytecodeArrayBuilder& SetRegister(BytecodeArrayBuilder& builder, |
Register reg, int value, |