OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ASSERT(!is_finalized() && position_ < buffer_.length()); | 82 ASSERT(!is_finalized() && position_ < buffer_.length()); |
83 buffer_[position_] = '\0'; | 83 buffer_[position_] = '\0'; |
84 // Make sure nobody managed to add a 0-character to the | 84 // Make sure nobody managed to add a 0-character to the |
85 // buffer while building the string. | 85 // buffer while building the string. |
86 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_)); | 86 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_)); |
87 position_ = -1; | 87 position_ = -1; |
88 ASSERT(is_finalized()); | 88 ASSERT(is_finalized()); |
89 return buffer_.start(); | 89 return buffer_.start(); |
90 } | 90 } |
91 | 91 |
| 92 |
| 93 const DivMagicNumbers DivMagicNumberFor(int32_t divisor) { |
| 94 switch (divisor) { |
| 95 case 3: return DivMagicNumberFor3; |
| 96 case 5: return DivMagicNumberFor5; |
| 97 case 7: return DivMagicNumberFor7; |
| 98 case 9: return DivMagicNumberFor9; |
| 99 case 11: return DivMagicNumberFor11; |
| 100 case 25: return DivMagicNumberFor25; |
| 101 case 125: return DivMagicNumberFor125; |
| 102 case 625: return DivMagicNumberFor625; |
| 103 default: return InvalidDivMagicNumber; |
| 104 } |
| 105 } |
| 106 |
92 } } // namespace v8::internal | 107 } } // namespace v8::internal |
OLD | NEW |