4eddbacabf
This will allow us to move expressions from one function to another, for example when the parser determines that a given cover grammar instance is actually the default value initializer for an arrow function. This is a re-land of https://codereview.chromium.org/636403003/ with a fix for the arm64 code generator. R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/663373003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24769 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
// 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"
|
|
|
|
#include "src/ast-numbering.h"
|
|
#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) {
|
|
InitializedHandleScope handles;
|
|
const char* source = "(function(a,b) { return a + b; })";
|
|
Handle<JSFunction> function = v8::Utils::OpenHandle(
|
|
*v8::Handle<v8::Function>::Cast(CompileRun(source)));
|
|
CompilationInfoWithZone info(function);
|
|
|
|
CHECK(Parser::Parse(&info));
|
|
CHECK(Rewriter::Rewrite(&info));
|
|
CHECK(Scope::Analyze(&info));
|
|
CHECK(AstNumbering::Renumber(info.function(), info.zone()));
|
|
CHECK_NE(NULL, info.scope());
|
|
|
|
Pipeline pipeline(&info);
|
|
#if V8_TURBOFAN_TARGET
|
|
Handle<Code> code = pipeline.GenerateCode();
|
|
CHECK(Pipeline::SupportedTarget());
|
|
CHECK(!code.is_null());
|
|
#else
|
|
USE(pipeline);
|
|
#endif
|
|
}
|