| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/scopes.h" | 5 #include "vm/scopes.h" |
| 6 | 6 |
| 7 #include "vm/ast.h" | 7 #include "vm/ast.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 ASSERT(var->owner()->context_level() >= 0); | 251 ASSERT(var->owner()->context_level() >= 0); |
| 252 desc.info.scope_id = var->owner()->context_level(); | 252 desc.info.scope_id = var->owner()->context_level(); |
| 253 } else { | 253 } else { |
| 254 desc.info.kind = RawLocalVarDescriptors::kStackVar; | 254 desc.info.kind = RawLocalVarDescriptors::kStackVar; |
| 255 desc.info.scope_id = *scope_id; | 255 desc.info.scope_id = *scope_id; |
| 256 } | 256 } |
| 257 desc.info.begin_pos = var->token_pos(); | 257 desc.info.begin_pos = var->token_pos(); |
| 258 desc.info.end_pos = var->owner()->end_token_pos(); | 258 desc.info.end_pos = var->owner()->end_token_pos(); |
| 259 desc.info.index = var->index(); | 259 desc.info.index = var->index(); |
| 260 vars->Add(desc); | 260 vars->Add(desc); |
| 261 } else if (var->name().Equals( | 261 } else if (var->name().Equals(Symbols::SavedEntryContextVar())) { |
| 262 Symbols::Name(Symbols::kSavedEntryContextVarId))) { | |
| 263 // This is the local variable in which the function saves the | 262 // This is the local variable in which the function saves the |
| 264 // caller's chain of closure contexts (caller's CTX register). | 263 // caller's chain of closure contexts (caller's CTX register). |
| 265 VarDesc desc; | 264 VarDesc desc; |
| 266 desc.name = &var->name(); | 265 desc.name = &var->name(); |
| 267 desc.info.kind = RawLocalVarDescriptors::kContextChain; | 266 desc.info.kind = RawLocalVarDescriptors::kSavedEntryContext; |
| 267 desc.info.scope_id = 0; |
| 268 desc.info.begin_pos = 0; |
| 269 desc.info.end_pos = 0; |
| 270 desc.info.index = var->index(); |
| 271 vars->Add(desc); |
| 272 } else if (var->name().Equals(Symbols::SavedCurrentContextVar())) { |
| 273 // This is the local variable in which the function saves its |
| 274 // own context before calling a closure function. |
| 275 VarDesc desc; |
| 276 desc.name = &var->name(); |
| 277 desc.info.kind = RawLocalVarDescriptors::kSavedCurrentContext; |
| 268 desc.info.scope_id = 0; | 278 desc.info.scope_id = 0; |
| 269 desc.info.begin_pos = 0; | 279 desc.info.begin_pos = 0; |
| 270 desc.info.end_pos = 0; | 280 desc.info.end_pos = 0; |
| 271 desc.info.index = var->index(); | 281 desc.info.index = var->index(); |
| 272 vars->Add(desc); | 282 vars->Add(desc); |
| 273 } | 283 } |
| 274 // The saved arguments descriptor variable is not currently collected. | 284 // The saved arguments descriptor variable is not currently collected. |
| 275 } | 285 } |
| 276 } | 286 } |
| 277 LocalScope* child = this->child(); | 287 LocalScope* child = this->child(); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 return (fixed_parameter_count - 1) - (index() - kLastParamSlotIndex); | 575 return (fixed_parameter_count - 1) - (index() - kLastParamSlotIndex); |
| 566 } else { | 576 } else { |
| 567 // Shift negative indexes so that the lowest one is 0 (they are still | 577 // Shift negative indexes so that the lowest one is 0 (they are still |
| 568 // non-positive). | 578 // non-positive). |
| 569 return fixed_parameter_count - (index() - kFirstLocalSlotIndex); | 579 return fixed_parameter_count - (index() - kFirstLocalSlotIndex); |
| 570 } | 580 } |
| 571 } | 581 } |
| 572 | 582 |
| 573 | 583 |
| 574 } // namespace dart | 584 } // namespace dart |
| OLD | NEW |