зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1592302: Part 3: Update #includes in new regexp files r=mgaudet
This patch adds a python script to update #includes from V8 to SM, and runs the script over each of the V8 source files. This automates 90%+ of the changes that are necessary to prepare V8 source for inclusion in SM. The remaining changes will come in a subsequent patch. Almost all of those changes simply involve adding a shim #include in the right place. Differential Revision: https://phabricator.services.mozilla.com/D51930 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e0d1887eb7
Коммит
19c2279381
|
@ -7,7 +7,6 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "src/base/logging.h"
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/uniset.h"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
|
||||
#include "src/regexp/property-sequences.h"
|
||||
#include "new-regexp/property-sequences.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
|
||||
#include "src/common/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-ast.h"
|
||||
#include "src/utils/ostreams.h"
|
||||
#include "new-regexp/regexp-ast.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
#ifndef V8_REGEXP_REGEXP_AST_H_
|
||||
#define V8_REGEXP_REGEXP_AST_H_
|
||||
|
||||
#include "src/objects/js-regexp.h"
|
||||
#include "src/objects/objects.h"
|
||||
#include "src/objects/string.h"
|
||||
#include "src/utils/utils.h"
|
||||
#include "src/zone/zone-containers.h"
|
||||
#include "src/zone/zone.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
#ifndef V8_REGEXP_REGEXP_BYTECODE_GENERATOR_INL_H_
|
||||
#define V8_REGEXP_REGEXP_BYTECODE_GENERATOR_INL_H_
|
||||
|
||||
#include "src/regexp/regexp-bytecode-generator.h"
|
||||
#include "new-regexp/regexp-bytecode-generator.h"
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/regexp/regexp-bytecodes.h"
|
||||
#include "new-regexp/regexp-bytecodes.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-bytecode-generator.h"
|
||||
#include "new-regexp/regexp-bytecode-generator.h"
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
#include "src/regexp/regexp-bytecode-generator-inl.h"
|
||||
#include "src/regexp/regexp-bytecode-peephole.h"
|
||||
#include "src/regexp/regexp-bytecodes.h"
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "new-regexp/regexp-bytecode-generator-inl.h"
|
||||
#include "new-regexp/regexp-bytecode-peephole.h"
|
||||
#include "new-regexp/regexp-bytecodes.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef V8_REGEXP_REGEXP_BYTECODE_GENERATOR_H_
|
||||
#define V8_REGEXP_REGEXP_BYTECODE_GENERATOR_H_
|
||||
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,17 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-bytecode-peephole.h"
|
||||
#include "new-regexp/regexp-bytecode-peephole.h"
|
||||
|
||||
#include "src/execution/isolate.h"
|
||||
#include "src/flags/flags.h"
|
||||
#include "src/objects/fixed-array.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
#include "src/regexp/regexp-bytecodes.h"
|
||||
#include "src/utils/memcopy.h"
|
||||
#include "src/utils/utils.h"
|
||||
#include "src/zone/zone-containers.h"
|
||||
#include "src/zone/zone.h"
|
||||
#include "new-regexp/regexp-bytecodes.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_
|
||||
#define V8_REGEXP_REGEXP_BYTECODE_PEEPHOLE_H_
|
||||
|
||||
#include "src/common/globals.h"
|
||||
#include "src/zone/zone-containers.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-bytecodes.h"
|
||||
#include "new-regexp/regexp-bytecodes.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#include "src/utils/utils.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef V8_REGEXP_REGEXP_BYTECODES_H_
|
||||
#define V8_REGEXP_REGEXP_BYTECODES_H_
|
||||
|
||||
#include "src/base/macros.h"
|
||||
#include "src/common/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,15 +2,12 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-compiler.h"
|
||||
#include "new-regexp/regexp-compiler.h"
|
||||
|
||||
#include "src/execution/isolate.h"
|
||||
#include "src/regexp/regexp.h"
|
||||
#include "new-regexp/regexp.h"
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "src/regexp/special-case.h"
|
||||
#include "new-regexp/special-case.h"
|
||||
#endif // V8_INTL_SUPPORT
|
||||
#include "src/strings/unicode-inl.h"
|
||||
#include "src/zone/zone-list-inl.h"
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "unicode/locid.h"
|
||||
|
|
|
@ -2,15 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-compiler.h"
|
||||
#include "new-regexp/regexp-compiler.h"
|
||||
|
||||
#include "src/base/safe_conversions.h"
|
||||
#include "src/execution/isolate.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
#include "src/regexp/regexp-macro-assembler-arch.h"
|
||||
#include "src/regexp/regexp-macro-assembler-tracer.h"
|
||||
#include "src/strings/unicode-inl.h"
|
||||
#include "src/zone/zone-list-inl.h"
|
||||
#include "new-regexp/regexp-macro-assembler-arch.h"
|
||||
#include "new-regexp/regexp-macro-assembler-tracer.h"
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "unicode/locid.h"
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
#include <bitset>
|
||||
|
||||
#include "src/base/small-vector.h"
|
||||
#include "src/regexp/regexp-nodes.h"
|
||||
#include "new-regexp/regexp-nodes.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-dotprinter.h"
|
||||
#include "new-regexp/regexp-dotprinter.h"
|
||||
|
||||
#include "src/regexp/regexp-compiler.h"
|
||||
#include "src/utils/ostreams.h"
|
||||
#include "new-regexp/regexp-compiler.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#ifndef V8_REGEXP_REGEXP_DOTPRINTER_H_
|
||||
#define V8_REGEXP_REGEXP_DOTPRINTER_H_
|
||||
|
||||
#include "src/common/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -4,19 +4,12 @@
|
|||
|
||||
// A simple interpreter for the Irregexp byte code.
|
||||
|
||||
#include "src/regexp/regexp-interpreter.h"
|
||||
#include "new-regexp/regexp-interpreter.h"
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/base/small-vector.h"
|
||||
#include "src/logging/counters.h"
|
||||
#include "src/objects/js-regexp-inl.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
#include "src/regexp/regexp-bytecodes.h"
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "src/regexp/regexp-stack.h" // For kMaximumStackSize.
|
||||
#include "src/regexp/regexp.h"
|
||||
#include "src/strings/unicode.h"
|
||||
#include "src/utils/utils.h"
|
||||
#include "new-regexp/regexp-bytecodes.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
#include "new-regexp/regexp-stack.h" // For kMaximumStackSize.
|
||||
#include "new-regexp/regexp.h"
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "unicode/uchar.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#ifndef V8_REGEXP_REGEXP_INTERPRETER_H_
|
||||
#define V8_REGEXP_REGEXP_INTERPRETER_H_
|
||||
|
||||
#include "src/regexp/regexp.h"
|
||||
#include "new-regexp/regexp.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-macro-assembler-tracer.h"
|
||||
#include "new-regexp/regexp-macro-assembler-tracer.h"
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef V8_REGEXP_REGEXP_MACRO_ASSEMBLER_TRACER_H_
|
||||
#define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_TRACER_H_
|
||||
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
|
||||
#include "src/codegen/assembler.h"
|
||||
#include "src/execution/isolate-inl.h"
|
||||
#include "src/execution/simulator.h"
|
||||
#include "src/regexp/regexp-stack.h"
|
||||
#include "src/strings/unicode-inl.h"
|
||||
#include "new-regexp/regexp-stack.h"
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "unicode/uchar.h"
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
#ifndef V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_
|
||||
#define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_
|
||||
|
||||
#include "src/codegen/label.h"
|
||||
#include "src/regexp/regexp-ast.h"
|
||||
#include "src/regexp/regexp.h"
|
||||
#include "new-regexp/regexp-ast.h"
|
||||
#include "new-regexp/regexp.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
#ifndef V8_REGEXP_REGEXP_NODES_H_
|
||||
#define V8_REGEXP_REGEXP_NODES_H_
|
||||
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "src/zone/zone.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,20 +2,13 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-parser.h"
|
||||
#include "new-regexp/regexp-parser.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "src/execution/isolate.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
#include "src/regexp/property-sequences.h"
|
||||
#include "src/regexp/regexp-macro-assembler.h"
|
||||
#include "src/regexp/regexp.h"
|
||||
#include "src/strings/char-predicates-inl.h"
|
||||
#include "src/utils/ostreams.h"
|
||||
#include "src/utils/utils.h"
|
||||
#include "src/zone/zone-list-inl.h"
|
||||
#include "new-regexp/property-sequences.h"
|
||||
#include "new-regexp/regexp-macro-assembler.h"
|
||||
#include "new-regexp/regexp.h"
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "unicode/uniset.h"
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
#ifndef V8_REGEXP_REGEXP_PARSER_H_
|
||||
#define V8_REGEXP_REGEXP_PARSER_H_
|
||||
|
||||
#include "src/objects/js-regexp.h"
|
||||
#include "src/objects/objects.h"
|
||||
#include "src/regexp/regexp-ast.h"
|
||||
#include "src/zone/zone.h"
|
||||
#include "new-regexp/regexp-ast.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/regexp/regexp-stack.h"
|
||||
#include "new-regexp/regexp-stack.h"
|
||||
|
||||
#include "src/execution/isolate.h"
|
||||
#include "src/utils/memcopy.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
#ifndef V8_REGEXP_REGEXP_STACK_H_
|
||||
#define V8_REGEXP_REGEXP_STACK_H_
|
||||
|
||||
#include "src/base/logging.h"
|
||||
#include "src/base/macros.h"
|
||||
#include "src/common/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#ifndef V8_REGEXP_REGEXP_H_
|
||||
#define V8_REGEXP_REGEXP_H_
|
||||
|
||||
#include "src/objects/js-regexp.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# This script modifies V8 regexp source files to make them suitable for
|
||||
# inclusion in SpiderMonkey. Specifically, it:
|
||||
#
|
||||
# 1. Rewrites all #includes of V8 regexp headers to point to their location in
|
||||
# the SM tree: src/regexp/* --> new-regexp/*
|
||||
# 2. Removes all #includes of other V8 src/* headers. The required definitions
|
||||
# will be provided by regexp-shim.h.
|
||||
#
|
||||
# Usage:
|
||||
# cd js/src/new-regexp
|
||||
# find . -name "*.h" -o -name "*.cc" | xargs ./update_headers.py
|
||||
#
|
||||
|
||||
import fileinput
|
||||
import re
|
||||
import sys
|
||||
|
||||
# 1. Rewrite includes of V8 regexp headers
|
||||
regexp_include = re.compile('#include "src/regexp')
|
||||
regexp_include_new = '#include "new-regexp'
|
||||
|
||||
# 2. Remove includes of other V8 headers
|
||||
other_include = re.compile('#include "src/')
|
||||
|
||||
for line in fileinput.input(inplace=1):
|
||||
if regexp_include.search(line):
|
||||
sys.stdout.write(re.sub(regexp_include, regexp_include_new, line))
|
||||
elif other_include.search(line):
|
||||
pass
|
||||
else:
|
||||
sys.stdout.write(line)
|
Загрузка…
Ссылка в новой задаче