OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 outer_scope_ = outer_scope; | 183 outer_scope_ = outer_scope; |
184 type_ = type; | 184 type_ = type; |
185 scope_name_ = isolate_->factory()->empty_symbol(); | 185 scope_name_ = isolate_->factory()->empty_symbol(); |
186 dynamics_ = NULL; | 186 dynamics_ = NULL; |
187 receiver_ = NULL; | 187 receiver_ = NULL; |
188 function_ = NULL; | 188 function_ = NULL; |
189 arguments_ = NULL; | 189 arguments_ = NULL; |
190 illegal_redecl_ = NULL; | 190 illegal_redecl_ = NULL; |
191 scope_inside_with_ = false; | 191 scope_inside_with_ = false; |
192 scope_contains_with_ = false; | 192 scope_contains_with_ = false; |
| 193 scope_inside_generator_ = false; |
193 scope_calls_eval_ = false; | 194 scope_calls_eval_ = false; |
194 // Inherit the strict mode from the parent scope. | 195 // Inherit the strict mode from the parent scope. |
195 language_mode_ = (outer_scope != NULL) | 196 language_mode_ = (outer_scope != NULL) |
196 ? outer_scope->language_mode_ : CLASSIC_MODE; | 197 ? outer_scope->language_mode_ : CLASSIC_MODE; |
197 outer_scope_calls_non_strict_eval_ = false; | 198 outer_scope_calls_non_strict_eval_ = false; |
198 inner_scope_calls_eval_ = false; | 199 inner_scope_calls_eval_ = false; |
199 force_eager_compilation_ = false; | 200 force_eager_compilation_ = false; |
200 num_var_or_const_ = 0; | 201 num_var_or_const_ = 0; |
201 num_stack_slots_ = 0; | 202 num_stack_slots_ = 0; |
202 num_heap_slots_ = 0; | 203 num_heap_slots_ = 0; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 314 } |
314 | 315 |
315 | 316 |
316 void Scope::Initialize() { | 317 void Scope::Initialize() { |
317 ASSERT(!already_resolved()); | 318 ASSERT(!already_resolved()); |
318 | 319 |
319 // Add this scope as a new inner scope of the outer scope. | 320 // Add this scope as a new inner scope of the outer scope. |
320 if (outer_scope_ != NULL) { | 321 if (outer_scope_ != NULL) { |
321 outer_scope_->inner_scopes_.Add(this, zone()); | 322 outer_scope_->inner_scopes_.Add(this, zone()); |
322 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope(); | 323 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope(); |
| 324 scope_inside_generator_ = outer_scope_->inside_generator(); |
323 } else { | 325 } else { |
324 scope_inside_with_ = is_with_scope(); | 326 scope_inside_with_ = is_with_scope(); |
325 } | 327 } |
326 | 328 |
327 // Declare convenience variables. | 329 // Declare convenience variables. |
328 // Declare and allocate receiver (even for the global scope, and even | 330 // Declare and allocate receiver (even for the global scope, and even |
329 // if naccesses_ == 0). | 331 // if naccesses_ == 0). |
330 // NOTE: When loading parameters in the global scope, we must take | 332 // NOTE: When loading parameters in the global scope, we must take |
331 // care not to access them as properties of the global object, but | 333 // care not to access them as properties of the global object, but |
332 // instead load them directly from the stack. Currently, the only | 334 // instead load them directly from the stack. Currently, the only |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 } | 1381 } |
1380 | 1382 |
1381 | 1383 |
1382 int Scope::ContextLocalCount() const { | 1384 int Scope::ContextLocalCount() const { |
1383 if (num_heap_slots() == 0) return 0; | 1385 if (num_heap_slots() == 0) return 0; |
1384 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1386 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1385 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1387 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1386 } | 1388 } |
1387 | 1389 |
1388 } } // namespace v8::internal | 1390 } } // namespace v8::internal |
OLD | NEW |