Commit d1492a31 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[ParseInfo] Decode SFI::Flags in constructor.

Decodes SFI::Flags on construction and sets properties in ParseInfo::flags_ directly, as well
as adding a FunctionKind field, instead of keeping the encoded SFI flags in the ParseInfo.

BUG=v8:8041

Change-Id: I9bd9345b29a8b0e9ffb3e2e73aac11ae6ef69322
Reviewed-on: https://chromium-review.googlesource.com/1169181Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55080}
parent a4dd0637
......@@ -23,7 +23,7 @@ ParseInfo::ParseInfo(Isolate* isolate, AccountingAllocator* zone_allocator)
unicode_cache_(nullptr),
stack_limit_(0),
hash_seed_(0),
function_flags_(0),
function_kind_(FunctionKind::kNormalFunction),
script_id_(-1),
start_position_(0),
end_position_(0),
......@@ -64,11 +64,14 @@ ParseInfo::ParseInfo(Isolate* isolate, Handle<SharedFunctionInfo> shared)
set_wrapped_as_function(shared->is_wrapped());
set_allow_lazy_parsing(FLAG_lazy_inner_functions);
set_is_named_expression(shared->is_named_expression());
set_function_flags(shared->flags());
set_start_position(shared->StartPosition());
set_end_position(shared->EndPosition());
function_literal_id_ = shared->FunctionLiteralId(isolate);
set_language_mode(shared->language_mode());
set_function_kind(shared->kind());
set_declaration(shared->is_declaration());
set_requires_instance_fields_initializer(
shared->requires_instance_fields_initializer());
set_asm_wasm_broken(shared->is_asm_wasm_broken());
Handle<Script> script(Script::cast(shared->script()), isolate);
......@@ -99,19 +102,6 @@ ParseInfo::~ParseInfo() {}
DeclarationScope* ParseInfo::scope() const { return literal()->scope(); }
bool ParseInfo::is_declaration() const {
return SharedFunctionInfo::IsDeclarationBit::decode(function_flags_);
}
FunctionKind ParseInfo::function_kind() const {
return SharedFunctionInfo::FunctionKindBits::decode(function_flags_);
}
bool ParseInfo::requires_instance_fields_initializer() const {
return SharedFunctionInfo::RequiresInstanceFieldsInitializer::decode(
function_flags_);
}
void ParseInfo::EmitBackgroundParseStatisticsOnBackgroundThread() {
// If runtime call stats was enabled by tracing, emit a trace event at the
// end of background parsing on the background thread.
......
......@@ -86,6 +86,10 @@ class V8_EXPORT_PRIVATE ParseInfo {
FLAG_ACCESSOR(kWrappedAsFunction, is_wrapped_as_function,
set_wrapped_as_function)
FLAG_ACCESSOR(kAllowEvalCache, allow_eval_cache, set_allow_eval_cache)
FLAG_ACCESSOR(kIsDeclaration, is_declaration, set_declaration)
FLAG_ACCESSOR(kRequiresInstanceFieldsInitializer,
requires_instance_fields_initializer,
set_requires_instance_fields_initializer);
#undef FLAG_ACCESSOR
void set_parse_restriction(ParseRestriction restriction) {
......@@ -140,11 +144,6 @@ class V8_EXPORT_PRIVATE ParseInfo {
uint64_t hash_seed() const { return hash_seed_; }
void set_hash_seed(uint64_t hash_seed) { hash_seed_ = hash_seed; }
int function_flags() const { return function_flags_; }
void set_function_flags(int function_flags) {
function_flags_ = function_flags;
}
int start_position() const { return start_position_; }
void set_start_position(int start_position) {
start_position_ = start_position;
......@@ -163,6 +162,11 @@ class V8_EXPORT_PRIVATE ParseInfo {
function_literal_id_ = function_literal_id;
}
FunctionKind function_kind() const { return function_kind_; }
void set_function_kind(FunctionKind function_kind) {
function_kind_ = function_kind;
}
int max_function_literal_id() const { return max_function_literal_id_; }
void set_max_function_literal_id(int max_function_literal_id) {
max_function_literal_id_ = max_function_literal_id;
......@@ -193,11 +197,6 @@ class V8_EXPORT_PRIVATE ParseInfo {
return &pending_error_handler_;
}
// Getters for individual function flags.
bool is_declaration() const;
FunctionKind function_kind() const;
bool requires_instance_fields_initializer() const;
//--------------------------------------------------------------------------
// TODO(titzer): these should not be part of ParseInfo.
//--------------------------------------------------------------------------
......@@ -246,6 +245,8 @@ class V8_EXPORT_PRIVATE ParseInfo {
kOnBackgroundThread = 1 << 13,
kWrappedAsFunction = 1 << 14, // Implicitly wrapped as function.
kAllowEvalCache = 1 << 15,
kIsDeclaration = 1 << 16,
kRequiresInstanceFieldsInitializer = 1 << 17,
};
//------------- Inputs to parsing and scope analysis -----------------------
......@@ -256,9 +257,7 @@ class V8_EXPORT_PRIVATE ParseInfo {
UnicodeCache* unicode_cache_;
uintptr_t stack_limit_;
uint64_t hash_seed_;
// TODO(leszeks): Move any remaining flags used here either to the flags_
// field or to other fields.
int function_flags_;
FunctionKind function_kind_;
int script_id_;
int start_position_;
int end_position_;
......
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