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

Side by Side Diff: src/scopeinfo.cc

Issue 1161393007: OLD type Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix 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
« no previous file with comments | « src/scanner.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/scopeinfo.h" 9 #include "src/scopeinfo.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); 79 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length);
80 80
81 // Encode the flags. 81 // Encode the flags.
82 int flags = ScopeTypeField::encode(scope->scope_type()) | 82 int flags = ScopeTypeField::encode(scope->scope_type()) |
83 CallsEvalField::encode(scope->calls_eval()) | 83 CallsEvalField::encode(scope->calls_eval()) |
84 LanguageModeField::encode(scope->language_mode()) | 84 LanguageModeField::encode(scope->language_mode()) |
85 ReceiverVariableField::encode(receiver_info) | 85 ReceiverVariableField::encode(receiver_info) |
86 FunctionVariableField::encode(function_name_info) | 86 FunctionVariableField::encode(function_name_info) |
87 FunctionVariableMode::encode(function_variable_mode) | 87 FunctionVariableMode::encode(function_variable_mode) |
88 AsmModuleField::encode(scope->asm_module()) | 88 AsmModuleField::encode(scope->asm_module()) |
89 AsmFunctionField::encode(scope->asm_function()) | 89 AsmFunctionField::encode(scope->asm_module()) |
90 IsSimpleParameterListField::encode(simple_parameter_list) | 90 IsSimpleParameterListField::encode(simple_parameter_list) |
91 BlockScopeIsClassScopeField::encode(scope->is_class_scope()) | 91 BlockScopeIsClassScopeField::encode(scope->is_class_scope()) |
92 FunctionKindField::encode(scope->function_kind()); 92 FunctionKindField::encode(scope->function_kind());
93 scope_info->SetFlags(flags); 93 scope_info->SetFlags(flags);
94 scope_info->SetParameterCount(parameter_count); 94 scope_info->SetParameterCount(parameter_count);
95 scope_info->SetStackLocalCount(stack_local_count); 95 scope_info->SetStackLocalCount(stack_local_count);
96 scope_info->SetContextLocalCount(context_local_count); 96 scope_info->SetContextLocalCount(context_local_count);
97 scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count); 97 scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count);
98 98
99 int index = kVariablePartIndex; 99 int index = kVariablePartIndex;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 bool ScopeInfo::CallsEval() { 206 bool ScopeInfo::CallsEval() {
207 return length() > 0 && CallsEvalField::decode(Flags()); 207 return length() > 0 && CallsEvalField::decode(Flags());
208 } 208 }
209 209
210 210
211 LanguageMode ScopeInfo::language_mode() { 211 LanguageMode ScopeInfo::language_mode() {
212 return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY; 212 return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY;
213 } 213 }
214 214
215 215
216 AsmMode ScopeInfo::asm_mode() {
217 if (length() > 0) {
218 if (AsmModuleField::decode(Flags())) return ASM_MODULE;
219 if (AsmFunctionField::decode(Flags())) return ASM_FUNCTION;
220 }
221 return ASM_NO;
222 }
223
224
216 int ScopeInfo::LocalCount() { 225 int ScopeInfo::LocalCount() {
217 return StackLocalCount() + ContextLocalCount(); 226 return StackLocalCount() + ContextLocalCount();
218 } 227 }
219 228
220 229
221 int ScopeInfo::StackSlotCount() { 230 int ScopeInfo::StackSlotCount() {
222 if (length() > 0) { 231 if (length() > 0) {
223 bool function_name_stack_slot = 232 bool function_name_stack_slot =
224 FunctionVariableField::decode(Flags()) == STACK; 233 FunctionVariableField::decode(Flags()) == STACK;
225 return StackLocalCount() + (function_name_stack_slot ? 1 : 0); 234 return StackLocalCount() + (function_name_stack_slot ? 1 : 0);
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 info->set_mode(i, var->mode()); 728 info->set_mode(i, var->mode());
720 DCHECK(var->index() >= 0); 729 DCHECK(var->index() >= 0);
721 info->set_index(i, var->index()); 730 info->set_index(i, var->index());
722 } 731 }
723 DCHECK(i == info->length()); 732 DCHECK(i == info->length());
724 return info; 733 return info;
725 } 734 }
726 735
727 } // namespace internal 736 } // namespace internal
728 } // namespace v8 737 } // namespace v8
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698