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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
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(linkage, code, schedule, &source_positions); | 73 InstructionSelector selector(scope_->main_zone(), linkage, code, schedule, |
| 74 &source_positions); |
74 selector.SelectInstructions(); | 75 selector.SelectInstructions(); |
75 | 76 |
76 if (FLAG_trace_turbo) { | 77 if (FLAG_trace_turbo) { |
77 os << "----- Instruction sequence before register allocation -----\n" | 78 os << "----- Instruction sequence before register allocation -----\n" |
78 << *code; | 79 << *code; |
79 } | 80 } |
80 | 81 |
81 Frame frame; | 82 Frame frame; |
82 RegisterAllocator allocator(&frame, &info, code); | 83 RegisterAllocator allocator(scope_->main_zone(), &frame, &info, code); |
83 CHECK(allocator.Allocate()); | 84 CHECK(allocator.Allocate()); |
84 | 85 |
85 if (FLAG_trace_turbo) { | 86 if (FLAG_trace_turbo) { |
86 os << "----- Instruction sequence after register allocation -----\n" | 87 os << "----- Instruction sequence after register allocation -----\n" |
87 << *code; | 88 << *code; |
88 } | 89 } |
89 | 90 |
90 compiler::CodeGenerator generator(&frame, linkage, code); | 91 compiler::CodeGenerator generator(&frame, linkage, code); |
91 result_code = generator.GenerateCode(); | 92 result_code = generator.GenerateCode(); |
92 | 93 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 Handle<Object> result; | 310 Handle<Object> result; |
310 bool has_pending_exception = | 311 bool has_pending_exception = |
311 !Execution::Call(isolate, t.function, | 312 !Execution::Call(isolate, t.function, |
312 isolate->factory()->undefined_value(), 0, NULL, | 313 isolate->factory()->undefined_value(), 0, NULL, |
313 false).ToHandle(&result); | 314 false).ToHandle(&result); |
314 CHECK(!has_pending_exception); | 315 CHECK(!has_pending_exception); |
315 CHECK(result->SameValue(Smi::FromInt(42))); | 316 CHECK(result->SameValue(Smi::FromInt(42))); |
316 } | 317 } |
317 | 318 |
318 #endif | 319 #endif |
OLD | NEW |