| Index: test/cctest/compiler/test-codegen-deopt.cc
|
| diff --git a/test/cctest/compiler/test-codegen-deopt.cc b/test/cctest/compiler/test-codegen-deopt.cc
|
| index e11fc552d8ed561771615f55c7e77234792b927c..8d9d329022eab5088ca0a8fa0f0e39b6c389056a 100644
|
| --- a/test/cctest/compiler/test-codegen-deopt.cc
|
| +++ b/test/cctest/compiler/test-codegen-deopt.cc
|
| @@ -20,6 +20,7 @@
|
| #include "src/parser.h"
|
| #include "src/rewriter.h"
|
|
|
| +#include "test/cctest/compiler/c-signature.h"
|
| #include "test/cctest/compiler/function-tester.h"
|
|
|
| using namespace v8::internal;
|
| @@ -64,7 +65,9 @@ class DeoptCodegenTester {
|
|
|
| void GenerateCodeFromSchedule(Schedule* schedule) {
|
| OFStream os(stdout);
|
| - os << *schedule;
|
| + if (FLAG_trace_turbo) {
|
| + os << *schedule;
|
| + }
|
|
|
| // Initialize the codegen and generate code.
|
| Linkage* linkage = new (scope_->main_zone()) Linkage(&info);
|
| @@ -74,21 +77,25 @@ class DeoptCodegenTester {
|
| InstructionSelector selector(code, &source_positions);
|
| selector.SelectInstructions();
|
|
|
| - os << "----- Instruction sequence before register allocation -----\n"
|
| - << *code;
|
| + if (FLAG_trace_turbo) {
|
| + os << "----- Instruction sequence before register allocation -----\n"
|
| + << *code;
|
| + }
|
|
|
| RegisterAllocator allocator(code);
|
| CHECK(allocator.Allocate());
|
|
|
| - os << "----- Instruction sequence after register allocation -----\n"
|
| - << *code;
|
| + if (FLAG_trace_turbo) {
|
| + os << "----- Instruction sequence after register allocation -----\n"
|
| + << *code;
|
| + }
|
|
|
| compiler::CodeGenerator generator(code);
|
| result_code = generator.GenerateCode();
|
|
|
| -#ifdef DEBUG
|
| - result_code->Print();
|
| -#endif
|
| + if (FLAG_print_opt_code || FLAG_trace_turbo) {
|
| + result_code->Print();
|
| + }
|
| }
|
|
|
| Zone* zone() { return scope_->main_zone(); }
|
| @@ -122,11 +129,8 @@ class TrivialDeoptCodegenTester : public DeoptCodegenTester {
|
| // deopt();
|
| // }
|
|
|
| - MachineType parameter_reps[] = {kMachAnyTagged};
|
| - MachineCallDescriptorBuilder descriptor_builder(kMachAnyTagged, 1,
|
| - parameter_reps);
|
| -
|
| - RawMachineAssembler m(graph, &descriptor_builder);
|
| + CSignature1<Object*, Object*> sig;
|
| + RawMachineAssembler m(graph, &sig);
|
|
|
| Handle<Object> undef_object =
|
| Handle<Object>(isolate->heap()->undefined_value(), isolate);
|
| @@ -140,6 +144,10 @@ class TrivialDeoptCodegenTester : public DeoptCodegenTester {
|
| PrintableUnique<Object>::CreateUninitialized(zone(), deopt_function);
|
| Node* deopt_fun_node = m.NewNode(common.HeapConstant(deopt_fun_constant));
|
|
|
| + Handle<Context> context(deopt_function->context(), isolate);
|
| + PrintableUnique<Object> context_constant =
|
| + PrintableUnique<Object>::CreateUninitialized(zone(), context);
|
| + Node* context_node = m.NewNode(common.HeapConstant(context_constant));
|
|
|
| bailout_id = GetCallBailoutId();
|
| Node* parameters = m.NewNode(common.StateValues(1), undef_node);
|
| @@ -149,7 +157,7 @@ class TrivialDeoptCodegenTester : public DeoptCodegenTester {
|
| Node* state_node = m.NewNode(common.FrameState(bailout_id, kIgnoreOutput),
|
| parameters, locals, stack, undef_node);
|
|
|
| - m.CallJS0(deopt_fun_node, undef_node, state_node);
|
| + m.CallJS0(deopt_fun_node, undef_node, context_node, state_node);
|
|
|
| m.Return(undef_node);
|
|
|
| @@ -238,11 +246,8 @@ class TrivialRuntimeDeoptCodegenTester : public DeoptCodegenTester {
|
| // %DeoptimizeFunction(foo);
|
| // }
|
|
|
| - MachineType parameter_reps[] = {kMachAnyTagged};
|
| - MachineCallDescriptorBuilder descriptor_builder(kMachAnyTagged, 2,
|
| - parameter_reps);
|
| -
|
| - RawMachineAssembler m(graph, &descriptor_builder);
|
| + CSignature1<Object*, Object*> sig;
|
| + RawMachineAssembler m(graph, &sig);
|
|
|
| Handle<Object> undef_object =
|
| Handle<Object>(isolate->heap()->undefined_value(), isolate);
|
| @@ -254,6 +259,11 @@ class TrivialRuntimeDeoptCodegenTester : public DeoptCodegenTester {
|
| PrintableUnique<Object>::CreateUninitialized(zone(), function);
|
| Node* this_fun_node = m.NewNode(common.HeapConstant(this_fun_constant));
|
|
|
| + Handle<Context> context(function->context(), isolate);
|
| + PrintableUnique<Object> context_constant =
|
| + PrintableUnique<Object>::CreateUninitialized(zone(), context);
|
| + Node* context_node = m.NewNode(common.HeapConstant(context_constant));
|
| +
|
| bailout_id = GetCallBailoutId();
|
| Node* parameters = m.NewNode(common.StateValues(1), undef_node);
|
| Node* locals = m.NewNode(common.StateValues(0));
|
| @@ -262,7 +272,8 @@ class TrivialRuntimeDeoptCodegenTester : public DeoptCodegenTester {
|
| Node* state_node = m.NewNode(common.FrameState(bailout_id, kIgnoreOutput),
|
| parameters, locals, stack, undef_node);
|
|
|
| - m.CallRuntime1(Runtime::kDeoptimizeFunction, this_fun_node, state_node);
|
| + m.CallRuntime1(Runtime::kDeoptimizeFunction, this_fun_node, context_node,
|
| + state_node);
|
|
|
| m.Return(undef_node);
|
|
|
|
|