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 // TODO(jochen): Remove this after the setting is turned on globally. |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 |
5 #include "src/v8.h" | 8 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
7 | 10 |
8 #include "src/compiler.h" | 11 #include "src/compiler.h" |
9 #include "src/compiler/pipeline.h" | 12 #include "src/compiler/pipeline.h" |
10 #include "src/handles.h" | 13 #include "src/handles.h" |
11 #include "src/parser.h" | 14 #include "src/parser.h" |
12 | 15 |
13 using namespace v8::internal; | 16 using namespace v8::internal; |
14 using namespace v8::internal::compiler; | 17 using namespace v8::internal::compiler; |
15 | 18 |
16 static void RunPipeline(Zone* zone, const char* source) { | 19 static void RunPipeline(Zone* zone, const char* source) { |
17 Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle( | 20 Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle( |
18 *v8::Handle<v8::Function>::Cast(CompileRun(source)))); | 21 *v8::Local<v8::Function>::Cast(CompileRun(source)))); |
19 ParseInfo parse_info(zone, function); | 22 ParseInfo parse_info(zone, function); |
20 CHECK(Compiler::ParseAndAnalyze(&parse_info)); | 23 CHECK(Compiler::ParseAndAnalyze(&parse_info)); |
21 CompilationInfo info(&parse_info); | 24 CompilationInfo info(&parse_info); |
22 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); | 25 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); |
23 | 26 |
24 Pipeline pipeline(&info); | 27 Pipeline pipeline(&info); |
25 Handle<Code> code = pipeline.GenerateCode(); | 28 Handle<Code> code = pipeline.GenerateCode(); |
26 CHECK(!code.is_null()); | 29 CHECK(!code.is_null()); |
27 } | 30 } |
28 | 31 |
29 | 32 |
30 TEST(PipelineTyped) { | 33 TEST(PipelineTyped) { |
31 HandleAndZoneScope handles; | 34 HandleAndZoneScope handles; |
32 FLAG_turbo_types = true; | 35 FLAG_turbo_types = true; |
33 RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); | 36 RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); |
34 } | 37 } |
35 | 38 |
36 | 39 |
37 TEST(PipelineGeneric) { | 40 TEST(PipelineGeneric) { |
38 HandleAndZoneScope handles; | 41 HandleAndZoneScope handles; |
39 FLAG_turbo_types = false; | 42 FLAG_turbo_types = false; |
40 RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); | 43 RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })"); |
41 } | 44 } |
OLD | NEW |