| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 return true; | 550 return true; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 } | 553 } |
| 554 return false; | 554 return false; |
| 555 } | 555 } |
| 556 | 556 |
| 557 | 557 |
| 558 int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const { | 558 int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const { |
| 559 ASSERT(!is_captured()); | 559 ASSERT(!is_captured()); |
| 560 // Parameters have positive indexes with the lowest index being 2. Locals | 560 // Parameters have positive indexes with the lowest index being |
| 561 // and copied parameters have negative indexes with the lowest (closest to | 561 // kLastParamSlotIndex. Locals and copied parameters have negative indexes |
| 562 // zero) index being ParsedFunction::kFirstLocalSlotIndex. | 562 // with the lowest (closest to zero) index being kFirstLocalSlotIndex. |
| 563 if (index() > 0) { | 563 if (index() > 0) { |
| 564 // Shift non-negative indexes so that the lowest one is 0. | 564 // Shift non-negative indexes so that the lowest one is 0. |
| 565 return (fixed_parameter_count - 1) - (index() - 2); | 565 return (fixed_parameter_count - 1) - (index() - kLastParamSlotIndex); |
| 566 } else { | 566 } else { |
| 567 // Shift negative indexes so that the lowest one is 0 (they are still | 567 // Shift negative indexes so that the lowest one is 0 (they are still |
| 568 // non-positive). | 568 // non-positive). |
| 569 return fixed_parameter_count - | 569 return fixed_parameter_count - (index() - kFirstLocalSlotIndex); |
| 570 (index() - ParsedFunction::kFirstLocalSlotIndex); | |
| 571 } | 570 } |
| 572 } | 571 } |
| 573 | 572 |
| 574 | 573 |
| 575 } // namespace dart | 574 } // namespace dart |
| OLD | NEW |