| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 473 } |
| 474 if (owner()->context_level() == other.owner()->context_level()) { | 474 if (owner()->context_level() == other.owner()->context_level()) { |
| 475 return true; | 475 return true; |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 return false; | 479 return false; |
| 480 } | 480 } |
| 481 | 481 |
| 482 | 482 |
| 483 // Map the frame index into an index in the range 0..(vector->length()-1). | 483 // Map the frame index into an index in the range 0..(var_count-1). |
| 484 int LocalVariable::BitIndexIn(BitVector* vector) const { | 484 int LocalVariable::BitIndexIn(intptr_t var_count) const { |
| 485 ASSERT(!is_captured()); | 485 ASSERT(!is_captured()); |
| 486 // Parameters have positive indexes with the lowest index being 2. Locals | 486 // Parameters have positive indexes with the lowest index being 2. Locals |
| 487 // and copied parameters have negative indexes with the lowest (closest to | 487 // and copied parameters have negative indexes with the lowest (closest to |
| 488 // zero) index being ParsedFunction::kFirstLocalSlotIndex. | 488 // zero) index being ParsedFunction::kFirstLocalSlotIndex. |
| 489 if (index() > 0) { | 489 if (index() > 0) { |
| 490 // Shift non-negative indexes so that the lowest one is 0. | 490 // Shift non-negative indexes so that the lowest one is 0. |
| 491 return index() - 2; | 491 return index() - 2; |
| 492 } else { | 492 } else { |
| 493 // Shift negative indexes so that the lowest one is 0 (they are still | 493 // Shift negative indexes so that the lowest one is 0 (they are still |
| 494 // non-positive) and index them backward from the end of the vector. | 494 // non-positive) and index them backward from the end of the vector. |
| 495 return (vector->length() - 1) + | 495 return (var_count - 1) + |
| 496 (index() - ParsedFunction::kFirstLocalSlotIndex); | 496 (index() - ParsedFunction::kFirstLocalSlotIndex); |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 | 499 |
| 500 | 500 |
| 501 } // namespace dart | 501 } // namespace dart |
| OLD | NEW |