Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/test/unittests/compiler/instruction-selector-unittest.cc b/test/unittests/compiler/instruction-selector-unittest.cc
index c79a9e4..89c0a65 100644
--- a/test/unittests/compiler/instruction-selector-unittest.cc
+++ b/test/unittests/compiler/instruction-selector-unittest.cc
@@ -4,7 +4,9 @@
#include "test/unittests/compiler/instruction-selector-unittest.h"
-#include "src/compiler/graph-inl.h"
+#include "src/code-factory.h"
+#include "src/compiler/graph.h"
+#include "src/compiler/schedule.h"
#include "src/flags.h"
#include "test/unittests/compiler/compiler-test-utils.h"
@@ -12,12 +14,6 @@
namespace internal {
namespace compiler {
-namespace {
-
-typedef RawMachineAssembler::Label MLabel;
-
-} // namespace
-
InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {}
@@ -27,44 +23,38 @@
InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
InstructionSelector::Features features,
- InstructionSelectorTest::StreamBuilderMode mode) {
+ InstructionSelectorTest::StreamBuilderMode mode,
+ InstructionSelector::SourcePositionMode source_position_mode) {
Schedule* schedule = Export();
if (FLAG_trace_turbo) {
OFStream out(stdout);
out << "=== Schedule before instruction selection ===" << std::endl
<< *schedule;
}
- EXPECT_NE(0, graph()->NodeCount());
- int initial_node_count = graph()->NodeCount();
- Linkage linkage(test_->zone(), call_descriptor());
+ size_t const node_count = graph()->NodeCount();
+ EXPECT_NE(0u, node_count);
+ Linkage linkage(call_descriptor());
InstructionBlocks* instruction_blocks =
InstructionSequence::InstructionBlocksFor(test_->zone(), schedule);
- InstructionSequence sequence(test_->zone(), instruction_blocks);
+ InstructionSequence sequence(test_->isolate(), test_->zone(),
+ instruction_blocks);
SourcePositionTable source_position_table(graph());
- InstructionSelector selector(test_->zone(), graph(), &linkage, &sequence,
- schedule, &source_position_table, features);
+ InstructionSelector selector(test_->zone(), node_count, &linkage, &sequence,
+ schedule, &source_position_table,
+ source_position_mode, features);
selector.SelectInstructions();
if (FLAG_trace_turbo) {
OFStream out(stdout);
PrintableInstructionSequence printable = {
- RegisterConfiguration::ArchDefault(), &sequence};
+ RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN),
+ &sequence};
out << "=== Code sequence after instruction selection ===" << std::endl
<< printable;
}
Stream s;
+ s.virtual_registers_ = selector.GetVirtualRegistersForTesting();
// Map virtual registers.
- {
- const NodeToVregMap& node_map = selector.GetNodeMapForTesting();
- for (int i = 0; i < initial_node_count; ++i) {
- if (node_map[i] != InstructionSelector::kNodeUnmapped) {
- s.virtual_registers_.insert(std::make_pair(i, node_map[i]));
- }
- }
- }
- std::set<int> virtual_registers;
- for (InstructionSequence::const_iterator i = sequence.begin();
- i != sequence.end(); ++i) {
- Instruction* instr = *i;
+ for (Instruction* const instr : sequence) {
if (instr->opcode() < 0) continue;
if (mode == kTargetInstructions) {
switch (instr->arch_opcode()) {
@@ -84,36 +74,32 @@
InstructionOperand* output = instr->OutputAt(i);
EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind());
if (output->IsConstant()) {
- s.constants_.insert(std::make_pair(
- output->index(), sequence.GetConstant(output->index())));
- virtual_registers.insert(output->index());
- } else if (output->IsUnallocated()) {
- virtual_registers.insert(
- UnallocatedOperand::cast(output)->virtual_register());
+ int vreg = ConstantOperand::cast(output)->virtual_register();
+ s.constants_.insert(std::make_pair(vreg, sequence.GetConstant(vreg)));
}
}
for (size_t i = 0; i < instr->InputCount(); ++i) {
InstructionOperand* input = instr->InputAt(i);
EXPECT_NE(InstructionOperand::CONSTANT, input->kind());
if (input->IsImmediate()) {
- s.immediates_.insert(std::make_pair(
- input->index(), sequence.GetImmediate(input->index())));
- } else if (input->IsUnallocated()) {
- virtual_registers.insert(
- UnallocatedOperand::cast(input)->virtual_register());
+ auto imm = ImmediateOperand::cast(input);
+ if (imm->type() == ImmediateOperand::INDEXED) {
+ int index = imm->indexed_value();
+ s.immediates_.insert(
+ std::make_pair(index, sequence.GetImmediate(imm)));
+ }
}
}
s.instructions_.push_back(instr);
}
- for (std::set<int>::const_iterator i = virtual_registers.begin();
- i != virtual_registers.end(); ++i) {
- int virtual_register = *i;
- if (sequence.IsDouble(virtual_register)) {
+ for (auto i : s.virtual_registers_) {
+ int const virtual_register = i.second;
+ if (sequence.IsFloat(virtual_register)) {
EXPECT_FALSE(sequence.IsReference(virtual_register));
s.doubles_.insert(virtual_register);
}
if (sequence.IsReference(virtual_register)) {
- EXPECT_FALSE(sequence.IsDouble(virtual_register));
+ EXPECT_FALSE(sequence.IsFloat(virtual_register));
s.references_.insert(virtual_register);
}
}
@@ -137,8 +123,7 @@
if (!operand->IsUnallocated()) return false;
const UnallocatedOperand* unallocated = UnallocatedOperand::cast(operand);
if (!unallocated->HasFixedRegisterPolicy()) return false;
- const int index = Register::ToAllocationIndex(reg);
- return unallocated->fixed_register_index() == index;
+ return unallocated->fixed_register_index() == reg.code();
}
@@ -158,16 +143,25 @@
}
+const FrameStateFunctionInfo*
+InstructionSelectorTest::StreamBuilder::GetFrameStateFunctionInfo(
+ int parameter_count, int local_count) {
+ return common()->CreateFrameStateFunctionInfo(
+ FrameStateType::kJavaScriptFunction, parameter_count, local_count,
+ Handle<SharedFunctionInfo>(), CALL_MAINTAINS_NATIVE_CONTEXT);
+}
+
+
// -----------------------------------------------------------------------------
// Return.
TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) {
const float kValue = 4.2f;
- StreamBuilder m(this, kMachFloat32);
+ StreamBuilder m(this, MachineType::Float32());
m.Return(m.Float32Constant(kValue));
Stream s = m.Build(kAllInstructions);
- ASSERT_EQ(2U, s.size());
+ ASSERT_EQ(3U, s.size());
EXPECT_EQ(kArchNop, s[0]->arch_opcode());
ASSERT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind());
EXPECT_FLOAT_EQ(kValue, s.ToFloat32(s[0]->OutputAt(0)));
@@ -177,10 +171,10 @@
TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
- StreamBuilder m(this, kMachInt32, kMachInt32);
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Parameter(0));
Stream s = m.Build(kAllInstructions);
- ASSERT_EQ(2U, s.size());
+ ASSERT_EQ(3U, s.size());
EXPECT_EQ(kArchNop, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kArchRet, s[1]->arch_opcode());
@@ -189,10 +183,10 @@
TARGET_TEST_F(InstructionSelectorTest, ReturnZero) {
- StreamBuilder m(this, kMachInt32);
+ StreamBuilder m(this, MachineType::Int32());
m.Return(m.Int32Constant(0));
Stream s = m.Build(kAllInstructions);
- ASSERT_EQ(2U, s.size());
+ ASSERT_EQ(3U, s.size());
EXPECT_EQ(kArchNop, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(InstructionOperand::CONSTANT, s[0]->OutputAt(0)->kind());
@@ -207,10 +201,11 @@
TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) {
- StreamBuilder m(this, kMachInt32, kMachFloat64);
- m.Return(m.TruncateFloat64ToInt32(m.Parameter(0)));
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Float64());
+ m.Return(
+ m.TruncateFloat64ToInt32(TruncationMode::kJavaScript, m.Parameter(0)));
Stream s = m.Build(kAllInstructions);
- ASSERT_EQ(3U, s.size());
+ ASSERT_EQ(4U, s.size());
EXPECT_EQ(kArchNop, s[0]->arch_opcode());
EXPECT_EQ(kArchTruncateDoubleToI, s[1]->arch_opcode());
EXPECT_EQ(1U, s[1]->InputCount());
@@ -224,7 +219,7 @@
TARGET_TEST_F(InstructionSelectorTest, DoubleParameter) {
- StreamBuilder m(this, kMachFloat64, kMachFloat64);
+ StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
Node* param = m.Parameter(0);
m.Return(param);
Stream s = m.Build(kAllInstructions);
@@ -233,7 +228,7 @@
TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged());
Node* param = m.Parameter(0);
m.Return(param);
Stream s = m.Build(kAllInstructions);
@@ -242,16 +237,17 @@
// -----------------------------------------------------------------------------
-// Finish.
+// FinishRegion.
-TARGET_TEST_F(InstructionSelectorTest, Finish) {
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
+TARGET_TEST_F(InstructionSelectorTest, FinishRegion) {
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged());
Node* param = m.Parameter(0);
- Node* finish = m.NewNode(m.common()->Finish(1), param, m.graph()->start());
+ Node* finish =
+ m.AddNode(m.common()->FinishRegion(), param, m.graph()->start());
m.Return(finish);
Stream s = m.Build(kAllInstructions);
- ASSERT_EQ(3U, s.size());
+ ASSERT_EQ(4U, s.size());
EXPECT_EQ(kArchNop, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->OutputCount());
ASSERT_TRUE(s[0]->Output()->IsUnallocated());
@@ -281,14 +277,14 @@
StreamBuilder m(this, type, type, type);
Node* param0 = m.Parameter(0);
Node* param1 = m.Parameter(1);
- MLabel a, b, c;
+ RawMachineLabel a, b, c;
m.Branch(m.Int32Constant(0), &a, &b);
m.Bind(&a);
m.Goto(&c);
m.Bind(&b);
m.Goto(&c);
m.Bind(&c);
- Node* phi = m.Phi(type, param0, param1);
+ Node* phi = m.Phi(type.representation(), param0, param1);
m.Return(phi);
Stream s = m.Build(kAllInstructions);
EXPECT_EQ(s.IsDouble(phi), s.IsDouble(param0));
@@ -301,14 +297,14 @@
StreamBuilder m(this, type, type, type);
Node* param0 = m.Parameter(0);
Node* param1 = m.Parameter(1);
- MLabel a, b, c;
+ RawMachineLabel a, b, c;
m.Branch(m.Int32Constant(1), &a, &b);
m.Bind(&a);
m.Goto(&c);
m.Bind(&b);
m.Goto(&c);
m.Bind(&c);
- Node* phi = m.Phi(type, param0, param1);
+ Node* phi = m.Phi(type.representation(), param0, param1);
m.Return(phi);
Stream s = m.Build(kAllInstructions);
EXPECT_EQ(s.IsReference(phi), s.IsReference(param0));
@@ -316,11 +312,14 @@
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorPhiTest,
- ::testing::Values(kMachFloat64, kMachInt8, kMachUint8,
- kMachInt16, kMachUint16, kMachInt32,
- kMachUint32, kMachInt64, kMachUint64,
- kMachPtr, kMachAnyTagged));
+INSTANTIATE_TEST_CASE_P(
+ InstructionSelectorTest, InstructionSelectorPhiTest,
+ ::testing::Values(MachineType::Float64(), MachineType::Int8(),
+ MachineType::Uint8(), MachineType::Int16(),
+ MachineType::Uint16(), MachineType::Int32(),
+ MachineType::Uint32(), MachineType::Int64(),
+ MachineType::Uint64(), MachineType::Pointer(),
+ MachineType::AnyTagged()));
// -----------------------------------------------------------------------------
@@ -328,14 +327,15 @@
TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
- StreamBuilder m1(this, kMachInt32, kMachPtr);
+ StreamBuilder m1(this, MachineType::Int32(), MachineType::Pointer());
Node* p1 = m1.Parameter(0);
- m1.Return(m1.Load(kMachInt32, p1, m1.Int32Constant(0)));
+ m1.Return(m1.Load(MachineType::Int32(), p1, m1.Int32Constant(0)));
Stream s1 = m1.Build(kAllInstructions);
- StreamBuilder m2(this, kMachInt32, kMachPtr);
+ StreamBuilder m2(this, MachineType::Int32(), MachineType::Pointer());
Node* p2 = m2.Parameter(0);
- m2.Return(m2.NewNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
- m2.NewNode(m2.common()->ValueEffect(1), p2)));
+ m2.Return(m2.AddNode(
+ m2.machine()->Load(MachineType::Int32()), p2, m2.Int32Constant(0),
+ m2.AddNode(m2.common()->BeginRegion(), m2.graph()->start())));
Stream s2 = m2.Build(kAllInstructions);
EXPECT_LE(3U, s1.size());
ASSERT_EQ(s1.size(), s2.size());
@@ -354,8 +354,8 @@
TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
- kMachAnyTagged);
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
+ MachineType::AnyTagged(), MachineType::AnyTagged());
BailoutId bailout_id(42);
@@ -363,16 +363,28 @@
Node* receiver = m.Parameter(1);
Node* context = m.Parameter(2);
- Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1));
- Node* locals = m.NewNode(m.common()->StateValues(0));
- Node* stack = m.NewNode(m.common()->StateValues(0));
- Node* context_dummy = m.Int32Constant(0);
+ ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone());
+ ZoneVector<MachineType> empty_types(zone());
- Node* state_node = m.NewNode(
- m.common()->FrameState(JS_FRAME, bailout_id,
- OutputFrameStateCombine::Push()),
- parameters, locals, stack, context_dummy, m.UndefinedConstant());
- Node* call = m.CallJS0(function_node, receiver, context, state_node);
+ CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
+ zone(), false, 1, CallDescriptor::kNeedsFrameState);
+
+ // Build frame state for the state before the call.
+ Node* parameters =
+ m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(1));
+ Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types));
+ Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types));
+ Node* context_sentinel = m.Int32Constant(0);
+ Node* state_node = m.AddNode(
+ m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(),
+ m.GetFrameStateFunctionInfo(1, 0)),
+ parameters, locals, stack, context_sentinel, function_node,
+ m.UndefinedConstant());
+
+ // Build the call.
+ Node* args[] = {receiver, m.UndefinedConstant(), m.Int32Constant(1), context};
+ Node* call =
+ m.CallNWithFrameState(descriptor, function_node, args, state_node);
m.Return(call);
Stream s = m.Build(kAllExceptNopInstructions);
@@ -392,9 +404,9 @@
}
-TARGET_TEST_F(InstructionSelectorTest, CallFunctionStubWithDeopt) {
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
- kMachAnyTagged);
+TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) {
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
+ MachineType::AnyTagged(), MachineType::AnyTagged());
BailoutId bailout_id_before(42);
@@ -403,21 +415,33 @@
Node* receiver = m.Parameter(1);
Node* context = m.Int32Constant(1); // Context is ignored.
- // Build frame state for the state before the call.
- Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43));
- Node* locals = m.NewNode(m.common()->StateValues(1), m.Float64Constant(0.5));
- Node* stack = m.NewNode(m.common()->StateValues(1), m.UndefinedConstant());
+ ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone());
+ ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone());
+ ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone());
+ Callable callable = CodeFactory::ToObject(isolate());
+ CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
+ isolate(), zone(), callable.descriptor(), 1,
+ CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
+
+ // Build frame state for the state before the call.
+ Node* parameters =
+ m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
+ Node* locals = m.AddNode(m.common()->TypedStateValues(&float64_type),
+ m.Float64Constant(0.5));
+ Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type),
+ m.UndefinedConstant());
Node* context_sentinel = m.Int32Constant(0);
- Node* frame_state_before = m.NewNode(
- m.common()->FrameState(JS_FRAME, bailout_id_before,
- OutputFrameStateCombine::Push()),
- parameters, locals, stack, context_sentinel, m.UndefinedConstant());
+ Node* state_node = m.AddNode(
+ m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
+ m.GetFrameStateFunctionInfo(1, 1)),
+ parameters, locals, stack, context_sentinel, function_node,
+ m.UndefinedConstant());
// Build the call.
- Node* call = m.CallFunctionStub0(function_node, receiver, context,
- frame_state_before, CALL_AS_METHOD);
-
+ Node* args[] = {function_node, receiver, context};
+ Node* stub_code = m.HeapConstant(callable.code());
+ Node* call = m.CallNWithFrameState(descriptor, stub_code, args, state_node);
m.Return(call);
Stream s = m.Build(kAllExceptNopInstructions);
@@ -436,7 +460,7 @@
size_t num_operands =
1 + // Code object.
1 +
- 4 + // Frame state deopt id + one input for each value in frame state.
+ 5 + // Frame state deopt id + one input for each value in frame state.
1 + // Function.
1; // Context.
ASSERT_EQ(num_operands, call_instr->InputCount());
@@ -454,21 +478,25 @@
EXPECT_EQ(1u, desc_before->parameters_count());
EXPECT_EQ(1u, desc_before->locals_count());
EXPECT_EQ(1u, desc_before->stack_count());
- EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2)));
- EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3))); // This should be a context.
+ EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(3)));
+ EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(4))); // This should be a context.
// We inserted 0 here.
- EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(4)));
- EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(5))->IsUndefined());
- EXPECT_EQ(kMachInt32, desc_before->GetType(0));
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(1)); // context is always
- // tagged/any.
- EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(3));
+ EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(5)));
+ EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(6))->IsUndefined());
+ EXPECT_EQ(MachineType::AnyTagged(),
+ desc_before->GetType(0)); // function is always
+ // tagged/any.
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1));
+ EXPECT_EQ(MachineType::AnyTagged(),
+ desc_before->GetType(2)); // context is always
+ // tagged/any.
+ EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3));
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(4));
// Function.
- EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(6)));
+ EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(7)));
// Context.
- EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(7)));
+ EXPECT_EQ(s.ToVreg(context), s.ToVreg(call_instr->InputAt(8)));
EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
@@ -476,10 +504,9 @@
}
-TARGET_TEST_F(InstructionSelectorTest,
- CallFunctionStubDeoptRecursiveFrameState) {
- StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
- kMachAnyTagged);
+TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) {
+ StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
+ MachineType::AnyTagged(), MachineType::AnyTagged());
BailoutId bailout_id_before(42);
BailoutId bailout_id_parent(62);
@@ -488,32 +515,46 @@
Node* function_node = m.Parameter(0);
Node* receiver = m.Parameter(1);
Node* context = m.Int32Constant(66);
+ Node* context2 = m.Int32Constant(46);
+
+ ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone());
+ ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone());
+ ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone());
+
+ Callable callable = CodeFactory::ToObject(isolate());
+ CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
+ isolate(), zone(), callable.descriptor(), 1,
+ CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
// Build frame state for the state before the call.
- Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(63));
- Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(64));
- Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(65));
- Node* frame_state_parent =
- m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_parent,
- OutputFrameStateCombine::Ignore()),
- parameters, locals, stack, context, m.UndefinedConstant());
+ Node* parameters =
+ m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(63));
+ Node* locals =
+ m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(64));
+ Node* stack =
+ m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(65));
+ Node* frame_state_parent = m.AddNode(
+ m.common()->FrameState(bailout_id_parent,
+ OutputFrameStateCombine::Ignore(),
+ m.GetFrameStateFunctionInfo(1, 1)),
+ parameters, locals, stack, context, function_node, m.UndefinedConstant());
- Node* context2 = m.Int32Constant(46);
Node* parameters2 =
- m.NewNode(m.common()->StateValues(1), m.Int32Constant(43));
- Node* locals2 =
- m.NewNode(m.common()->StateValues(1), m.Float64Constant(0.25));
- Node* stack2 = m.NewNode(m.common()->StateValues(2), m.Int32Constant(44),
- m.Int32Constant(45));
- Node* frame_state_before =
- m.NewNode(m.common()->FrameState(JS_FRAME, bailout_id_before,
- OutputFrameStateCombine::Push()),
- parameters2, locals2, stack2, context2, frame_state_parent);
+ m.AddNode(m.common()->TypedStateValues(&int32_type), m.Int32Constant(43));
+ Node* locals2 = m.AddNode(m.common()->TypedStateValues(&float64_type),
+ m.Float64Constant(0.25));
+ Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type),
+ m.Int32Constant(44), m.Int32Constant(45));
+ Node* state_node = m.AddNode(
+ m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
+ m.GetFrameStateFunctionInfo(1, 1)),
+ parameters2, locals2, stack2, context2, function_node,
+ frame_state_parent);
// Build the call.
- Node* call = m.CallFunctionStub0(function_node, receiver, context2,
- frame_state_before, CALL_AS_METHOD);
-
+ Node* args[] = {function_node, receiver, context2};
+ Node* stub_code = m.HeapConstant(callable.code());
+ Node* call = m.CallNWithFrameState(descriptor, stub_code, args, state_node);
m.Return(call);
Stream s = m.Build(kAllExceptNopInstructions);
@@ -532,8 +573,8 @@
size_t num_operands =
1 + // Code object.
1 + // Frame state deopt id
- 5 + // One input for each value in frame state + context.
- 4 + // One input for each value in the parent frame state + context.
+ 6 + // One input for each value in frame state + context.
+ 5 + // One input for each value in the parent frame state + context.
1 + // Function.
1; // Context.
EXPECT_EQ(num_operands, call_instr->InputCount());
@@ -550,34 +591,36 @@
EXPECT_EQ(1u, desc_before_outer->locals_count());
EXPECT_EQ(1u, desc_before_outer->stack_count());
// Values from parent environment.
- EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(2)));
- EXPECT_EQ(kMachInt32, desc_before_outer->GetType(0));
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0));
+ EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(3)));
+ EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(1));
// Context:
- EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(3)));
- EXPECT_EQ(kMachAnyTagged, desc_before_outer->GetType(1));
- EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(4)));
- EXPECT_EQ(kMachInt32, desc_before_outer->GetType(2));
- EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(5)));
- EXPECT_EQ(kMachInt32, desc_before_outer->GetType(3));
+ EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(4)));
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before_outer->GetType(2));
+ EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(5)));
+ EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(3));
+ EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(6)));
+ EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(4));
// Values from the nested frame.
EXPECT_EQ(1u, desc_before->parameters_count());
EXPECT_EQ(1u, desc_before->locals_count());
EXPECT_EQ(2u, desc_before->stack_count());
- EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(6)));
- EXPECT_EQ(kMachInt32, desc_before->GetType(0));
- EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(7)));
- EXPECT_EQ(kMachAnyTagged, desc_before->GetType(1));
- EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(8)));
- EXPECT_EQ(kMachFloat64, desc_before->GetType(2));
- EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(9)));
- EXPECT_EQ(kMachInt32, desc_before->GetType(3));
- EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(10)));
- EXPECT_EQ(kMachInt32, desc_before->GetType(4));
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0));
+ EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(8)));
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1));
+ EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(9)));
+ EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(2));
+ EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(10)));
+ EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3));
+ EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(11)));
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(4));
+ EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(12)));
+ EXPECT_EQ(MachineType::Int32(), desc_before->GetType(5));
// Function.
- EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(11)));
+ EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(13)));
// Context.
- EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
+ EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14)));
// Continuation.
EXPECT_EQ(kArchRet, s[index++]->arch_opcode());