OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 const int parameter_count = scope->num_parameters(); | 72 const int parameter_count = scope->num_parameters(); |
73 const int length = kVariablePartIndex | 73 const int length = kVariablePartIndex |
74 + parameter_count + stack_local_count + 2 * context_local_count | 74 + parameter_count + stack_local_count + 2 * context_local_count |
75 + (has_function_name ? 2 : 0); | 75 + (has_function_name ? 2 : 0); |
76 | 76 |
77 Handle<ScopeInfo> scope_info = FACTORY->NewScopeInfo(length); | 77 Handle<ScopeInfo> scope_info = FACTORY->NewScopeInfo(length); |
78 | 78 |
79 // Encode the flags. | 79 // Encode the flags. |
80 int flags = TypeField::encode(scope->type()) | | 80 int flags = TypeField::encode(scope->type()) | |
81 CallsEvalField::encode(scope->calls_eval()) | | 81 CallsEvalField::encode(scope->calls_eval()) | |
82 StrictModeField::encode(scope->is_strict_mode()) | | 82 LanguageModeField::encode(scope->language_mode()) | |
83 FunctionVariableField::encode(function_name_info) | | 83 FunctionVariableField::encode(function_name_info) | |
84 FunctionVariableMode::encode(function_variable_mode); | 84 FunctionVariableMode::encode(function_variable_mode); |
85 scope_info->SetFlags(flags); | 85 scope_info->SetFlags(flags); |
86 scope_info->SetParameterCount(parameter_count); | 86 scope_info->SetParameterCount(parameter_count); |
87 scope_info->SetStackLocalCount(stack_local_count); | 87 scope_info->SetStackLocalCount(stack_local_count); |
88 scope_info->SetContextLocalCount(context_local_count); | 88 scope_info->SetContextLocalCount(context_local_count); |
89 | 89 |
90 int index = kVariablePartIndex; | 90 int index = kVariablePartIndex; |
91 // Add parameters. | 91 // Add parameters. |
92 ASSERT(index == scope_info->ParameterEntriesIndex()); | 92 ASSERT(index == scope_info->ParameterEntriesIndex()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ASSERT(length() > 0); | 156 ASSERT(length() > 0); |
157 return TypeField::decode(Flags()); | 157 return TypeField::decode(Flags()); |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 bool ScopeInfo::CallsEval() { | 161 bool ScopeInfo::CallsEval() { |
162 return length() > 0 && CallsEvalField::decode(Flags()); | 162 return length() > 0 && CallsEvalField::decode(Flags()); |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 bool ScopeInfo::IsStrictMode() { | 166 LanguageMode ScopeInfo::language_mode() { |
167 return length() > 0 && StrictModeField::decode(Flags()); | 167 ASSERT(length() > 0); |
| 168 return LanguageModeField::decode(Flags()); |
168 } | 169 } |
169 | 170 |
170 | 171 |
171 int ScopeInfo::LocalCount() { | 172 int ScopeInfo::LocalCount() { |
172 return StackLocalCount() + ContextLocalCount(); | 173 return StackLocalCount() + ContextLocalCount(); |
173 } | 174 } |
174 | 175 |
175 | 176 |
176 int ScopeInfo::StackSlotCount() { | 177 int ScopeInfo::StackSlotCount() { |
177 if (length() > 0) { | 178 if (length() > 0) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 Context::MIN_CONTEXT_SLOTS, | 500 Context::MIN_CONTEXT_SLOTS, |
500 ContextLocalNameEntriesIndex(), | 501 ContextLocalNameEntriesIndex(), |
501 ContextLocalNameEntriesIndex() + ContextLocalCount(), | 502 ContextLocalNameEntriesIndex() + ContextLocalCount(), |
502 this); | 503 this); |
503 | 504 |
504 PrintF("}\n"); | 505 PrintF("}\n"); |
505 } | 506 } |
506 #endif // DEBUG | 507 #endif // DEBUG |
507 | 508 |
508 } } // namespace v8::internal | 509 } } // namespace v8::internal |
OLD | NEW |