Carl Shapiro | 3ee755d | 2011-06-28 12:11:04 -0700 | [diff] [blame^] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #include "src/globals.h" |
| 4 | #include "src/object.h" |
| 5 | #include "src/logging.h" |
| 6 | |
| 7 | namespace art { |
| 8 | |
| 9 | uint32_t Method::NumArgRegisters() { |
| 10 | CHECK(shorty_ != NULL); |
| 11 | uint32_t num_registers = 0; |
| 12 | for (size_t i = 1; shorty_[0] != '\0'; ++i) { |
| 13 | char ch = shorty_[i]; |
| 14 | if (ch == 'D' || ch == 'J') { |
| 15 | num_registers += 2; |
| 16 | } else { |
| 17 | num_registers += 1; |
| 18 | } |
| 19 | } |
| 20 | return num_registers; |
| 21 | } |
| 22 | |
| 23 | } // namespace art |