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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 | 202 |
203 | 203 |
204 int ScopeInfo::ContextLength() { | 204 int ScopeInfo::ContextLength() { |
205 if (length() > 0) { | 205 if (length() > 0) { |
206 int context_locals = ContextLocalCount(); | 206 int context_locals = ContextLocalCount(); |
207 bool function_name_context_slot = | 207 bool function_name_context_slot = |
208 FunctionVariableField::decode(Flags()) == CONTEXT; | 208 FunctionVariableField::decode(Flags()) == CONTEXT; |
209 bool has_context = context_locals > 0 || function_name_context_slot || | 209 bool has_context = context_locals > 0 || function_name_context_slot || |
210 scope_type() == WITH_SCOPE || | 210 scope_type() == WITH_SCOPE || |
211 (scope_type() == ARROW_SCOPE && CallsEval()) || | 211 (scope_type() == ARROW_SCOPE && CallsSloppyEval()) || |
212 (scope_type() == FUNCTION_SCOPE && CallsEval()) || | 212 (scope_type() == FUNCTION_SCOPE && CallsSloppyEval()) || |
213 scope_type() == MODULE_SCOPE; | 213 scope_type() == MODULE_SCOPE; |
214 if (has_context) { | 214 if (has_context) { |
215 return Context::MIN_CONTEXT_SLOTS + context_locals + | 215 return Context::MIN_CONTEXT_SLOTS + context_locals + |
216 (function_name_context_slot ? 1 : 0); | 216 (function_name_context_slot ? 1 : 0); |
217 } | 217 } |
218 } | 218 } |
219 return 0; | 219 return 0; |
220 } | 220 } |
221 | 221 |
222 | 222 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 info->set_name(i, *(it.export_name()->string())); | 659 info->set_name(i, *(it.export_name()->string())); |
660 info->set_mode(i, var->mode()); | 660 info->set_mode(i, var->mode()); |
661 DCHECK(var->index() >= 0); | 661 DCHECK(var->index() >= 0); |
662 info->set_index(i, var->index()); | 662 info->set_index(i, var->index()); |
663 } | 663 } |
664 DCHECK(i == info->length()); | 664 DCHECK(i == info->length()); |
665 return info; | 665 return info; |
666 } | 666 } |
667 | 667 |
668 } } // namespace v8::internal | 668 } } // namespace v8::internal |
OLD | NEW |