| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 TestInstrSeq(scope_->main_zone(), instruction_blocks); |
| 72 SourcePositionTable source_positions(graph); | 72 SourcePositionTable source_positions(graph); |
| 73 InstructionSelector selector(scope_->main_zone(), graph, linkage, code, | 73 InstructionSelector selector(scope_->main_zone(), graph, linkage, code, |
| 74 schedule, &source_positions); | 74 schedule, &source_positions); |
| 75 selector.SelectInstructions(); | 75 selector.SelectInstructions(); |
| 76 | 76 |
| 77 if (FLAG_trace_turbo) { | 77 if (FLAG_trace_turbo) { |
| 78 PrintableInstructionSequence printable = { |
| 79 RegisterConfiguration::ArchDefault(), code}; |
| 78 os << "----- Instruction sequence before register allocation -----\n" | 80 os << "----- Instruction sequence before register allocation -----\n" |
| 79 << *code; | 81 << printable; |
| 80 } | 82 } |
| 81 | 83 |
| 82 Frame frame; | 84 Frame frame; |
| 83 RegisterAllocator allocator(RegisterAllocator::PlatformConfig(), | 85 RegisterAllocator allocator(RegisterConfiguration::ArchDefault(), |
| 84 scope_->main_zone(), &frame, code); | 86 scope_->main_zone(), &frame, code); |
| 85 CHECK(allocator.Allocate()); | 87 CHECK(allocator.Allocate()); |
| 86 | 88 |
| 87 if (FLAG_trace_turbo) { | 89 if (FLAG_trace_turbo) { |
| 90 PrintableInstructionSequence printable = { |
| 91 RegisterConfiguration::ArchDefault(), code}; |
| 88 os << "----- Instruction sequence after register allocation -----\n" | 92 os << "----- Instruction sequence after register allocation -----\n" |
| 89 << *code; | 93 << printable; |
| 90 } | 94 } |
| 91 | 95 |
| 92 compiler::CodeGenerator generator(&frame, linkage, code, &info); | 96 compiler::CodeGenerator generator(&frame, linkage, code, &info); |
| 93 result_code = generator.GenerateCode(); | 97 result_code = generator.GenerateCode(); |
| 94 | 98 |
| 95 #ifdef OBJECT_PRINT | 99 #ifdef OBJECT_PRINT |
| 96 if (FLAG_print_opt_code || FLAG_trace_turbo) { | 100 if (FLAG_print_opt_code || FLAG_trace_turbo) { |
| 97 result_code->Print(); | 101 result_code->Print(); |
| 98 } | 102 } |
| 99 #endif | 103 #endif |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 Handle<Object> result; | 315 Handle<Object> result; |
| 312 bool has_pending_exception = | 316 bool has_pending_exception = |
| 313 !Execution::Call(isolate, t.function, | 317 !Execution::Call(isolate, t.function, |
| 314 isolate->factory()->undefined_value(), 0, NULL, | 318 isolate->factory()->undefined_value(), 0, NULL, |
| 315 false).ToHandle(&result); | 319 false).ToHandle(&result); |
| 316 CHECK(!has_pending_exception); | 320 CHECK(!has_pending_exception); |
| 317 CHECK(result->SameValue(Smi::FromInt(42))); | 321 CHECK(result->SameValue(Smi::FromInt(42))); |
| 318 } | 322 } |
| 319 | 323 |
| 320 #endif | 324 #endif |
| OLD | NEW |