2014-07-30 13:54:45 +00:00
|
|
|
// Copyright 2013 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "src/v8.h"
|
|
|
|
#include "test/cctest/cctest.h"
|
|
|
|
|
2014-10-21 12:16:37 +00:00
|
|
|
#include "src/ast-numbering.h"
|
2014-07-30 13:54:45 +00:00
|
|
|
#include "src/compiler.h"
|
|
|
|
#include "src/compiler/pipeline.h"
|
|
|
|
#include "src/handles.h"
|
|
|
|
#include "src/parser.h"
|
|
|
|
#include "src/rewriter.h"
|
|
|
|
#include "src/scopes.h"
|
|
|
|
|
|
|
|
using namespace v8::internal;
|
|
|
|
using namespace v8::internal::compiler;
|
|
|
|
|
|
|
|
TEST(PipelineAdd) {
|
2015-03-24 14:17:05 +00:00
|
|
|
HandleAndZoneScope handles;
|
2014-07-30 13:54:45 +00:00
|
|
|
const char* source = "(function(a,b) { return a + b; })";
|
|
|
|
Handle<JSFunction> function = v8::Utils::OpenHandle(
|
|
|
|
*v8::Handle<v8::Function>::Cast(CompileRun(source)));
|
2015-03-24 14:17:05 +00:00
|
|
|
ParseInfo parse_info(handles.main_zone(), function);
|
|
|
|
CHECK(Compiler::ParseAndAnalyze(&parse_info));
|
|
|
|
CompilationInfo info(&parse_info);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
|
|
|
Pipeline pipeline(&info);
|
|
|
|
#if V8_TURBOFAN_TARGET
|
2014-07-31 11:59:49 +00:00
|
|
|
Handle<Code> code = pipeline.GenerateCode();
|
2014-07-30 13:54:45 +00:00
|
|
|
CHECK(Pipeline::SupportedTarget());
|
|
|
|
CHECK(!code.is_null());
|
|
|
|
#else
|
2014-07-31 11:59:49 +00:00
|
|
|
USE(pipeline);
|
2014-07-30 13:54:45 +00:00
|
|
|
#endif
|
|
|
|
}
|