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" | 12 #include "src/rewriter.h" |
14 #include "src/scopes.h" | 13 #include "src/scopes.h" |
15 | 14 |
16 using namespace v8::internal; | 15 using namespace v8::internal; |
17 using namespace v8::internal::compiler; | 16 using namespace v8::internal::compiler; |
18 | 17 |
19 TEST(PipelineAdd) { | 18 TEST(PipelineAdd) { |
20 InitializedHandleScope handles; | 19 InitializedHandleScope handles; |
21 const char* source = "(function(a,b) { return a + b; })"; | 20 const char* source = "(function(a,b) { return a + b; })"; |
22 Handle<JSFunction> function = v8::Utils::OpenHandle( | 21 Handle<JSFunction> function = v8::Utils::OpenHandle( |
23 *v8::Handle<v8::Function>::Cast(CompileRun(source))); | 22 *v8::Handle<v8::Function>::Cast(CompileRun(source))); |
24 CompilationInfoWithZone info(function); | 23 CompilationInfoWithZone info(function); |
25 | 24 |
26 CHECK(Parser::Parse(&info)); | 25 CHECK(Parser::Parse(&info)); |
27 CHECK(Rewriter::Rewrite(&info)); | 26 CHECK(Rewriter::Rewrite(&info)); |
28 CHECK(Scope::Analyze(&info)); | 27 CHECK(Scope::Analyze(&info)); |
29 CHECK(AstNumbering::Renumber(info.function(), info.zone())); | |
30 CHECK_NE(NULL, info.scope()); | 28 CHECK_NE(NULL, info.scope()); |
31 | 29 |
32 Pipeline pipeline(&info); | 30 Pipeline pipeline(&info); |
33 #if V8_TURBOFAN_TARGET | 31 #if V8_TURBOFAN_TARGET |
34 Handle<Code> code = pipeline.GenerateCode(); | 32 Handle<Code> code = pipeline.GenerateCode(); |
35 CHECK(Pipeline::SupportedTarget()); | 33 CHECK(Pipeline::SupportedTarget()); |
36 CHECK(!code.is_null()); | 34 CHECK(!code.is_null()); |
37 #else | 35 #else |
38 USE(pipeline); | 36 USE(pipeline); |
39 #endif | 37 #endif |
40 } | 38 } |
OLD | NEW |