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 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 uses_sloppy_arguments = strict_mode() == SLOPPY; | 1259 uses_sloppy_arguments = strict_mode() == SLOPPY; |
1260 } | 1260 } |
1261 | 1261 |
1262 // The same parameter may occur multiple times in the parameters_ list. | 1262 // The same parameter may occur multiple times in the parameters_ list. |
1263 // If it does, and if it is not copied into the context object, it must | 1263 // If it does, and if it is not copied into the context object, it must |
1264 // receive the highest parameter index for that parameter; thus iteration | 1264 // receive the highest parameter index for that parameter; thus iteration |
1265 // order is relevant! | 1265 // order is relevant! |
1266 for (int i = params_.length() - 1; i >= 0; --i) { | 1266 for (int i = params_.length() - 1; i >= 0; --i) { |
1267 Variable* var = params_[i]; | 1267 Variable* var = params_[i]; |
1268 ASSERT(var->scope() == this); | 1268 ASSERT(var->scope() == this); |
1269 if (uses_sloppy_arguments) { | 1269 if (uses_sloppy_arguments || has_forced_context_allocation()) { |
1270 // Force context allocation of the parameter. | 1270 // Force context allocation of the parameter. |
1271 var->ForceContextAllocation(); | 1271 var->ForceContextAllocation(); |
1272 } | 1272 } |
1273 | 1273 |
1274 if (MustAllocate(var)) { | 1274 if (MustAllocate(var)) { |
1275 if (MustAllocateInContext(var)) { | 1275 if (MustAllocateInContext(var)) { |
1276 ASSERT(var->IsUnallocated() || var->IsContextSlot()); | 1276 ASSERT(var->IsUnallocated() || var->IsContextSlot()); |
1277 if (var->IsUnallocated()) { | 1277 if (var->IsUnallocated()) { |
1278 AllocateHeapSlot(var); | 1278 AllocateHeapSlot(var); |
1279 } | 1279 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 } | 1395 } |
1396 | 1396 |
1397 | 1397 |
1398 int Scope::ContextLocalCount() const { | 1398 int Scope::ContextLocalCount() const { |
1399 if (num_heap_slots() == 0) return 0; | 1399 if (num_heap_slots() == 0) return 0; |
1400 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1400 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1401 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1401 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1402 } | 1402 } |
1403 | 1403 |
1404 } } // namespace v8::internal | 1404 } } // namespace v8::internal |
OLD | NEW |