| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 virtual ~DeoptCodegenTester() { delete code; } | 60 virtual ~DeoptCodegenTester() { delete code; } |
| 61 | 61 |
| 62 void GenerateCodeFromSchedule(Schedule* schedule) { | 62 void GenerateCodeFromSchedule(Schedule* schedule) { |
| 63 OFStream os(stdout); | 63 OFStream os(stdout); |
| 64 if (FLAG_trace_turbo) { | 64 if (FLAG_trace_turbo) { |
| 65 os << *schedule; | 65 os << *schedule; |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Initialize the codegen and generate code. | 68 // Initialize the codegen and generate code. |
| 69 Linkage* linkage = new (scope_->main_zone()) Linkage(&info); | 69 Linkage* linkage = new (scope_->main_zone()) Linkage(info.zone(), &info); |
| 70 code = new v8::internal::compiler::InstructionSequence(scope_->main_zone(), | 70 code = new v8::internal::compiler::InstructionSequence(scope_->main_zone(), |
| 71 graph, schedule); | 71 graph, schedule); |
| 72 SourcePositionTable source_positions(graph); | 72 SourcePositionTable source_positions(graph); |
| 73 InstructionSelector selector(scope_->main_zone(), linkage, code, schedule, | 73 InstructionSelector selector(scope_->main_zone(), linkage, code, schedule, |
| 74 &source_positions); | 74 &source_positions); |
| 75 selector.SelectInstructions(); | 75 selector.SelectInstructions(); |
| 76 | 76 |
| 77 if (FLAG_trace_turbo) { | 77 if (FLAG_trace_turbo) { |
| 78 os << "----- Instruction sequence before register allocation -----\n" | 78 os << "----- Instruction sequence before register allocation -----\n" |
| 79 << *code; | 79 << *code; |
| 80 } | 80 } |
| 81 | 81 |
| 82 Frame frame; | 82 Frame frame; |
| 83 RegisterAllocator allocator(scope_->main_zone(), &frame, &info, code); | 83 RegisterAllocator allocator(scope_->main_zone(), &frame, &info, code); |
| 84 CHECK(allocator.Allocate()); | 84 CHECK(allocator.Allocate()); |
| 85 | 85 |
| 86 if (FLAG_trace_turbo) { | 86 if (FLAG_trace_turbo) { |
| 87 os << "----- Instruction sequence after register allocation -----\n" | 87 os << "----- Instruction sequence after register allocation -----\n" |
| 88 << *code; | 88 << *code; |
| 89 } | 89 } |
| 90 | 90 |
| 91 compiler::CodeGenerator generator(&frame, linkage, code); | 91 compiler::CodeGenerator generator(&frame, linkage, code, &info); |
| 92 result_code = generator.GenerateCode(); | 92 result_code = generator.GenerateCode(); |
| 93 | 93 |
| 94 #ifdef OBJECT_PRINT | 94 #ifdef OBJECT_PRINT |
| 95 if (FLAG_print_opt_code || FLAG_trace_turbo) { | 95 if (FLAG_print_opt_code || FLAG_trace_turbo) { |
| 96 result_code->Print(); | 96 result_code->Print(); |
| 97 } | 97 } |
| 98 #endif | 98 #endif |
| 99 } | 99 } |
| 100 | 100 |
| 101 Zone* zone() { return scope_->main_zone(); } | 101 Zone* zone() { return scope_->main_zone(); } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 Handle<Object> result; | 310 Handle<Object> result; |
| 311 bool has_pending_exception = | 311 bool has_pending_exception = |
| 312 !Execution::Call(isolate, t.function, | 312 !Execution::Call(isolate, t.function, |
| 313 isolate->factory()->undefined_value(), 0, NULL, | 313 isolate->factory()->undefined_value(), 0, NULL, |
| 314 false).ToHandle(&result); | 314 false).ToHandle(&result); |
| 315 CHECK(!has_pending_exception); | 315 CHECK(!has_pending_exception); |
| 316 CHECK(result->SameValue(Smi::FromInt(42))); | 316 CHECK(result->SameValue(Smi::FromInt(42))); |
| 317 } | 317 } |
| 318 | 318 |
| 319 #endif | 319 #endif |
| OLD | NEW |