OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 | 612 |
613 // Sets the function info on a function. | 613 // Sets the function info on a function. |
614 // The start_position points to the first '(' character after the function name | 614 // The start_position points to the first '(' character after the function name |
615 // in the full script source. When counting characters in the script source the | 615 // in the full script source. When counting characters in the script source the |
616 // the first character is number 0 (not 1). | 616 // the first character is number 0 (not 1). |
617 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, | 617 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
618 FunctionLiteral* lit, | 618 FunctionLiteral* lit, |
619 bool is_toplevel, | 619 bool is_toplevel, |
620 Handle<Script> script) { | 620 Handle<Script> script) { |
621 function_info->set_length(lit->parameter_count()); | 621 function_info->set_length(lit->parameter_count()); |
622 function_info->set_formal_parameter_count(lit->parameter_count()); | 622 if (FLAG_experimental_classes && IsSubclassConstructor(lit->kind())) { |
623 function_info->set_formal_parameter_count(lit->parameter_count() + 1); | |
arv (Not doing code reviews)
2015/02/09 17:44:39
I'm worried about doing it at this high abstractio
| |
624 } else { | |
625 function_info->set_formal_parameter_count(lit->parameter_count()); | |
626 } | |
623 function_info->set_script(*script); | 627 function_info->set_script(*script); |
624 function_info->set_function_token_position(lit->function_token_position()); | 628 function_info->set_function_token_position(lit->function_token_position()); |
625 function_info->set_start_position(lit->start_position()); | 629 function_info->set_start_position(lit->start_position()); |
626 function_info->set_end_position(lit->end_position()); | 630 function_info->set_end_position(lit->end_position()); |
627 function_info->set_is_expression(lit->is_expression()); | 631 function_info->set_is_expression(lit->is_expression()); |
628 function_info->set_is_anonymous(lit->is_anonymous()); | 632 function_info->set_is_anonymous(lit->is_anonymous()); |
629 function_info->set_is_toplevel(is_toplevel); | 633 function_info->set_is_toplevel(is_toplevel); |
630 function_info->set_inferred_name(*lit->inferred_name()); | 634 function_info->set_inferred_name(*lit->inferred_name()); |
631 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); | 635 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); |
632 function_info->set_allows_lazy_compilation_without_context( | 636 function_info->set_allows_lazy_compilation_without_context( |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1609 } | 1613 } |
1610 | 1614 |
1611 | 1615 |
1612 #if DEBUG | 1616 #if DEBUG |
1613 void CompilationInfo::PrintAstForTesting() { | 1617 void CompilationInfo::PrintAstForTesting() { |
1614 PrintF("--- Source from AST ---\n%s\n", | 1618 PrintF("--- Source from AST ---\n%s\n", |
1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1619 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1616 } | 1620 } |
1617 #endif | 1621 #endif |
1618 } } // namespace v8::internal | 1622 } } // namespace v8::internal |
OLD | NEW |