| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
| 7 | 7 |
| 8 #include "src/compiler/code-generator.h" | 8 #include "src/compiler/code-generator.h" |
| 9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual ~DeoptCodegenTester() {} | 59 virtual ~DeoptCodegenTester() {} |
| 60 | 60 |
| 61 void GenerateCodeFromSchedule(Schedule* schedule) { | 61 void GenerateCodeFromSchedule(Schedule* schedule) { |
| 62 OFStream os(stdout); | 62 OFStream os(stdout); |
| 63 if (FLAG_trace_turbo) { | 63 if (FLAG_trace_turbo) { |
| 64 os << *schedule; | 64 os << *schedule; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Initialize the codegen and generate code. | |
| 68 Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info); | 67 Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info); |
| 69 InstructionBlocks* instruction_blocks = | 68 Pipeline pipeline(&info); |
| 70 TestInstrSeq::InstructionBlocksFor(scope_->main_zone(), schedule); | 69 result_code = |
| 71 code = new (scope_->main_zone()) | 70 pipeline.GenerateCodeForMachineGraph(linkage, graph, schedule); |
| 72 TestInstrSeq(scope_->main_zone(), instruction_blocks); | |
| 73 SourcePositionTable source_positions(graph); | |
| 74 InstructionSelector selector(scope_->main_zone(), graph, linkage, code, | |
| 75 schedule, &source_positions); | |
| 76 selector.SelectInstructions(); | |
| 77 | |
| 78 if (FLAG_trace_turbo) { | |
| 79 PrintableInstructionSequence printable = { | |
| 80 RegisterConfiguration::ArchDefault(), code}; | |
| 81 os << "----- Instruction sequence before register allocation -----\n" | |
| 82 << printable; | |
| 83 } | |
| 84 | |
| 85 Frame frame; | |
| 86 RegisterAllocator allocator(RegisterConfiguration::ArchDefault(), | |
| 87 scope_->main_zone(), &frame, code); | |
| 88 CHECK(allocator.Allocate()); | |
| 89 | |
| 90 if (FLAG_trace_turbo) { | |
| 91 PrintableInstructionSequence printable = { | |
| 92 RegisterConfiguration::ArchDefault(), code}; | |
| 93 os << "----- Instruction sequence after register allocation -----\n" | |
| 94 << printable; | |
| 95 } | |
| 96 | |
| 97 compiler::CodeGenerator generator(&frame, linkage, code, &info); | |
| 98 result_code = generator.GenerateCode(); | |
| 99 | 71 |
| 100 #ifdef OBJECT_PRINT | 72 #ifdef OBJECT_PRINT |
| 101 if (FLAG_print_opt_code || FLAG_trace_turbo) { | 73 if (FLAG_print_opt_code || FLAG_trace_turbo) { |
| 102 result_code->Print(); | 74 result_code->Print(); |
| 103 } | 75 } |
| 104 #endif | 76 #endif |
| 105 } | 77 } |
| 106 | 78 |
| 107 Zone* zone() { return scope_->main_zone(); } | 79 Zone* zone() { return scope_->main_zone(); } |
| 108 | 80 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 Handle<Object> result; | 288 Handle<Object> result; |
| 317 bool has_pending_exception = | 289 bool has_pending_exception = |
| 318 !Execution::Call(isolate, t.function, | 290 !Execution::Call(isolate, t.function, |
| 319 isolate->factory()->undefined_value(), 0, NULL, | 291 isolate->factory()->undefined_value(), 0, NULL, |
| 320 false).ToHandle(&result); | 292 false).ToHandle(&result); |
| 321 CHECK(!has_pending_exception); | 293 CHECK(!has_pending_exception); |
| 322 CHECK(result->SameValue(Smi::FromInt(42))); | 294 CHECK(result->SameValue(Smi::FromInt(42))); |
| 323 } | 295 } |
| 324 | 296 |
| 325 #endif | 297 #endif |
| OLD | NEW |