Commit 50ae8de9 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[iwyu] Remove unnecessary includes from parser.cc and fix problems uncovered.

api.h: MAKE_TO_LOCAL funcs need the types to be available.

scope.h, func-name-inferrer.h, bigint.h, module.h: These were using inline
headers -> de-inlined.

BUG=v8:7754,v8:7490

Change-Id: Id072f537682fb867cd68d79ca95b06628780d01f
Reviewed-on: https://chromium-review.googlesource.com/1131175
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54414}
parent 7abd2243
......@@ -11,9 +11,11 @@
#include "src/detachable-vector.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
#include "src/objects/bigint.h"
#include "src/objects/js-collection.h"
#include "src/objects/js-promise.h"
#include "src/objects/module.h"
#include "src/objects/templates.h"
namespace v8 {
......
......@@ -17,6 +17,7 @@
#include "src/objects/scope-info.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/preparsed-scope-data.h"
#include "src/zone/zone-list-inl.h"
namespace v8 {
namespace internal {
......@@ -189,6 +190,13 @@ DeclarationScope::DeclarationScope(Zone* zone, Scope* outer_scope,
SetDefaults();
}
bool DeclarationScope::IsDeclaredParameter(const AstRawString* name) {
// If IsSimpleParameterList is false, duplicate parameters are not allowed,
// however `arguments` may be allowed if function is not strict code. Thus,
// the assumptions explained above do not hold.
return params_.Contains(variables_.Lookup(name));
}
ModuleScope::ModuleScope(DeclarationScope* script_scope,
AstValueFactory* ast_value_factory)
: DeclarationScope(ast_value_factory->zone(), script_scope, MODULE_SCOPE,
......
......@@ -646,12 +646,7 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
// Creates a script scope.
DeclarationScope(Zone* zone, AstValueFactory* ast_value_factory);
bool IsDeclaredParameter(const AstRawString* name) {
// If IsSimpleParameterList is false, duplicate parameters are not allowed,
// however `arguments` may be allowed if function is not strict code. Thus,
// the assumptions explained above do not hold.
return params_.Contains(variables_.Lookup(name));
}
bool IsDeclaredParameter(const AstRawString* name);
FunctionKind function_kind() const { return function_kind_; }
......
......@@ -3404,6 +3404,11 @@ bool ScopeInfo::HasSimpleParameters() const {
FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(FIELD_ACCESSORS)
#undef FIELD_ACCESSORS
FreshlyAllocatedBigInt* FreshlyAllocatedBigInt::cast(Object* object) {
SLOW_DCHECK(object->IsBigInt());
return reinterpret_cast<FreshlyAllocatedBigInt*>(object);
}
} // namespace internal
} // namespace v8
......
......@@ -85,10 +85,7 @@ class FreshlyAllocatedBigInt : public BigIntBase {
// (and no explicit operator is provided either).
public:
inline static FreshlyAllocatedBigInt* cast(Object* object) {
SLOW_DCHECK(object->IsBigInt());
return reinterpret_cast<FreshlyAllocatedBigInt*>(object);
}
inline static FreshlyAllocatedBigInt* cast(Object* object);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(FreshlyAllocatedBigInt);
......
......@@ -49,6 +49,41 @@ SMI_ACCESSORS(ModuleInfoEntry, end_pos, kEndPosOffset)
CAST_ACCESSOR(ModuleInfo)
FixedArray* ModuleInfo::module_requests() const {
return FixedArray::cast(get(kModuleRequestsIndex));
}
FixedArray* ModuleInfo::special_exports() const {
return FixedArray::cast(get(kSpecialExportsIndex));
}
FixedArray* ModuleInfo::regular_exports() const {
return FixedArray::cast(get(kRegularExportsIndex));
}
FixedArray* ModuleInfo::regular_imports() const {
return FixedArray::cast(get(kRegularImportsIndex));
}
FixedArray* ModuleInfo::namespace_imports() const {
return FixedArray::cast(get(kNamespaceImportsIndex));
}
FixedArray* ModuleInfo::module_request_positions() const {
return FixedArray::cast(get(kModuleRequestPositionsIndex));
}
#ifdef DEBUG
bool ModuleInfo::Equals(ModuleInfo* other) const {
return regular_exports() == other->regular_exports() &&
regular_imports() == other->regular_imports() &&
special_exports() == other->special_exports() &&
namespace_imports() == other->namespace_imports() &&
module_requests() == other->module_requests() &&
module_request_positions() == other->module_request_positions();
}
#endif
} // namespace internal
} // namespace v8
......
......@@ -256,29 +256,12 @@ class ModuleInfo : public FixedArray {
static Handle<ModuleInfo> New(Isolate* isolate, Zone* zone,
ModuleDescriptor* descr);
inline FixedArray* module_requests() const {
return FixedArray::cast(get(kModuleRequestsIndex));
}
inline FixedArray* special_exports() const {
return FixedArray::cast(get(kSpecialExportsIndex));
}
inline FixedArray* regular_exports() const {
return FixedArray::cast(get(kRegularExportsIndex));
}
inline FixedArray* regular_imports() const {
return FixedArray::cast(get(kRegularImportsIndex));
}
inline FixedArray* namespace_imports() const {
return FixedArray::cast(get(kNamespaceImportsIndex));
}
inline FixedArray* module_request_positions() const {
return FixedArray::cast(get(kModuleRequestPositionsIndex));
}
inline FixedArray* module_requests() const;
inline FixedArray* special_exports() const;
inline FixedArray* regular_exports() const;
inline FixedArray* regular_imports() const;
inline FixedArray* namespace_imports() const;
inline FixedArray* module_request_positions() const;
// Accessors for [regular_exports].
int RegularExportCount() const;
......@@ -287,14 +270,7 @@ class ModuleInfo : public FixedArray {
FixedArray* RegularExportExportNames(int i) const;
#ifdef DEBUG
inline bool Equals(ModuleInfo* other) const {
return regular_exports() == other->regular_exports() &&
regular_imports() == other->regular_imports() &&
special_exports() == other->special_exports() &&
namespace_imports() == other->namespace_imports() &&
module_requests() == other->module_requests() &&
module_request_positions() == other->module_request_positions();
}
inline bool Equals(ModuleInfo* other) const;
#endif
private:
......
......@@ -52,6 +52,12 @@ void FuncNameInferrer::RemoveAsyncKeywordFromEnd() {
}
}
void FuncNameInferrer::Leave() {
DCHECK(IsOpen());
names_stack_.Rewind(entries_stack_.RemoveLast());
if (entries_stack_.is_empty()) funcs_to_infer_.Clear();
}
const AstConsString* FuncNameInferrer::MakeNameFromStack() {
AstConsString* result = ast_value_factory_->NewConsString();
for (int pos = 0; pos < names_stack_.length(); pos++) {
......
......@@ -96,11 +96,7 @@ class FuncNameInferrer : public ZoneObject {
void Enter() { entries_stack_.Add(names_stack_.length(), zone()); }
void Leave() {
DCHECK(IsOpen());
names_stack_.Rewind(entries_stack_.RemoveLast());
if (entries_stack_.is_empty()) funcs_to_infer_.Clear();
}
void Leave();
Zone* zone() const { return zone_; }
......
......@@ -7,7 +7,6 @@
#include <algorithm>
#include <memory>
#include "src/api.h"
#include "src/ast/ast-function-literal-id-reindexer.h"
#include "src/ast/ast-traversal-visitor.h"
#include "src/ast/ast.h"
......@@ -15,9 +14,10 @@
#include "src/base/platform/platform.h"
#include "src/char-predicates-inl.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/conversions-inl.h"
#include "src/log.h"
#include "src/messages.h"
#include "src/objects-inl.h"
#include "src/objects/scope-info.h"
#include "src/parsing/duplicate-finder.h"
#include "src/parsing/expression-scope-reparenter.h"
#include "src/parsing/parse-info.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment