Commit 257433ec authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[cleanup] Remove ast.h include in shared-function-info-inl.h

This removes ast.h as include from about ~500 includers of the latter.

Bug: v8:8834
Change-Id: I294026d4bb29b878820d43c117b04a9645a457ae
Reviewed-on: https://chromium-review.googlesource.com/c/1485835Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59822}
parent 591408cb
......@@ -2195,8 +2195,6 @@ class FunctionLiteral final : public Expression {
kWrapped,
};
enum IdType { kIdTypeInvalid = -1, kIdTypeTopLevel = 0 };
enum ParameterFlag : uint8_t {
kNoDuplicateParameters,
kHasDuplicateParameters
......@@ -2231,7 +2229,7 @@ class FunctionLiteral final : public Expression {
}
bool is_oneshot_iife() const { return OneshotIIFEBit::decode(bit_field_); }
bool is_toplevel() const {
return function_literal_id() == FunctionLiteral::kIdTypeTopLevel;
return function_literal_id() == kFunctionLiteralIdTopLevel;
}
bool is_wrapped() const { return function_type() == kWrapped; }
LanguageMode language_mode() const;
......@@ -3203,7 +3201,7 @@ class AstNodeFactory final {
FunctionLiteral::kAnonymousExpression,
FunctionLiteral::kNoDuplicateParameters,
FunctionLiteral::kShouldLazyCompile, 0, /* has_braces */ false,
FunctionLiteral::kIdTypeTopLevel);
kFunctionLiteralIdTopLevel);
}
ClassLiteral::Property* NewClassLiteralProperty(
......
......@@ -684,7 +684,7 @@ void MapLiterals(const FunctionLiteralChanges& changes,
DCHECK(literal->start_position() != kNoSourcePosition);
DCHECK(literal->end_position() != kNoSourcePosition);
std::pair<int, int> key =
literal->function_literal_id() == FunctionLiteral::kIdTypeTopLevel
literal->function_literal_id() == kFunctionLiteralIdTopLevel
? kTopLevelMarker
: std::make_pair(literal->start_position(),
literal->end_position());
......@@ -698,7 +698,7 @@ void MapLiterals(const FunctionLiteralChanges& changes,
FunctionLiteral* literal = change_pair.first;
const FunctionLiteralChange& change = change_pair.second;
std::pair<int, int> key =
literal->function_literal_id() == FunctionLiteral::kIdTypeTopLevel
literal->function_literal_id() == kFunctionLiteralIdTopLevel
? kTopLevelMarker
: std::make_pair(change.new_start_position,
change.new_end_position);
......
......@@ -1540,6 +1540,9 @@ enum class StubCallMode {
kCallBuiltinPointer,
};
constexpr int kFunctionLiteralIdInvalid = -1;
constexpr int kFunctionLiteralIdTopLevel = 0;
} // namespace internal
} // namespace v8
......
......@@ -2044,7 +2044,7 @@ void MarkCompactCollector::FlushBytecodeFromSFI(
UncompiledData uncompiled_data = UncompiledData::cast(compiled_data);
UncompiledData::Initialize(
uncompiled_data, inferred_name, start_position, end_position,
FunctionLiteral::kIdTypeInvalid,
kFunctionLiteralIdInvalid,
[](HeapObject object, ObjectSlot slot, HeapObject target) {
RecordSlot(object, slot, target);
});
......
......@@ -4846,7 +4846,7 @@ Object Script::GetNameOrSourceURL() {
MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo(
Isolate* isolate, const FunctionLiteral* fun) {
CHECK_NE(fun->function_literal_id(), FunctionLiteral::kIdTypeInvalid);
CHECK_NE(fun->function_literal_id(), kFunctionLiteralIdInvalid);
// If this check fails, the problem is most probably the function id
// renumbering done by AstFunctionLiteralIdReindexer; in particular, that
// AstTraversalVisitor doesn't recurse properly in the construct which
......@@ -5262,7 +5262,7 @@ int SharedFunctionInfo::FindIndexInScript(Isolate* isolate) const {
DisallowHeapAllocation no_gc;
Object script_obj = script();
if (!script_obj->IsScript()) return FunctionLiteral::kIdTypeInvalid;
if (!script_obj->IsScript()) return kFunctionLiteralIdInvalid;
WeakFixedArray shared_info_list =
Script::cast(script_obj)->shared_function_infos();
......@@ -5277,7 +5277,7 @@ int SharedFunctionInfo::FindIndexInScript(Isolate* isolate) const {
}
}
return FunctionLiteral::kIdTypeInvalid;
return kFunctionLiteralIdInvalid;
}
......
......@@ -7,7 +7,6 @@
#include "src/objects/shared-function-info.h"
#include "src/ast/ast.h"
#include "src/feedback-vector-inl.h"
#include "src/handles-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
......@@ -667,7 +666,7 @@ void UncompiledDataWithPreparseData::Initialize(
}
bool UncompiledData::has_function_literal_id() {
return function_literal_id() != FunctionLiteral::kIdTypeInvalid;
return function_literal_id() != kFunctionLiteralIdInvalid;
}
bool SharedFunctionInfo::HasWasmExportedFunctionData() const {
......
......@@ -32,8 +32,8 @@ ParseInfo::ParseInfo(AccountingAllocator* zone_allocator)
start_position_(0),
end_position_(0),
parameters_end_pos_(kNoSourcePosition),
function_literal_id_(FunctionLiteral::kIdTypeInvalid),
max_function_literal_id_(FunctionLiteral::kIdTypeInvalid),
function_literal_id_(kFunctionLiteralIdInvalid),
max_function_literal_id_(kFunctionLiteralIdInvalid),
character_stream_(nullptr),
ast_value_factory_(nullptr),
ast_string_constants_(nullptr),
......
......@@ -537,8 +537,8 @@ FunctionLiteral* Parser::DoParseProgram(Isolate* isolate, ParseInfo* info) {
ParsingModeScope mode(this, allow_lazy_ ? PARSE_LAZILY : PARSE_EAGERLY);
ResetFunctionLiteralId();
DCHECK(info->function_literal_id() == FunctionLiteral::kIdTypeTopLevel ||
info->function_literal_id() == FunctionLiteral::kIdTypeInvalid);
DCHECK(info->function_literal_id() == kFunctionLiteralIdTopLevel ||
info->function_literal_id() == kFunctionLiteralIdInvalid);
FunctionLiteral* result = nullptr;
{
......
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