OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 void Serializer::Pad() { | 1611 void Serializer::Pad() { |
1612 // The non-branching GetInt will read up to 3 bytes too far, so we need | 1612 // The non-branching GetInt will read up to 3 bytes too far, so we need |
1613 // to pad the snapshot to make sure we don't read over the end. | 1613 // to pad the snapshot to make sure we don't read over the end. |
1614 for (unsigned i = 0; i < sizeof(int32_t) - 1; i++) { | 1614 for (unsigned i = 0; i < sizeof(int32_t) - 1; i++) { |
1615 sink_->Put(kNop, "Padding"); | 1615 sink_->Put(kNop, "Padding"); |
1616 } | 1616 } |
1617 } | 1617 } |
1618 | 1618 |
1619 | 1619 |
1620 bool SnapshotByteSource::AtEOF() { | 1620 bool SnapshotByteSource::AtEOF() { |
1621 if (0u + length_ - position_ > sizeof(uint32_t)) return false; | 1621 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
1622 for (int x = position_; x < length_; x++) { | 1622 for (int x = position_; x < length_; x++) { |
1623 if (data_[x] != SerializerDeserializer::nop()) return false; | 1623 if (data_[x] != SerializerDeserializer::nop()) return false; |
1624 } | 1624 } |
1625 return true; | 1625 return true; |
1626 } | 1626 } |
1627 | 1627 |
1628 } } // namespace v8::internal | 1628 } } // namespace v8::internal |
OLD | NEW |