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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL); | 390 variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL); |
391 params_.Add(var); | 391 params_.Add(var); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 Variable* Scope::DeclareLocal(Handle<String> name, Variable::Mode mode) { | 395 Variable* Scope::DeclareLocal(Handle<String> name, Variable::Mode mode) { |
396 ASSERT(!already_resolved()); | 396 ASSERT(!already_resolved()); |
397 // This function handles VAR and CONST modes. DYNAMIC variables are | 397 // This function handles VAR and CONST modes. DYNAMIC variables are |
398 // introduces during variable allocation, INTERNAL variables are allocated | 398 // introduces during variable allocation, INTERNAL variables are allocated |
399 // explicitly, and TEMPORARY variables are allocated via NewTemporary(). | 399 // explicitly, and TEMPORARY variables are allocated via NewTemporary(). |
400 ASSERT(mode == Variable::VAR || mode == Variable::CONST); | 400 ASSERT(mode == Variable::VAR || |
| 401 mode == Variable::CONST || |
| 402 mode == Variable::LET); |
401 ++num_var_or_const_; | 403 ++num_var_or_const_; |
402 return variables_.Declare(this, name, mode, true, Variable::NORMAL); | 404 return variables_.Declare(this, name, mode, true, Variable::NORMAL); |
403 } | 405 } |
404 | 406 |
405 | 407 |
406 Variable* Scope::DeclareGlobal(Handle<String> name) { | 408 Variable* Scope::DeclareGlobal(Handle<String> name) { |
407 ASSERT(is_global_scope()); | 409 ASSERT(is_global_scope()); |
408 return variables_.Declare(this, name, Variable::DYNAMIC_GLOBAL, true, | 410 return variables_.Declare(this, name, Variable::DYNAMIC_GLOBAL, true, |
409 Variable::NORMAL); | 411 Variable::NORMAL); |
410 } | 412 } |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 1131 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
1130 !must_have_local_context) { | 1132 !must_have_local_context) { |
1131 num_heap_slots_ = 0; | 1133 num_heap_slots_ = 0; |
1132 } | 1134 } |
1133 | 1135 |
1134 // Allocation done. | 1136 // Allocation done. |
1135 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 1137 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
1136 } | 1138 } |
1137 | 1139 |
1138 } } // namespace v8::internal | 1140 } } // namespace v8::internal |
OLD | NEW |