Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: runtime/vm/scopes.cc

Issue 10828018: Add support for fixed parameters in the register allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase, fix off by one in deopt stub generation Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/locations.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 533 }
534 if (owner()->context_level() == other.owner()->context_level()) { 534 if (owner()->context_level() == other.owner()->context_level()) {
535 return true; 535 return true;
536 } 536 }
537 } 537 }
538 } 538 }
539 return false; 539 return false;
540 } 540 }
541 541
542 542
543 // Map the frame index into an index in the range 0..(var_count-1). 543 int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const {
544 int LocalVariable::BitIndexIn(intptr_t var_count) const {
545 ASSERT(!is_captured()); 544 ASSERT(!is_captured());
546 // Parameters have positive indexes with the lowest index being 2. Locals 545 // Parameters have positive indexes with the lowest index being 2. Locals
547 // and copied parameters have negative indexes with the lowest (closest to 546 // and copied parameters have negative indexes with the lowest (closest to
548 // zero) index being ParsedFunction::kFirstLocalSlotIndex. 547 // zero) index being ParsedFunction::kFirstLocalSlotIndex.
549 if (index() > 0) { 548 if (index() > 0) {
550 // Shift non-negative indexes so that the lowest one is 0. 549 // Shift non-negative indexes so that the lowest one is 0.
551 return index() - 2; 550 return (fixed_parameter_count - 1) - (index() - 2);
552 } else { 551 } else {
553 // Shift negative indexes so that the lowest one is 0 (they are still 552 // Shift negative indexes so that the lowest one is 0 (they are still
554 // non-positive) and index them backward from the end of the vector. 553 // non-positive).
555 return (var_count - 1) + 554 return fixed_parameter_count -
556 (index() - ParsedFunction::kFirstLocalSlotIndex); 555 (index() - ParsedFunction::kFirstLocalSlotIndex);
557 } 556 }
558 } 557 }
559 558
560 559
561 } // namespace dart 560 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/locations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698