| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 CHECK(Parser::Parse(&info)); | 49 CHECK(Parser::Parse(&info)); |
| 50 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); | 50 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); |
| 51 CHECK(Compiler::Analyze(&info)); | 51 CHECK(Compiler::Analyze(&info)); |
| 52 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 52 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
| 53 | 53 |
| 54 DCHECK(info.shared_info()->has_deoptimization_support()); | 54 DCHECK(info.shared_info()->has_deoptimization_support()); |
| 55 | 55 |
| 56 graph = new (scope_->main_zone()) Graph(scope_->main_zone()); | 56 graph = new (scope_->main_zone()) Graph(scope_->main_zone()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual ~DeoptCodegenTester() { delete code; } | 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. | 67 // Initialize the codegen and generate code. |
| 68 Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info); | 68 Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info); |
| 69 InstructionBlocks* instruction_blocks = | 69 InstructionBlocks* instruction_blocks = |
| 70 TestInstrSeq::InstructionBlocksFor(scope_->main_zone(), schedule); | 70 TestInstrSeq::InstructionBlocksFor(scope_->main_zone(), schedule); |
| 71 code = new TestInstrSeq(scope_->main_zone(), instruction_blocks); | 71 code = new (scope_->main_zone()) |
| 72 TestInstrSeq(scope_->main_zone(), instruction_blocks); |
| 72 SourcePositionTable source_positions(graph); | 73 SourcePositionTable source_positions(graph); |
| 73 InstructionSelector selector(scope_->main_zone(), graph, linkage, code, | 74 InstructionSelector selector(scope_->main_zone(), graph, linkage, code, |
| 74 schedule, &source_positions); | 75 schedule, &source_positions); |
| 75 selector.SelectInstructions(); | 76 selector.SelectInstructions(); |
| 76 | 77 |
| 77 if (FLAG_trace_turbo) { | 78 if (FLAG_trace_turbo) { |
| 78 PrintableInstructionSequence printable = { | 79 PrintableInstructionSequence printable = { |
| 79 RegisterConfiguration::ArchDefault(), code}; | 80 RegisterConfiguration::ArchDefault(), code}; |
| 80 os << "----- Instruction sequence before register allocation -----\n" | 81 os << "----- Instruction sequence before register allocation -----\n" |
| 81 << printable; | 82 << printable; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 Handle<Object> result; | 316 Handle<Object> result; |
| 316 bool has_pending_exception = | 317 bool has_pending_exception = |
| 317 !Execution::Call(isolate, t.function, | 318 !Execution::Call(isolate, t.function, |
| 318 isolate->factory()->undefined_value(), 0, NULL, | 319 isolate->factory()->undefined_value(), 0, NULL, |
| 319 false).ToHandle(&result); | 320 false).ToHandle(&result); |
| 320 CHECK(!has_pending_exception); | 321 CHECK(!has_pending_exception); |
| 321 CHECK(result->SameValue(Smi::FromInt(42))); | 322 CHECK(result->SameValue(Smi::FromInt(42))); |
| 322 } | 323 } |
| 323 | 324 |
| 324 #endif | 325 #endif |
| OLD | NEW |