Commit 3651bff0 authored by neis's avatar neis Committed by Commit bot

Reland "Remove redundant ParseInfo::scope_."

Original commit message:
> Remove redundant ParseInfo::scope_.
>
> This was always set to the literal's scope.
>
> (Additional change: mark getters as const.)
>
> R=adamk@chromium.org
> BUG=
>
> Review-Url: https://codereview.chromium.org/2216563003
> Cr-Commit-Position: refs/heads/master@{#38372}
> This was always set to the literal's scope.

TBR=adamk@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2216083003
Cr-Commit-Position: refs/heads/master@{#38393}
parent b659a0ac
......@@ -375,7 +375,6 @@ int Scope::num_parameters() const {
bool Scope::Analyze(ParseInfo* info) {
DCHECK(info->literal() != NULL);
DCHECK(info->scope() == NULL);
DeclarationScope* scope = info->literal()->scope();
DeclarationScope* top = scope;
......@@ -403,7 +402,6 @@ bool Scope::Analyze(ParseInfo* info) {
scope->CheckZones();
#endif
info->set_scope(scope);
return true;
}
......
......@@ -1778,7 +1778,6 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
parse_info.set_literal(literal);
parse_info.set_shared_info(result);
parse_info.set_scope(literal->scope());
parse_info.set_language_mode(literal->scope()->language_mode());
if (outer_info->will_serialize()) info.PrepareForSerializing();
if (outer_info->is_debug()) info.MarkAsDebug();
......
......@@ -59,8 +59,7 @@ ParseInfo::ParseInfo(Zone* zone)
cached_data_(nullptr),
ast_value_factory_(nullptr),
function_name_(nullptr),
literal_(nullptr),
scope_(nullptr) {}
literal_(nullptr) {}
ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
: ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {
......
......@@ -40,7 +40,7 @@ class ParseInfo {
ast_value_factory_ = nullptr;
}
Zone* zone() { return zone_; }
Zone* zone() const { return zone_; }
// Convenience accessor methods for flags.
#define FLAG_ACCESSOR(flag, getter, setter) \
......@@ -73,14 +73,14 @@ class ParseInfo {
: NO_PARSE_RESTRICTION;
}
ScriptCompiler::ExternalSourceStream* source_stream() {
ScriptCompiler::ExternalSourceStream* source_stream() const {
return source_stream_;
}
void set_source_stream(ScriptCompiler::ExternalSourceStream* source_stream) {
source_stream_ = source_stream;
}
ScriptCompiler::StreamedSource::Encoding source_stream_encoding() {
ScriptCompiler::StreamedSource::Encoding source_stream_encoding() const {
return source_stream_encoding_;
}
void set_source_stream_encoding(
......@@ -93,23 +93,25 @@ class ParseInfo {
character_stream_ = character_stream;
}
v8::Extension* extension() { return extension_; }
v8::Extension* extension() const { return extension_; }
void set_extension(v8::Extension* extension) { extension_ = extension; }
ScriptData** cached_data() { return cached_data_; }
ScriptData** cached_data() const { return cached_data_; }
void set_cached_data(ScriptData** cached_data) { cached_data_ = cached_data; }
ScriptCompiler::CompileOptions compile_options() { return compile_options_; }
ScriptCompiler::CompileOptions compile_options() const {
return compile_options_;
}
void set_compile_options(ScriptCompiler::CompileOptions compile_options) {
compile_options_ = compile_options;
}
DeclarationScope* script_scope() { return script_scope_; }
DeclarationScope* script_scope() const { return script_scope_; }
void set_script_scope(DeclarationScope* script_scope) {
script_scope_ = script_scope;
}
AstValueFactory* ast_value_factory() { return ast_value_factory_; }
AstValueFactory* ast_value_factory() const { return ast_value_factory_; }
void set_ast_value_factory(AstValueFactory* ast_value_factory) {
ast_value_factory_ = ast_value_factory;
}
......@@ -119,21 +121,20 @@ class ParseInfo {
function_name_ = function_name;
}
FunctionLiteral* literal() { return literal_; }
FunctionLiteral* literal() const { return literal_; }
void set_literal(FunctionLiteral* literal) { literal_ = literal; }
DeclarationScope* scope() { return scope_; }
void set_scope(DeclarationScope* scope) { scope_ = scope; }
DeclarationScope* scope() const { return literal()->scope(); }
UnicodeCache* unicode_cache() { return unicode_cache_; }
UnicodeCache* unicode_cache() const { return unicode_cache_; }
void set_unicode_cache(UnicodeCache* unicode_cache) {
unicode_cache_ = unicode_cache;
}
uintptr_t stack_limit() { return stack_limit_; }
uintptr_t stack_limit() const { return stack_limit_; }
void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; }
uint32_t hash_seed() { return hash_seed_; }
uint32_t hash_seed() const { return hash_seed_; }
void set_hash_seed(uint32_t hash_seed) { hash_seed_ = hash_seed; }
int compiler_hints() const { return compiler_hints_; }
......@@ -159,10 +160,10 @@ class ParseInfo {
//--------------------------------------------------------------------------
// TODO(titzer): these should not be part of ParseInfo.
//--------------------------------------------------------------------------
Isolate* isolate() { return isolate_; }
Handle<SharedFunctionInfo> shared_info() { return shared_; }
Handle<Script> script() { return script_; }
Handle<Context> context() { return context_; }
Isolate* isolate() const { return isolate_; }
Handle<SharedFunctionInfo> shared_info() const { return shared_; }
Handle<Script> script() const { return script_; }
Handle<Context> context() const { return context_; }
void clear_script() { script_ = Handle<Script>::null(); }
void set_isolate(Isolate* isolate) { isolate_ = isolate; }
void set_shared_info(Handle<SharedFunctionInfo> shared) { shared_ = shared; }
......@@ -170,7 +171,7 @@ class ParseInfo {
void set_script(Handle<Script> script) { script_ = script; }
//--------------------------------------------------------------------------
LanguageMode language_mode() {
LanguageMode language_mode() const {
return construct_language_mode(is_strict_mode());
}
void set_language_mode(LanguageMode language_mode) {
......@@ -185,7 +186,9 @@ class ParseInfo {
}
#ifdef DEBUG
bool script_is_native() { return script_->type() == Script::TYPE_NATIVE; }
bool script_is_native() const {
return script_->type() == Script::TYPE_NATIVE;
}
#endif // DEBUG
private:
......@@ -234,9 +237,8 @@ class ParseInfo {
AstValueFactory* ast_value_factory_; // used if available, otherwise new.
const AstRawString* function_name_;
//----------- Outputs of parsing and scope analysis ------------------------
FunctionLiteral* literal_; // produced by full parser.
DeclarationScope* scope_; // produced by scope analysis.
//----------- Output of parsing and scope analysis ------------------------
FunctionLiteral* literal_;
void SetFlag(Flag f) { flags_ |= f; }
void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; }
......
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