OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/ast-numbering.h" | |
9 #include "src/compiler.h" | 8 #include "src/compiler.h" |
10 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
11 #include "src/handles.h" | 10 #include "src/handles.h" |
12 #include "src/parser.h" | 11 #include "src/parser.h" |
13 #include "src/rewriter.h" | |
14 #include "src/scopes.h" | |
15 | 12 |
16 using namespace v8::internal; | 13 using namespace v8::internal; |
17 using namespace v8::internal::compiler; | 14 using namespace v8::internal::compiler; |
18 | 15 |
19 TEST(PipelineAdd) { | 16 static void RunPipeline(Zone* zone, const char* source) { |
20 HandleAndZoneScope handles; | |
21 const char* source = "(function(a,b) { return a + b; })"; | |
22 Handle<JSFunction> function = v8::Utils::OpenHandle( | 17 Handle<JSFunction> function = v8::Utils::OpenHandle( |
23 *v8::Handle<v8::Function>::Cast(CompileRun(source))); | 18 *v8::Handle<v8::Function>::Cast(CompileRun(source))); |
24 ParseInfo parse_info(handles.main_zone(), function); | 19 ParseInfo parse_info(zone, function); |
25 CHECK(Compiler::ParseAndAnalyze(&parse_info)); | 20 CHECK(Compiler::ParseAndAnalyze(&parse_info)); |
26 CompilationInfo info(&parse_info); | 21 CompilationInfo info(&parse_info); |
27 | 22 |
28 Pipeline pipeline(&info); | 23 Pipeline pipeline(&info); |
29 #if V8_TURBOFAN_TARGET | 24 #if V8_TURBOFAN_TARGET |
30 Handle<Code> code = pipeline.GenerateCode(); | 25 Handle<Code> code = pipeline.GenerateCode(); |
31 CHECK(Pipeline::SupportedTarget()); | 26 CHECK(Pipeline::SupportedTarget()); |
32 CHECK(!code.is_null()); | 27 CHECK(!code.is_null()); |
33 #else | 28 #else |
34 USE(pipeline); | 29 USE(pipeline); |
35 #endif | 30 #endif |
36 } | 31 } |
| 32 |
| 33 |
| 34 TEST(PipelineTyped) { |
| 35 HandleAndZoneScope handles; |
| 36 FLAG_turbo_types = true; |
| 37 RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); |
| 38 } |
| 39 |
| 40 |
| 41 TEST(PipelineGeneric) { |
| 42 HandleAndZoneScope handles; |
| 43 FLAG_turbo_types = false; |
| 44 RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); |
| 45 } |
OLD | NEW |