Rename ParserInfo::function() and CompilationInfo::function() to literal().
authortitzer <titzer@chromium.org>
Wed, 19 Aug 2015 16:51:37 +0000 (09:51 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 19 Aug 2015 16:51:51 +0000 (16:51 +0000)
R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1301583005

Cr-Commit-Position: refs/heads/master@{#30254}

37 files changed:
src/api.cc
src/arm/lithium-codegen-arm.cc
src/codegen.cc
src/compiler.cc
src/compiler.h
src/compiler/ast-graph-builder.cc
src/compiler/ast-loop-assignment-analyzer.cc
src/compiler/graph-visualizer.cc
src/compiler/linkage.cc
src/compiler/pipeline.cc
src/debug/debug-scopes.cc
src/full-codegen/arm/full-codegen-arm.cc
src/full-codegen/arm64/full-codegen-arm64.cc
src/full-codegen/full-codegen.h
src/full-codegen/ia32/full-codegen-ia32.cc
src/full-codegen/mips/full-codegen-mips.cc
src/full-codegen/mips64/full-codegen-mips64.cc
src/full-codegen/ppc/full-codegen-ppc.cc
src/full-codegen/x64/full-codegen-x64.cc
src/full-codegen/x87/full-codegen-x87.cc
src/hydrogen.cc
src/ia32/lithium-codegen-ia32.cc
src/interpreter/bytecode-generator.cc
src/lithium-allocator.cc
src/mips/lithium-codegen-mips.cc
src/mips64/lithium-codegen-mips64.cc
src/parser.cc
src/parser.h
src/ppc/lithium-codegen-ppc.cc
src/rewriter.cc
src/runtime/runtime-internal.cc
src/scopes.cc
src/typing.cc
src/x64/lithium-codegen-x64.cc
src/x87/lithium-codegen-x87.cc
test/cctest/compiler/test-loop-assignment-analysis.cc
test/cctest/test-parsing.cc

index faea623..b46d69f 100644 (file)
@@ -2002,11 +2002,11 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
   // 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());
index 31a111d..606721f 100644 (file)
@@ -104,7 +104,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index f0eec3f..c9de2b1 100644 (file)
@@ -128,7 +128,7 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
       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");
   }
@@ -137,12 +137,12 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
   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
 }
@@ -187,8 +187,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
       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();
     }
 
@@ -196,21 +195,20 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
     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());
@@ -230,7 +228,8 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
       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";
index aa56ca9..c39936c 100644 (file)
@@ -64,10 +64,10 @@ PARSE_INFO_GETTER(Handle<Script>, script)
 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)
@@ -108,6 +108,16 @@ bool CompilationInfo::has_context() const {
 }
 
 
+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()) {
@@ -210,9 +220,9 @@ Code::Flags CompilationInfo::flags() const {
 // 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());
 }
 
@@ -220,12 +230,12 @@ bool CompilationInfo::ShouldSelfOptimize() {
 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()));
 }
 
 
@@ -687,7 +697,7 @@ MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon(
   // 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());
@@ -771,12 +781,12 @@ static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
 
 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() &
@@ -787,11 +797,11 @@ static bool Renumber(ParseInfo* parse_info) {
 
 
 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;
 }
 
@@ -950,8 +960,8 @@ bool Compiler::EnsureCompiled(Handle<JSFunction> function,
 // 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.
@@ -959,7 +969,7 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
     // 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();
@@ -1018,7 +1028,7 @@ bool CompileEvalForDebugging(Handle<JSFunction> function,
     return false;
   }
 
-  FunctionLiteral* lit = info.function();
+  FunctionLiteral* lit = parse_info.literal();
   LiveEditFunctionTracker live_edit_tracker(isolate, lit);
 
   if (!CompileUnoptimizedCode(&info)) {
@@ -1081,7 +1091,7 @@ void Compiler::CompileForLiveEdit(Handle<Script> script) {
   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 =
@@ -1114,7 +1124,7 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* 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();
@@ -1143,7 +1153,7 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
 
     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
@@ -1709,7 +1719,7 @@ bool CompilationPhase::ShouldProduceTraceOutput() const {
 #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
index 6baddf1..4775111 100644 (file)
@@ -148,13 +148,15 @@ class CompilationInfo {
   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 {
@@ -172,7 +174,6 @@ class CompilationInfo {
   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());
index 2b792be..e772579 100644 (file)
@@ -601,7 +601,7 @@ void AstGraphBuilder::CreateGraphBody(bool stack_check) {
   }
 
   // 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) {
index 61ed4f2..4d1d41e 100644 (file)
@@ -21,7 +21,7 @@ ALAA::AstLoopAssignmentAnalyzer(Zone* zone, CompilationInfo* info)
 LoopAssignmentAnalysis* ALAA::Analyze() {
   LoopAssignmentAnalysis* a = new (zone()) LoopAssignmentAnalysis(zone());
   result_ = a;
-  VisitStatements(info()->function()->body());
+  VisitStatements(info()->literal()->body());
   result_ = NULL;
   return a;
 }
index 7610e60..bf3d8ed 100644 (file)
@@ -492,7 +492,7 @@ void GraphC1Visualizer::PrintIntProperty(const char* name, int value) {
 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() << ":"
index 66e5cda..2bbedac 100644 (file)
@@ -171,11 +171,11 @@ CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) {
         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()) {
index e9545b8..a528cce 100644 (file)
@@ -359,7 +359,7 @@ base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
     return name;
   } else {
     AllowHandleDereference allow_deref;
-    return info->function()->debug_name()->ToCString();
+    return info->literal()->debug_name()->ToCString();
   }
 }
 
@@ -1014,7 +1014,7 @@ Handle<Code> Pipeline::GenerateCode() {
     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();
index 62b78b4..b9204f6 100644 (file)
@@ -97,14 +97,14 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
         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);
     }
index 411721c..197a5ec 100644 (file)
@@ -112,7 +112,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -148,7 +148,7 @@ void FullCodeGenerator::Generate() {
   { 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;
@@ -1482,8 +1482,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index 9e73340..73aaf46 100644 (file)
@@ -111,7 +111,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -151,7 +151,7 @@ void FullCodeGenerator::Generate() {
   { 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) {
@@ -1469,8 +1469,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index 846a6af..34a5dc0 100644 (file)
@@ -42,7 +42,7 @@ class FullCodeGenerator: public AstVisitor {
         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()),
@@ -698,7 +698,8 @@ class FullCodeGenerator: public AstVisitor {
   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();
index 390a44b..5aa6409 100644 (file)
@@ -101,7 +101,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -139,7 +139,7 @@ void FullCodeGenerator::Generate() {
   { 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) {
@@ -1412,8 +1412,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index d3139a7..c8da77f 100644 (file)
@@ -120,7 +120,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -156,7 +156,7 @@ void FullCodeGenerator::Generate() {
   { 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;
@@ -1479,8 +1479,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index e8a46c3..231e8ba 100644 (file)
@@ -120,7 +120,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -153,7 +153,7 @@ void FullCodeGenerator::Generate() {
   { 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;
@@ -1476,8 +1476,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index c92d883..4f927f0 100644 (file)
@@ -109,7 +109,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -153,7 +153,7 @@ void FullCodeGenerator::Generate() {
     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;
@@ -1446,8 +1446,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index eda5207..7e05531 100644 (file)
@@ -100,7 +100,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -138,7 +138,7 @@ void FullCodeGenerator::Generate() {
   { 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) {
@@ -1441,8 +1441,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index 36fdd30..cfa752c 100644 (file)
@@ -101,7 +101,7 @@ void FullCodeGenerator::Generate() {
 
 #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
@@ -139,7 +139,7 @@ void FullCodeGenerator::Generate() {
   { 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) {
@@ -1405,8 +1405,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
         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 {
index d5868f3..8984a6e 100644 (file)
@@ -4411,7 +4411,7 @@ void HOptimizedGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs,
 
 
 bool HOptimizedGraphBuilder::BuildGraph() {
-  if (IsSubclassConstructor(current_info()->function()->kind())) {
+  if (IsSubclassConstructor(current_info()->literal()->kind())) {
     Bailout(kSuperReference);
     return false;
   }
@@ -4451,7 +4451,7 @@ bool HOptimizedGraphBuilder::BuildGraph() {
 
   Add<HStackCheck>(HStackCheck::kFunctionEntry);
 
-  VisitStatements(current_info()->function()->body());
+  VisitStatements(current_info()->literal()->body());
   if (HasStackOverflow()) return false;
 
   if (current_block() != NULL) {
@@ -8281,7 +8281,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
     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.
@@ -13111,7 +13111,7 @@ std::ostream& operator<<(std::ostream& os, const HEnvironment& env) {
 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",
index 82b38ae..71ad838 100644 (file)
@@ -132,7 +132,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index e5baaae..9cce681 100644 (file)
@@ -41,7 +41,7 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
   VisitDeclarations(scope()->declarations());
 
   // Visit statements in the function body.
-  VisitStatements(info->function()->body());
+  VisitStatements(info->literal()->body());
 
   set_scope(nullptr);
   return builder_.ToBytecodeArray();
index 79d6cfe..afa28bb 100644 (file)
@@ -1343,7 +1343,7 @@ void LAllocator::BuildLiveRanges() {
           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);
index 32d17ed..768531f 100644 (file)
@@ -128,7 +128,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index 50fd526..77813d5 100644 (file)
@@ -103,7 +103,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index a7a31e7..ecc6530 100644 (file)
@@ -5727,7 +5727,7 @@ bool RegExpParser::ParseRegExp(Isolate* isolate, Zone* zone,
 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;
@@ -5735,7 +5735,7 @@ bool Parser::ParseStatic(ParseInfo* info) {
 
 
 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_);
@@ -5770,7 +5770,7 @@ bool Parser::Parse(ParseInfo* info) {
 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());
 
index 3d90718..a0be1df 100644 (file)
@@ -104,9 +104,6 @@ class ParseInfo {
     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; }
 
index afc5a69..6afa75d 100644 (file)
@@ -105,7 +105,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index d34ca5c..f7b0ce0 100644 (file)
@@ -210,7 +210,7 @@ EXPRESSION_NODE_LIST(DEF_VISIT)
 // 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);
index 57a10a3..01e3e91 100644 (file)
@@ -263,7 +263,7 @@ RUNTIME_FUNCTION(Runtime_RenderCallSite) {
     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);
 }
 
index 466ed9a..8f82146 100644 (file)
@@ -258,9 +258,9 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
 
 
 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
index 237c79f..204ace6 100644 (file)
@@ -38,7 +38,7 @@ void AstTyper::Run(CompilationInfo* info) {
   Scope* scope = info->scope();
 
   RECURSE(visitor->VisitDeclarations(scope->declarations()));
-  RECURSE(visitor->VisitStatements(info->function()->body()));
+  RECURSE(visitor->VisitStatements(info->literal()->body()));
 }
 
 #undef RECURSE
index 0398d7f..b936edc 100644 (file)
@@ -120,7 +120,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index 092df73..012efd0 100644 (file)
@@ -101,7 +101,7 @@ bool LCodeGen::GeneratePrologue() {
 
 #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
index ad05273..b59f181 100644 (file)
@@ -36,7 +36,7 @@ struct TestHelper : public HandleAndZoneScope {
     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);
 
index f9d210c..ac52dfd 100644 (file)
@@ -1070,9 +1070,9 @@ TEST(ScopeUsesArgumentsSuperThis) {
       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());
 
@@ -1369,10 +1369,10 @@ TEST(ScopePositions) {
     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);
@@ -1506,7 +1506,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
     SetParserFlags(&parser, flags);
     info.set_global();
     parser.Parse(&info);
-    function = info.function();
+    function = info.literal();
     if (function) {
       parser_materialized_literals = function->materialized_literal_count();
     }
@@ -3444,9 +3444,9 @@ TEST(InnerAssignment) {
           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 =
@@ -5506,7 +5506,7 @@ TEST(ModuleParsingInternals) {
   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());
@@ -5630,8 +5630,8 @@ void TestLanguageMode(const char* source,
   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());
 }