[Parsing] Remove PreParseData which is no longer used.

TBR=yangguo@chromium.org

Change-Id: Iadeb5828daf4db341c58534ff2b23141f241dfb9
Reviewed-on: https://chromium-review.googlesource.com/1184841
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55314}
This commit is contained in:
Ross McIlroy 2018-08-22 11:08:35 +01:00 committed by Commit Bot
parent 97ba0ac1e0
commit 2662bbc25b
11 changed files with 37 additions and 137 deletions

View File

@ -2264,10 +2264,9 @@ v8_source_set("v8_base") {
"src/parsing/parsing.cc",
"src/parsing/parsing.h",
"src/parsing/pattern-rewriter.cc",
"src/parsing/preparse-data.cc",
"src/parsing/preparse-data.h",
"src/parsing/preparsed-scope-data.cc",
"src/parsing/preparsed-scope-data.h",
"src/parsing/preparser-logger.h",
"src/parsing/preparser.cc",
"src/parsing/preparser.h",
"src/parsing/rewriter.cc",

View File

@ -1078,7 +1078,6 @@ enum InitializationFlag : uint8_t { kNeedsInitialization, kCreatedInitialized };
enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };
// Serialized in PreparseData, so numeric values should not be changed.
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 };
enum FunctionKind : uint8_t {

View File

@ -14,7 +14,6 @@
#include "src/globals.h"
#include "src/parsing/parser-base.h"
#include "src/parsing/parsing.h"
#include "src/parsing/preparse-data.h"
#include "src/parsing/preparser.h"
#include "src/utils.h"
#include "src/zone/zone-chunk-list.h"

View File

@ -1,44 +0,0 @@
// Copyright 2010 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/parsing/preparse-data.h"
#include "src/base/hashmap.h"
#include "src/base/logging.h"
#include "src/globals.h"
#include "src/objects-inl.h"
#include "src/parsing/parser.h"
namespace v8 {
namespace internal {
PreParseData::FunctionData PreParseData::GetFunctionData(int start) const {
auto it = functions_.find(start);
if (it != functions_.end()) {
return it->second;
}
return FunctionData();
}
void PreParseData::AddFunctionData(int start, FunctionData&& data) {
DCHECK(data.is_valid());
functions_[start] = std::move(data);
}
void PreParseData::AddFunctionData(int start, const FunctionData& data) {
DCHECK(data.is_valid());
functions_[start] = data;
}
size_t PreParseData::size() const { return functions_.size(); }
PreParseData::const_iterator PreParseData::begin() const {
return functions_.begin();
}
PreParseData::const_iterator PreParseData::end() const {
return functions_.end();
}
} // namespace internal
} // namespace v8.

View File

@ -1,84 +0,0 @@
// Copyright 2011 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.
#ifndef V8_PARSING_PREPARSE_DATA_H_
#define V8_PARSING_PREPARSE_DATA_H_
#include <unordered_map>
#include "src/allocation.h"
#include "src/base/hashmap.h"
#include "src/collector.h"
#include "src/messages.h"
namespace v8 {
namespace internal {
class PreParserLogger final {
public:
PreParserLogger()
: end_(-1),
num_parameters_(-1),
num_inner_functions_(-1) {}
void LogFunction(int end, int num_parameters, int num_inner_functions) {
end_ = end;
num_parameters_ = num_parameters;
num_inner_functions_ = num_inner_functions;
}
int end() const { return end_; }
int num_parameters() const {
return num_parameters_;
}
int num_inner_functions() const { return num_inner_functions_; }
private:
int end_;
// For function entries.
int num_parameters_;
int num_inner_functions_;
};
class PreParseData final {
public:
struct FunctionData {
int end;
int num_parameters;
int num_inner_functions;
LanguageMode language_mode;
bool uses_super_property : 1;
FunctionData() : end(kNoSourcePosition) {}
FunctionData(int end, int num_parameters, int num_inner_functions,
LanguageMode language_mode, bool uses_super_property)
: end(end),
num_parameters(num_parameters),
num_inner_functions(num_inner_functions),
language_mode(language_mode),
uses_super_property(uses_super_property) {}
bool is_valid() const {
DCHECK_IMPLIES(end < 0, end == kNoSourcePosition);
return end != kNoSourcePosition;
}
};
FunctionData GetFunctionData(int start) const;
void AddFunctionData(int start, FunctionData&& data);
void AddFunctionData(int start, const FunctionData& data);
size_t size() const;
typedef std::unordered_map<int, FunctionData>::const_iterator const_iterator;
const_iterator begin() const;
const_iterator end() const;
private:
std::unordered_map<int, FunctionData> functions_;
};
} // namespace internal
} // namespace v8.
#endif // V8_PARSING_PREPARSE_DATA_H_

View File

@ -12,7 +12,6 @@
#include "src/globals.h"
#include "src/handles.h"
#include "src/objects/shared-function-info.h"
#include "src/parsing/preparse-data.h"
#include "src/zone/zone-chunk-list.h"
namespace v8 {

View File

@ -0,0 +1,35 @@
// Copyright 2018 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.
#ifndef V8_PARSING_PREPARSER_LOGGER_H_
#define V8_PARSING_PREPARSER_LOGGER_H_
namespace v8 {
namespace internal {
class PreParserLogger final {
public:
PreParserLogger() : end_(-1), num_parameters_(-1), num_inner_functions_(-1) {}
void LogFunction(int end, int num_parameters, int num_inner_functions) {
end_ = end;
num_parameters_ = num_parameters;
num_inner_functions_ = num_inner_functions;
}
int end() const { return end_; }
int num_parameters() const { return num_parameters_; }
int num_inner_functions() const { return num_inner_functions_; }
private:
int end_;
// For function entries.
int num_parameters_;
int num_inner_functions_;
};
} // namespace internal
} // namespace v8.
#endif // V8_PARSING_PREPARSER_LOGGER_H_

View File

@ -11,7 +11,6 @@
#include "src/globals.h"
#include "src/parsing/duplicate-finder.h"
#include "src/parsing/parser-base.h"
#include "src/parsing/preparse-data.h"
#include "src/parsing/preparsed-scope-data.h"
#include "src/parsing/preparser.h"
#include "src/unicode.h"

View File

@ -8,7 +8,7 @@
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/parsing/parser-base.h"
#include "src/parsing/preparse-data.h"
#include "src/parsing/preparser-logger.h"
#include "src/pending-compilation-error-handler.h"
namespace v8 {

View File

@ -5,7 +5,6 @@
#ifndef V8_SNAPSHOT_CODE_SERIALIZER_H_
#define V8_SNAPSHOT_CODE_SERIALIZER_H_
#include "src/parsing/preparse-data.h"
#include "src/snapshot/serializer.h"
namespace v8 {

View File

@ -55,7 +55,6 @@
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/js-promise-inl.h"
#include "src/parsing/preparse-data.h"
#include "src/profiler/cpu-profiler.h"
#include "src/unicode-inl.h"
#include "src/utils.h"