Home | History | Annotate | Download | only in compiler
      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
      3 // found in the LICENSE file.
      4 
      5 #include "src/v8.h"
      6 #include "test/cctest/cctest.h"
      7 
      8 #include "src/compiler.h"
      9 #include "src/compiler/pipeline.h"
     10 #include "src/handles.h"
     11 #include "src/parser.h"
     12 #include "src/rewriter.h"
     13 #include "src/scopes.h"
     14 
     15 using namespace v8::internal;
     16 using namespace v8::internal::compiler;
     17 
     18 TEST(PipelineAdd) {
     19   InitializedHandleScope handles;
     20   const char* source = "(function(a,b) { return a + b; })";
     21   Handle<JSFunction> function = v8::Utils::OpenHandle(
     22       *v8::Handle<v8::Function>::Cast(CompileRun(source)));
     23   CompilationInfoWithZone info(function);
     24 
     25   CHECK(Parser::Parse(&info));
     26   CHECK(Rewriter::Rewrite(&info));
     27   CHECK(Scope::Analyze(&info));
     28   CHECK_NE(NULL, info.scope());
     29 
     30   Pipeline pipeline(&info);
     31 #if V8_TURBOFAN_TARGET
     32   Handle<Code> code = pipeline.GenerateCode();
     33   CHECK(Pipeline::SupportedTarget());
     34   CHECK(!code.is_null());
     35 #else
     36   USE(pipeline);
     37 #endif
     38 }
     39