Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/compiler.cc

Issue 816913003: Implement ES6 rest parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable optimization of functions with rest parameters in parser Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 306
307 void CompilationInfo::EnsureFeedbackVector() { 307 void CompilationInfo::EnsureFeedbackVector() {
308 if (feedback_vector_.is_null()) { 308 if (feedback_vector_.is_null()) {
309 feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector( 309 feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector(
310 function()->feedback_vector_spec()); 310 function()->feedback_vector_spec());
311 } 311 }
312 } 312 }
313 313
314 314
315 bool CompilationInfo::is_simple_parameter_list() {
316 return scope_->is_simple_parameter_list();
317 }
318
319
315 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { 320 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
316 public: 321 public:
317 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) 322 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info)
318 : HOptimizedGraphBuilder(info) { 323 : HOptimizedGraphBuilder(info) {
319 } 324 }
320 325
321 #define DEF_VISIT(type) \ 326 #define DEF_VISIT(type) \
322 void Visit##type(type* node) OVERRIDE { \ 327 void Visit##type(type* node) OVERRIDE { \
323 if (node->position() != RelocInfo::kNoPosition) { \ 328 if (node->position() != RelocInfo::kNoPosition) { \
324 SetSourcePosition(node->position()); \ 329 SetSourcePosition(node->position()); \
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 616
612 617
613 // Sets the function info on a function. 618 // Sets the function info on a function.
614 // The start_position points to the first '(' character after the function name 619 // 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 620 // in the full script source. When counting characters in the script source the
616 // the first character is number 0 (not 1). 621 // the first character is number 0 (not 1).
617 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, 622 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info,
618 FunctionLiteral* lit, 623 FunctionLiteral* lit,
619 bool is_toplevel, 624 bool is_toplevel,
620 Handle<Script> script) { 625 Handle<Script> script) {
621 function_info->set_length(lit->parameter_count()); 626 function_info->set_length(lit->scope()->default_function_length());
622 function_info->set_formal_parameter_count(lit->parameter_count()); 627 function_info->set_formal_parameter_count(lit->parameter_count());
623 function_info->set_script(*script); 628 function_info->set_script(*script);
624 function_info->set_function_token_position(lit->function_token_position()); 629 function_info->set_function_token_position(lit->function_token_position());
625 function_info->set_start_position(lit->start_position()); 630 function_info->set_start_position(lit->start_position());
626 function_info->set_end_position(lit->end_position()); 631 function_info->set_end_position(lit->end_position());
627 function_info->set_is_expression(lit->is_expression()); 632 function_info->set_is_expression(lit->is_expression());
628 function_info->set_is_anonymous(lit->is_anonymous()); 633 function_info->set_is_anonymous(lit->is_anonymous());
629 function_info->set_is_toplevel(is_toplevel); 634 function_info->set_is_toplevel(is_toplevel);
630 function_info->set_inferred_name(*lit->inferred_name()); 635 function_info->set_inferred_name(*lit->inferred_name());
631 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); 636 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation());
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 } 1614 }
1610 1615
1611 1616
1612 #if DEBUG 1617 #if DEBUG
1613 void CompilationInfo::PrintAstForTesting() { 1618 void CompilationInfo::PrintAstForTesting() {
1614 PrintF("--- Source from AST ---\n%s\n", 1619 PrintF("--- Source from AST ---\n%s\n",
1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1620 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1616 } 1621 }
1617 #endif 1622 #endif
1618 } } // namespace v8::internal 1623 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698