// Do the parsing tasks which need to be done on the main thread. This will
// also handle parse errors.
source->parser->Internalize(isolate, script,
- source->info->function() == nullptr);
+ source->info->literal() == nullptr);
source->parser->HandleSourceURLComments(isolate, script);
i::Handle<i::SharedFunctionInfo> result;
- if (source->info->function() != nullptr) {
+ if (source->info->literal() != nullptr) {
// Parsing has succeeded.
result = i::Compiler::CompileStreamedScript(script, source->info.get(),
str->length());
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop_at");
}
#endif
PrintF("%s", name == NULL ? "<unknown>" : name);
} else {
AllowDeferredHandleDereference allow_deference_for_trace;
- PrintF("%s", info->function()->debug_name()->ToCString().get());
+ PrintF("%s", info->literal()->debug_name()->ToCString().get());
}
PrintF("]\n");
}
if (info->parse_info() && print_source) {
PrintF("--- Source from AST ---\n%s\n",
PrettyPrinter(info->isolate(), info->zone())
- .PrintProgram(info->function()));
+ .PrintProgram(info->literal()));
}
if (info->parse_info() && print_ast) {
PrintF("--- AST ---\n%s\n", AstPrinter(info->isolate(), info->zone())
- .PrintProgram(info->function()));
+ .PrintProgram(info->literal()));
}
#endif // DEBUG
}
CodeStub::Major major_key = info->code_stub()->MajorKey();
debug_name = CodeStub::MajorName(major_key, false);
} else {
- debug_name_holder =
- info->parse_info()->function()->debug_name()->ToCString();
+ debug_name_holder = info->literal()->debug_name()->ToCString();
debug_name = debug_name_holder.get();
}
OFStream os(tracing_scope.file());
// Print the source code if available.
- FunctionLiteral* function = nullptr;
bool print_source =
info->parse_info() && (code->kind() == Code::OPTIMIZED_FUNCTION ||
code->kind() == Code::FUNCTION);
if (print_source) {
- function = info->function();
+ FunctionLiteral* literal = info->literal();
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
os << "--- Raw source ---\n";
StringCharacterStream stream(String::cast(script->source()),
- function->start_position());
+ literal->start_position());
// fun->end_position() points to the last character in the stream. We
// need to compensate by adding one to calculate the length.
int source_len =
- function->end_position() - function->start_position() + 1;
+ literal->end_position() - literal->start_position() + 1;
for (int i = 0; i < source_len; i++) {
if (stream.HasMore()) {
os << AsReversiblyEscapedUC16(stream.GetNext());
os << "--- Code ---\n";
}
if (print_source) {
- os << "source_position = " << function->start_position() << "\n";
+ FunctionLiteral* literal = info->literal();
+ os << "source_position = " << literal->start_position() << "\n";
}
code->Disassemble(debug_name, os);
os << "--- End code ---\n";
PARSE_INFO_GETTER(bool, is_eval)
PARSE_INFO_GETTER(bool, is_native)
PARSE_INFO_GETTER(bool, is_module)
+PARSE_INFO_GETTER(FunctionLiteral*, literal)
PARSE_INFO_GETTER_WITH_DEFAULT(LanguageMode, language_mode, STRICT)
PARSE_INFO_GETTER_WITH_DEFAULT(Handle<JSFunction>, closure,
Handle<JSFunction>::null())
-PARSE_INFO_GETTER(FunctionLiteral*, function)
PARSE_INFO_GETTER_WITH_DEFAULT(Scope*, scope, nullptr)
PARSE_INFO_GETTER(Handle<Context>, context)
PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info)
}
+bool CompilationInfo::has_literal() const {
+ return parse_info_ && parse_info_->literal() != nullptr;
+}
+
+
+bool CompilationInfo::has_scope() const {
+ return parse_info_ && parse_info_->scope() != nullptr;
+}
+
+
CompilationInfo::CompilationInfo(ParseInfo* parse_info)
: CompilationInfo(parse_info, nullptr, BASE, parse_info->isolate(),
parse_info->zone()) {
// for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
bool CompilationInfo::ShouldSelfOptimize() {
return FLAG_crankshaft &&
- !(function()->flags() & AstProperties::kDontSelfOptimize) &&
- !function()->dont_optimize() &&
- function()->scope()->AllowsLazyCompilation() &&
+ !(literal()->flags() & AstProperties::kDontSelfOptimize) &&
+ !literal()->dont_optimize() &&
+ literal()->scope()->AllowsLazyCompilation() &&
(!has_shared_info() || !shared_info()->optimization_disabled());
}
void CompilationInfo::EnsureFeedbackVector() {
if (feedback_vector_.is_null()) {
feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector(
- function()->feedback_vector_spec());
+ literal()->feedback_vector_spec());
}
// It's very important that recompiles do not alter the structure of the
// type feedback vector.
- CHECK(!feedback_vector_->SpecDiffersFrom(function()->feedback_vector_spec()));
+ CHECK(!feedback_vector_->SpecDiffersFrom(literal()->feedback_vector_spec()));
}
// Parse and update CompilationInfo with the results.
if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>();
Handle<SharedFunctionInfo> shared = info->shared_info();
- FunctionLiteral* lit = info->function();
+ FunctionLiteral* lit = info->literal();
shared->set_language_mode(lit->language_mode());
SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
MaybeDisableOptimization(shared, lit->dont_optimize_reason());
static bool Renumber(ParseInfo* parse_info) {
if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(),
- parse_info->function())) {
+ parse_info->literal())) {
return false;
}
Handle<SharedFunctionInfo> shared_info = parse_info->shared_info();
if (!shared_info.is_null()) {
- FunctionLiteral* lit = parse_info->function();
+ FunctionLiteral* lit = parse_info->literal();
shared_info->set_ast_node_count(lit->ast_node_count());
MaybeDisableOptimization(shared_info, lit->dont_optimize_reason());
shared_info->set_dont_crankshaft(lit->flags() &
bool Compiler::Analyze(ParseInfo* info) {
- DCHECK(info->function() != NULL);
+ DCHECK_NOT_NULL(info->literal());
if (!Rewriter::Rewrite(info)) return false;
if (!Scope::Analyze(info)) return false;
if (!Renumber(info)) return false;
- DCHECK(info->scope() != NULL);
+ DCHECK_NOT_NULL(info->scope());
return true;
}
// TODO(turbofan): In the future, unoptimized code with deopt support could
// be generated lazily once deopt is triggered.
bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
- DCHECK(info->function() != NULL);
- DCHECK(info->scope() != NULL);
+ DCHECK_NOT_NULL(info->literal());
+ DCHECK(info->has_scope());
Handle<SharedFunctionInfo> shared = info->shared_info();
if (!shared->has_deoptimization_support()) {
// TODO(titzer): just reuse the ParseInfo for the unoptimized compile.
// Note that we use the same AST that we will use for generating the
// optimized code.
ParseInfo* parse_info = unoptimized.parse_info();
- parse_info->set_literal(info->function());
+ parse_info->set_literal(info->literal());
parse_info->set_scope(info->scope());
parse_info->set_context(info->context());
unoptimized.EnableDeoptimizationSupport();
return false;
}
- FunctionLiteral* lit = info.function();
+ FunctionLiteral* lit = parse_info.literal();
LiveEditFunctionTracker live_edit_tracker(isolate, lit);
if (!CompileUnoptimizedCode(&info)) {
info.parse_info()->set_global();
if (!Parser::ParseStatic(info.parse_info())) return;
- LiveEditFunctionTracker tracker(info.isolate(), info.function());
+ LiveEditFunctionTracker tracker(info.isolate(), parse_info.literal());
if (!CompileUnoptimizedCode(&info)) return;
if (info.has_shared_info()) {
Handle<ScopeInfo> scope_info =
{ VMState<COMPILER> state(info->isolate());
if (parse_info->literal() == NULL) {
- // Parse the script if needed (if it's already parsed, function() is
+ // Parse the script if needed (if it's already parsed, literal() is
// non-NULL). If compiling for debugging, we may eagerly compile inner
// functions, so do not parse lazily in that case.
ScriptCompiler::CompileOptions options = parse_info->compile_options();
info->MarkAsFirstCompile();
- FunctionLiteral* lit = info->function();
+ FunctionLiteral* lit = parse_info->literal();
LiveEditFunctionTracker live_edit_tracker(isolate, lit);
// Measure how long it takes to do the compilation; only take the
#if DEBUG
void CompilationInfo::PrintAstForTesting() {
PrintF("--- Source from AST ---\n%s\n",
- PrettyPrinter(isolate(), zone()).PrintProgram(function()));
+ PrettyPrinter(isolate(), zone()).PrintProgram(literal()));
}
#endif
} // namespace internal
bool is_module() const;
LanguageMode language_mode() const;
Handle<JSFunction> closure() const;
- FunctionLiteral* function() const;
+ FunctionLiteral* literal() const;
Scope* scope() const;
bool MayUseThis() const;
Handle<Context> context() const;
Handle<SharedFunctionInfo> shared_info() const;
bool has_shared_info() const;
bool has_context() const;
+ bool has_literal() const;
+ bool has_scope() const;
// -----------------------------------------------------------
Isolate* isolate() const {
bool is_this_defined() const;
int num_heap_slots() const;
Code::Flags flags() const;
- bool has_scope() const { return scope() != nullptr; }
void set_parameter_count(int parameter_count) {
DCHECK(IsStub());
}
// Visit statements in the function body.
- VisitStatements(info()->function()->body());
+ VisitStatements(info()->literal()->body());
// Emit tracing call if requested to do so.
if (FLAG_trace) {
LoopAssignmentAnalysis* ALAA::Analyze() {
LoopAssignmentAnalysis* a = new (zone()) LoopAssignmentAnalysis(zone());
result_ = a;
- VisitStatements(info()->function()->body());
+ VisitStatements(info()->literal()->body());
result_ = NULL;
return a;
}
void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) {
Tag tag(this, "compilation");
if (info->IsOptimizing()) {
- Handle<String> name = info->function()->debug_name();
+ Handle<String> name = info->literal()->debug_name();
PrintStringProperty("name", name->ToCString().get());
PrintIndent();
os_ << "method \"" << name->ToCString().get() << ":"
info->isolate(), zone, descriptor, stub->GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties);
}
- if (info->function() != NULL) {
+ if (info->has_literal()) {
// If we already have the function literal, use the number of parameters
// plus the receiver.
return GetJSCallDescriptor(zone, info->is_osr(),
- 1 + info->function()->parameter_count(),
+ 1 + info->literal()->parameter_count(),
CallDescriptor::kNoFlags);
}
if (!info->closure().is_null()) {
return name;
} else {
AllowHandleDereference allow_deref;
- return info->function()->debug_name()->ToCString();
+ return info->literal()->debug_name()->ToCString();
}
}
if (json_file != nullptr) {
OFStream json_of(json_file);
Handle<Script> script = info()->script();
- FunctionLiteral* function = info()->function();
+ FunctionLiteral* function = info()->literal();
base::SmartArrayPointer<char> function_name =
info()->shared_info()->DebugName()->ToCString();
int pos = info()->shared_info()->start_position();
info.set_context(Handle<Context>(function->context()));
}
if (Parser::ParseStatic(&info) && Scope::Analyze(&info)) {
- scope = info.function()->scope();
+ scope = info.literal()->scope();
}
RetrieveScopeChain(scope, shared_info);
} else {
// Function code
ParseInfo info(&zone, function);
if (Parser::ParseStatic(&info) && Scope::Analyze(&info)) {
- scope = info.function()->scope();
+ scope = info.literal()->scope();
}
RetrieveScopeChain(scope, shared_info);
}
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop-at");
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0);
if (locals_count > 0) {
if (locals_count >= 128) {
Label ok;
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ Debug("stop-at", __LINE__, BREAK);
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0);
if (locals_count > 0) {
if (locals_count >= 128) {
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
globals_(NULL),
context_(NULL),
bailout_entries_(info->HasDeoptimizationSupport()
- ? info->function()->ast_node_count()
+ ? info->literal()->ast_node_count()
: 0,
info->zone()),
back_edges_(2, info->zone()),
bool is_native() { return info_->is_native(); }
LanguageMode language_mode() { return function()->language_mode(); }
bool has_simple_parameters() { return info_->has_simple_parameters(); }
- FunctionLiteral* function() { return info_->function(); }
+ // TODO(titzer): rename this to literal().
+ FunctionLiteral* function() { return info_->literal(); }
Scope* scope() { return scope_; }
static Register result_register();
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ int3();
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(function()->kind()) || locals_count == 0);
if (locals_count == 1) {
__ push(Immediate(isolate()->factory()->undefined_value()));
} else if (locals_count > 1) {
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(function() != nullptr &&
+ (function()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop-at");
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0);
if (locals_count > 0) {
if (locals_count >= 128) {
Label ok;
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop-at");
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0);
if (locals_count > 0) {
if (locals_count >= 128) {
Label ok;
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop-at");
}
#endif
Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0);
if (locals_count > 0) {
if (locals_count >= 128) {
Label ok;
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ int3();
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0);
if (locals_count == 1) {
__ PushRoot(Heap::kUndefinedValueRootIndex);
} else if (locals_count > 1) {
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ int3();
}
#endif
{ Comment cmnt(masm_, "[ Allocate locals");
int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots.
- DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
+ DCHECK(!IsGeneratorFunction(function()->kind()) || locals_count == 0);
if (locals_count == 1) {
__ push(Immediate(isolate()->factory()->undefined_value()));
} else if (locals_count > 1) {
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
skip_init_check = false;
} else if (var->is_this()) {
- CHECK(info_->function() != nullptr &&
- (info_->function()->kind() & kSubclassConstructor) != 0);
+ CHECK(info_->has_literal() &&
+ (info_->literal()->kind() & kSubclassConstructor) != 0);
// TODO(dslomov): implement 'this' hole check elimination.
skip_init_check = false;
} else {
bool HOptimizedGraphBuilder::BuildGraph() {
- if (IsSubclassConstructor(current_info()->function()->kind())) {
+ if (IsSubclassConstructor(current_info()->literal()->kind())) {
Bailout(kSuperReference);
return false;
}
Add<HStackCheck>(HStackCheck::kFunctionEntry);
- VisitStatements(current_info()->function()->body());
+ VisitStatements(current_info()->literal()->body());
if (HasStackOverflow()) return false;
if (current_block() != NULL) {
TraceInline(target, caller, "target has context-allocated variables");
return false;
}
- FunctionLiteral* function = target_info.function();
+ FunctionLiteral* function = target_info.literal();
// The following conditions must be checked again after re-parsing, because
// earlier the information might not have been complete due to lazy parsing.
void HTracer::TraceCompilation(CompilationInfo* info) {
Tag tag(this, "compilation");
if (info->IsOptimizing()) {
- Handle<String> name = info->function()->debug_name();
+ Handle<String> name = info->literal()->debug_name();
PrintStringProperty("name", name->ToCString().get());
PrintIndent();
trace_.Add("method \"%s:%d\"\n",
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ int3();
}
#endif
VisitDeclarations(scope()->declarations());
// Visit statements in the function body.
- VisitStatements(info->function()->body());
+ VisitStatements(info->literal()->body());
set_scope(nullptr);
return builder_.ToBytecodeArray();
DCHECK(chunk_->info()->IsOptimizing());
AllowHandleDereference allow_deref;
PrintF("Function: %s\n",
- chunk_->info()->function()->debug_name()->ToCString().get());
+ chunk_->info()->literal()->debug_name()->ToCString().get());
}
PrintF("Value %d used before first definition!\n", operand_index);
LiveRange* range = LiveRangeFor(operand_index);
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop_at");
}
#endif
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop_at");
}
#endif
bool Parser::ParseStatic(ParseInfo* info) {
Parser parser(info);
if (parser.Parse(info)) {
- info->set_language_mode(info->function()->language_mode());
+ info->set_language_mode(info->literal()->language_mode());
return true;
}
return false;
bool Parser::Parse(ParseInfo* info) {
- DCHECK(info->function() == NULL);
+ DCHECK(info->literal() == NULL);
FunctionLiteral* result = NULL;
// Ok to use Isolate here; this function is only called in the main thread.
DCHECK(parsing_on_main_thread_);
void Parser::ParseOnBackground(ParseInfo* info) {
parsing_on_main_thread_ = false;
- DCHECK(info->function() == NULL);
+ DCHECK(info->literal() == NULL);
FunctionLiteral* result = NULL;
fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
ast_value_factory_ = ast_value_factory;
}
- FunctionLiteral* function() { // TODO(titzer): temporary name adapter
- return literal_;
- }
FunctionLiteral* literal() { return literal_; }
void set_literal(FunctionLiteral* literal) { literal_ = literal; }
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ stop("stop_at");
}
#endif
// Assumes code has been parsed. Mutates the AST, so the AST should not
// continue to be used in the case of failure.
bool Rewriter::Rewrite(ParseInfo* info) {
- FunctionLiteral* function = info->function();
+ FunctionLiteral* function = info->literal();
DCHECK(function != NULL);
Scope* scope = function->scope();
DCHECK(scope != NULL);
return isolate->heap()->empty_string();
}
CallPrinter printer(isolate, &zone);
- const char* string = printer.Print(info->function(), location.start_pos());
+ const char* string = printer.Print(info->literal(), location.start_pos());
return *isolate->factory()->NewStringFromAsciiChecked(string);
}
bool Scope::Analyze(ParseInfo* info) {
- DCHECK(info->function() != NULL);
+ DCHECK(info->literal() != NULL);
DCHECK(info->scope() == NULL);
- Scope* scope = info->function()->scope();
+ Scope* scope = info->literal()->scope();
Scope* top = scope;
// Traverse the scope tree up to the first unresolved scope or the global
Scope* scope = info->scope();
RECURSE(visitor->VisitDeclarations(scope->declarations()));
- RECURSE(visitor->VisitStatements(info->function()->body()));
+ RECURSE(visitor->VisitStatements(info->literal()->body()));
}
#undef RECURSE
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ int3();
}
#endif
#ifdef DEBUG
if (strlen(FLAG_stop_at) > 0 &&
- info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
+ info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
__ int3();
}
#endif
CHECK(Rewriter::Rewrite(&parse_info));
CHECK(Scope::Analyze(&parse_info));
- Scope* scope = info.function()->scope();
+ Scope* scope = info.literal()->scope();
AstValueFactory* factory = parse_info.ast_value_factory();
CHECK(scope);
CHECK(parser.Parse(&info));
CHECK(i::Rewriter::Rewrite(&info));
CHECK(i::Scope::Analyze(&info));
- CHECK(info.function() != NULL);
+ CHECK(info.literal() != NULL);
- i::Scope* script_scope = info.function()->scope();
+ i::Scope* script_scope = info.literal()->scope();
CHECK(script_scope->is_script_scope());
CHECK_EQ(1, script_scope->inner_scopes()->length());
info.set_global();
info.set_language_mode(source_data[i].language_mode);
parser.Parse(&info);
- CHECK(info.function() != NULL);
+ CHECK(info.literal() != NULL);
// Check scope types and positions.
- i::Scope* scope = info.function()->scope();
+ i::Scope* scope = info.literal()->scope();
CHECK(scope->is_script_scope());
CHECK_EQ(scope->start_position(), 0);
CHECK_EQ(scope->end_position(), kProgramSize);
SetParserFlags(&parser, flags);
info.set_global();
parser.Parse(&info);
- function = info.function();
+ function = info.literal();
if (function) {
parser_materialized_literals = function->materialized_literal_count();
}
i::Parser parser(&info);
CHECK(parser.Parse(&info));
CHECK(i::Compiler::Analyze(&info));
- CHECK(info.function() != NULL);
+ CHECK(info.literal() != NULL);
- i::Scope* scope = info.function()->scope();
+ i::Scope* scope = info.literal()->scope();
CHECK_EQ(scope->inner_scopes()->length(), 1);
i::Scope* inner_scope = scope->inner_scopes()->at(0);
const i::AstRawString* var_name =
info.set_module();
CHECK(parser.Parse(&info));
CHECK(i::Compiler::Analyze(&info));
- i::FunctionLiteral* func = info.function();
+ i::FunctionLiteral* func = info.literal();
i::Scope* module_scope = func->scope();
i::Scope* outer_scope = module_scope->outer_scope();
CHECK(outer_scope->is_script_scope());
parser.set_allow_strong_mode(true);
info.set_global();
parser.Parse(&info);
- CHECK(info.function() != NULL);
- CHECK_EQ(expected_language_mode, info.function()->language_mode());
+ CHECK(info.literal() != NULL);
+ CHECK_EQ(expected_language_mode, info.literal()->language_mode());
}