OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 const int length = kVariablePartIndex | 49 const int length = kVariablePartIndex |
50 + parameter_count + stack_local_count + 2 * context_local_count | 50 + parameter_count + stack_local_count + 2 * context_local_count |
51 + (has_function_name ? 2 : 0); | 51 + (has_function_name ? 2 : 0); |
52 | 52 |
53 Factory* factory = isolate->factory(); | 53 Factory* factory = isolate->factory(); |
54 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); | 54 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); |
55 | 55 |
56 // Encode the flags. | 56 // Encode the flags. |
57 int flags = ScopeTypeField::encode(scope->scope_type()) | | 57 int flags = ScopeTypeField::encode(scope->scope_type()) | |
58 CallsEvalField::encode(scope->calls_eval()) | | 58 CallsEvalField::encode(scope->calls_eval()) | |
59 StrictModeField::encode(scope->strict_mode()) | | 59 LanguageModeField::encode(scope->language_mode()) | |
60 FunctionVariableField::encode(function_name_info) | | 60 FunctionVariableField::encode(function_name_info) | |
61 FunctionVariableMode::encode(function_variable_mode) | | 61 FunctionVariableMode::encode(function_variable_mode) | |
62 AsmModuleField::encode(scope->asm_module()) | | 62 AsmModuleField::encode(scope->asm_module()) | |
63 AsmFunctionField::encode(scope->asm_function()); | 63 AsmFunctionField::encode(scope->asm_function()); |
64 scope_info->SetFlags(flags); | 64 scope_info->SetFlags(flags); |
65 scope_info->SetParameterCount(parameter_count); | 65 scope_info->SetParameterCount(parameter_count); |
66 scope_info->SetStackLocalCount(stack_local_count); | 66 scope_info->SetStackLocalCount(stack_local_count); |
67 scope_info->SetContextLocalCount(context_local_count); | 67 scope_info->SetContextLocalCount(context_local_count); |
68 | 68 |
69 int index = kVariablePartIndex; | 69 int index = kVariablePartIndex; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 DCHECK(length() > 0); | 139 DCHECK(length() > 0); |
140 return ScopeTypeField::decode(Flags()); | 140 return ScopeTypeField::decode(Flags()); |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 bool ScopeInfo::CallsEval() { | 144 bool ScopeInfo::CallsEval() { |
145 return length() > 0 && CallsEvalField::decode(Flags()); | 145 return length() > 0 && CallsEvalField::decode(Flags()); |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 StrictMode ScopeInfo::strict_mode() { | 149 LanguageMode ScopeInfo::language_mode() { |
150 return length() > 0 ? StrictModeField::decode(Flags()) : SLOPPY; | 150 return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY; |
151 } | 151 } |
152 | 152 |
153 | 153 |
154 int ScopeInfo::LocalCount() { | 154 int ScopeInfo::LocalCount() { |
155 return StackLocalCount() + ContextLocalCount(); | 155 return StackLocalCount() + ContextLocalCount(); |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 int ScopeInfo::StackSlotCount() { | 159 int ScopeInfo::StackSlotCount() { |
160 if (length() > 0) { | 160 if (length() > 0) { |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } else { | 566 } else { |
567 DCHECK(var->index() >= 0); | 567 DCHECK(var->index() >= 0); |
568 info->set_index(i, var->index()); | 568 info->set_index(i, var->index()); |
569 } | 569 } |
570 } | 570 } |
571 DCHECK(i == info->length()); | 571 DCHECK(i == info->length()); |
572 return info; | 572 return info; |
573 } | 573 } |
574 | 574 |
575 } } // namespace v8::internal | 575 } } // namespace v8::internal |
OLD | NEW |