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/object.h" | 7 #include "vm/object.h" |
8 #include "vm/stack_frame.h" | 8 #include "vm/stack_frame.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 | 10 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 ASSERT(var->owner()->context_level() >= 0); | 318 ASSERT(var->owner()->context_level() >= 0); |
319 desc.info.scope_id = var->owner()->context_level(); | 319 desc.info.scope_id = var->owner()->context_level(); |
320 } else { | 320 } else { |
321 desc.info.set_kind(RawLocalVarDescriptors::kStackVar); | 321 desc.info.set_kind(RawLocalVarDescriptors::kStackVar); |
322 desc.info.scope_id = *scope_id; | 322 desc.info.scope_id = *scope_id; |
323 } | 323 } |
324 desc.info.begin_pos = var->token_pos(); | 324 desc.info.begin_pos = var->token_pos(); |
325 desc.info.end_pos = var->owner()->end_token_pos(); | 325 desc.info.end_pos = var->owner()->end_token_pos(); |
326 desc.info.set_index(var->index()); | 326 desc.info.set_index(var->index()); |
327 vars->Add(desc); | 327 vars->Add(desc); |
328 } else if (var->name().raw() == Symbols::SavedEntryContextVar().raw()) { | |
329 // This is the local variable in which the function saves the | |
330 // caller's chain of closure contexts (caller's CTX register). | |
331 VarDesc desc; | |
332 desc.name = &var->name(); | |
333 desc.info.set_kind(RawLocalVarDescriptors::kSavedEntryContext); | |
334 desc.info.scope_id = 0; | |
335 desc.info.begin_pos = 0; | |
336 desc.info.end_pos = 0; | |
337 desc.info.set_index(var->index()); | |
338 vars->Add(desc); | |
339 } else if (var->name().raw() == Symbols::CurrentContextVar().raw()) { | 328 } else if (var->name().raw() == Symbols::CurrentContextVar().raw()) { |
340 // This is the local variable in which the function saves its | 329 // This is the local variable in which the function saves its |
341 // own context before calling a closure function. | 330 // own context before calling a closure function. |
342 VarDesc desc; | 331 VarDesc desc; |
343 desc.name = &var->name(); | 332 desc.name = &var->name(); |
344 desc.info.set_kind(RawLocalVarDescriptors::kSavedCurrentContext); | 333 desc.info.set_kind(RawLocalVarDescriptors::kSavedCurrentContext); |
345 desc.info.scope_id = 0; | 334 desc.info.scope_id = 0; |
346 desc.info.begin_pos = 0; | 335 desc.info.begin_pos = 0; |
347 desc.info.end_pos = 0; | 336 desc.info.end_pos = 0; |
348 desc.info.set_index(var->index()); | 337 desc.info.set_index(var->index()); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 return fixed_parameter_count - (index() - kParamEndSlotFromFp); | 661 return fixed_parameter_count - (index() - kParamEndSlotFromFp); |
673 } else { | 662 } else { |
674 // Shift negative indexes so that the lowest one is 0 (they are still | 663 // Shift negative indexes so that the lowest one is 0 (they are still |
675 // non-positive). | 664 // non-positive). |
676 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); | 665 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); |
677 } | 666 } |
678 } | 667 } |
679 | 668 |
680 | 669 |
681 } // namespace dart | 670 } // namespace dart |
OLD | NEW |