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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } | 736 } |
737 | 737 |
738 int InsertString(const char* s, int pos); | 738 int InsertString(const char* s, int pos); |
739 | 739 |
740 int length() { return len_; } | 740 int length() { return len_; } |
741 | 741 |
742 Address position() { return reinterpret_cast<Address>(&str_[len_]); } | 742 Address position() { return reinterpret_cast<Address>(&str_[len_]); } |
743 | 743 |
744 private: | 744 private: |
745 char* str_; // the snapshot | 745 char* str_; // the snapshot |
746 int len_; // the curent length of str_ | 746 int len_; // the current length of str_ |
747 int max_; // the allocated size of str_ | 747 int max_; // the allocated size of str_ |
748 }; | 748 }; |
749 | 749 |
750 | 750 |
751 void SnapshotWriter::Reserve(int bytes, int pos) { | 751 void SnapshotWriter::Reserve(int bytes, int pos) { |
752 CHECK(0 <= pos && pos <= len_); | 752 CHECK(0 <= pos && pos <= len_); |
753 while (len_ + bytes >= max_) { | 753 while (len_ + bytes >= max_) { |
754 max_ *= 2; | 754 max_ *= 2; |
755 char* old = str_; | 755 char* old = str_; |
756 str_ = NewArray<char>(max_); | 756 str_ = NewArray<char>(max_); |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 ASSERT(index < large_objects_.length()); | 1519 ASSERT(index < large_objects_.length()); |
1520 } | 1520 } |
1521 return large_objects_[index]; // s.page_offset() is ignored. | 1521 return large_objects_[index]; // s.page_offset() is ignored. |
1522 } | 1522 } |
1523 UNREACHABLE(); | 1523 UNREACHABLE(); |
1524 return NULL; | 1524 return NULL; |
1525 } | 1525 } |
1526 | 1526 |
1527 | 1527 |
1528 } } // namespace v8::internal | 1528 } } // namespace v8::internal |
OLD | NEW |