OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 memcpy(to, data_ + position_, number_of_bytes); | 367 memcpy(to, data_ + position_, number_of_bytes); |
368 position_ += number_of_bytes; | 368 position_ += number_of_bytes; |
369 } | 369 } |
370 | 370 |
371 int GetInt() { | 371 int GetInt() { |
372 // A little unwind to catch the really small ints. | 372 // A little unwind to catch the really small ints. |
373 int snapshot_byte = Get(); | 373 int snapshot_byte = Get(); |
374 if ((snapshot_byte & 0x80) == 0) { | 374 if ((snapshot_byte & 0x80) == 0) { |
375 return snapshot_byte; | 375 return snapshot_byte; |
376 } | 376 } |
377 uintptr_t accumulator = (snapshot_byte & 0x7f) << 7; | 377 int accumulator = (snapshot_byte & 0x7f) << 7; |
378 while (true) { | 378 while (true) { |
379 snapshot_byte = Get(); | 379 snapshot_byte = Get(); |
380 if ((snapshot_byte & 0x80) == 0) { | 380 if ((snapshot_byte & 0x80) == 0) { |
381 return accumulator | snapshot_byte; | 381 return accumulator | snapshot_byte; |
382 } | 382 } |
383 accumulator = (accumulator | (snapshot_byte & 0x7f)) << 7; | 383 accumulator = (accumulator | (snapshot_byte & 0x7f)) << 7; |
384 } | 384 } |
385 UNREACHABLE(); | 385 UNREACHABLE(); |
386 return accumulator; | 386 return accumulator; |
387 } | 387 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 friend class ObjectSerializer; | 619 friend class ObjectSerializer; |
620 friend class Deserializer2; | 620 friend class Deserializer2; |
621 | 621 |
622 DISALLOW_COPY_AND_ASSIGN(Serializer2); | 622 DISALLOW_COPY_AND_ASSIGN(Serializer2); |
623 }; | 623 }; |
624 | 624 |
625 } } // namespace v8::internal | 625 } } // namespace v8::internal |
626 | 626 |
627 #endif // V8_SERIALIZE_H_ | 627 #endif // V8_SERIALIZE_H_ |
OLD | NEW |