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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1189743003: [destructuring] Implement parameter pattern matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // Gets the bailout id just before reading a variable proxy, but only for 660 // Gets the bailout id just before reading a variable proxy, but only for
661 // unallocated variables. 661 // unallocated variables.
662 static BailoutId BeforeId(VariableProxy* proxy) { 662 static BailoutId BeforeId(VariableProxy* proxy) {
663 return proxy->var()->location() == Variable::UNALLOCATED ? proxy->BeforeId() 663 return proxy->var()->location() == Variable::UNALLOCATED ? proxy->BeforeId()
664 : BailoutId::None(); 664 : BailoutId::None();
665 } 665 }
666 666
667 667
668 static const char* GetDebugParameterName(Zone* zone, Scope* scope, int index) { 668 static const char* GetDebugParameterName(Zone* zone, Scope* scope, int index) {
669 #if DEBUG 669 #if DEBUG
670 const AstRawString* name = scope->parameter(index)->raw_name(); 670 const AstRawString* name = scope->parameter_var(index)->raw_name();
671 if (name && name->length() > 0) { 671 if (name && name->length() > 0) {
672 char* data = zone->NewArray<char>(name->length() + 1); 672 char* data = zone->NewArray<char>(name->length() + 1);
673 data[name->length()] = 0; 673 data[name->length()] = 0;
674 memcpy(data, name->raw_data(), name->length()); 674 memcpy(data, name->raw_data(), name->length());
675 return data; 675 return data;
676 } 676 }
677 #endif 677 #endif
678 return nullptr; 678 return nullptr;
679 } 679 }
680 680
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 // Context variable (at bottom of the context chain). 3047 // Context variable (at bottom of the context chain).
3048 Variable* variable = scope->receiver(); 3048 Variable* variable = scope->receiver();
3049 DCHECK_EQ(0, scope->ContextChainLength(variable->scope())); 3049 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
3050 const Operator* op = javascript()->StoreContext(0, variable->index()); 3050 const Operator* op = javascript()->StoreContext(0, variable->index());
3051 NewNode(op, local_context, patched_receiver); 3051 NewNode(op, local_context, patched_receiver);
3052 } 3052 }
3053 3053
3054 // Copy parameters into context if necessary. 3054 // Copy parameters into context if necessary.
3055 int num_parameters = scope->num_parameters(); 3055 int num_parameters = scope->num_parameters();
3056 for (int i = 0; i < num_parameters; i++) { 3056 for (int i = 0; i < num_parameters; i++) {
3057 Variable* variable = scope->parameter(i); 3057 Variable* variable = scope->parameter_var(i);
3058 if (!variable->IsContextSlot()) continue; 3058 if (!variable->IsContextSlot()) continue;
3059 // Temporary parameter node. The parameter indices are shifted by 1 3059 // Temporary parameter node. The parameter indices are shifted by 1
3060 // (receiver is parameter index -1 but environment index 0). 3060 // (receiver is parameter index -1 but environment index 0).
3061 Node* parameter = NewNode(common()->Parameter(i + 1), graph()->start()); 3061 Node* parameter = NewNode(common()->Parameter(i + 1), graph()->start());
3062 // Context variable (at bottom of the context chain). 3062 // Context variable (at bottom of the context chain).
3063 DCHECK_EQ(0, scope->ContextChainLength(variable->scope())); 3063 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
3064 const Operator* op = javascript()->StoreContext(0, variable->index()); 3064 const Operator* op = javascript()->StoreContext(0, variable->index());
3065 NewNode(op, local_context, parameter); 3065 NewNode(op, local_context, parameter);
3066 } 3066 }
3067 3067
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4061 // Phi does not exist yet, introduce one. 4061 // Phi does not exist yet, introduce one.
4062 value = NewPhi(inputs, value, control); 4062 value = NewPhi(inputs, value, control);
4063 value->ReplaceInput(inputs - 1, other); 4063 value->ReplaceInput(inputs - 1, other);
4064 } 4064 }
4065 return value; 4065 return value;
4066 } 4066 }
4067 4067
4068 } // namespace compiler 4068 } // namespace compiler
4069 } // namespace internal 4069 } // namespace internal
4070 } // namespace v8 4070 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/hydrogen.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698