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

Side by Side Diff: src/scopeinfo.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/scopeinfo.h" 10 #include "src/scopeinfo.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 scope_info->SetFlags(flags); 94 scope_info->SetFlags(flags);
95 scope_info->SetParameterCount(parameter_count); 95 scope_info->SetParameterCount(parameter_count);
96 scope_info->SetStackLocalCount(stack_local_count); 96 scope_info->SetStackLocalCount(stack_local_count);
97 scope_info->SetContextLocalCount(context_local_count); 97 scope_info->SetContextLocalCount(context_local_count);
98 scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count); 98 scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count);
99 99
100 int index = kVariablePartIndex; 100 int index = kVariablePartIndex;
101 // Add parameters. 101 // Add parameters.
102 DCHECK(index == scope_info->ParameterEntriesIndex()); 102 DCHECK(index == scope_info->ParameterEntriesIndex());
103 for (int i = 0; i < parameter_count; ++i) { 103 for (int i = 0; i < parameter_count; ++i) {
104 scope_info->set(index++, *scope->parameter(i)->name()); 104 scope_info->set(index++, *scope->parameter_var(i)->name());
105 } 105 }
106 106
107 // Add stack locals' names. We are assuming that the stack locals' 107 // Add stack locals' names. We are assuming that the stack locals'
108 // slots are allocated in increasing order, so we can simply add 108 // slots are allocated in increasing order, so we can simply add
109 // them to the ScopeInfo object. 109 // them to the ScopeInfo object.
110 int first_slot_index; 110 int first_slot_index;
111 if (stack_local_count > 0) { 111 if (stack_local_count > 0) {
112 first_slot_index = stack_locals[0]->index(); 112 first_slot_index = stack_locals[0]->index();
113 } else { 113 } else {
114 first_slot_index = 0; 114 first_slot_index = 0;
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 info->set_mode(i, var->mode()); 789 info->set_mode(i, var->mode());
790 DCHECK(var->index() >= 0); 790 DCHECK(var->index() >= 0);
791 info->set_index(i, var->index()); 791 info->set_index(i, var->index());
792 } 792 }
793 DCHECK(i == info->length()); 793 DCHECK(i == info->length());
794 return info; 794 return info;
795 } 795 }
796 796
797 } // namespace internal 797 } // namespace internal
798 } // namespace v8 798 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698