| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 pushback_buffer_backing_size_ = kPushBackSize; | 93 pushback_buffer_backing_size_ = kPushBackSize; |
| 94 } | 94 } |
| 95 pushback_buffer_ = pushback_buffer_backing_; | 95 pushback_buffer_ = pushback_buffer_backing_; |
| 96 pushback_buffer_end_cache_ = buffer_end_; | 96 pushback_buffer_end_cache_ = buffer_end_; |
| 97 buffer_end_ = pushback_buffer_backing_ + pushback_buffer_backing_size_; | 97 buffer_end_ = pushback_buffer_backing_ + pushback_buffer_backing_size_; |
| 98 buffer_cursor_ = buffer_end_ - 1; | 98 buffer_cursor_ = buffer_end_ - 1; |
| 99 } else { | 99 } else { |
| 100 // Hit the bottom of the allocated pushback buffer. | 100 // Hit the bottom of the allocated pushback buffer. |
| 101 // Double the buffer and continue. | 101 // Double the buffer and continue. |
| 102 uc16* new_buffer = NewArray<uc16>(pushback_buffer_backing_size_ * 2); | 102 uc16* new_buffer = NewArray<uc16>(pushback_buffer_backing_size_ * 2); |
| 103 memcpy(new_buffer + pushback_buffer_backing_size_, | 103 OS::MemCopy(new_buffer + pushback_buffer_backing_size_, |
| 104 pushback_buffer_backing_, | 104 pushback_buffer_backing_, |
| 105 pushback_buffer_backing_size_); | 105 pushback_buffer_backing_size_); |
| 106 DeleteArray(pushback_buffer_backing_); | 106 DeleteArray(pushback_buffer_backing_); |
| 107 buffer_cursor_ = new_buffer + pushback_buffer_backing_size_; | 107 buffer_cursor_ = new_buffer + pushback_buffer_backing_size_; |
| 108 pushback_buffer_backing_ = pushback_buffer_ = new_buffer; | 108 pushback_buffer_backing_ = pushback_buffer_ = new_buffer; |
| 109 buffer_end_ = pushback_buffer_backing_ + pushback_buffer_backing_size_; | 109 buffer_end_ = pushback_buffer_backing_ + pushback_buffer_backing_size_; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 pushback_buffer_[buffer_cursor_ - pushback_buffer_- 1] = | 112 pushback_buffer_[buffer_cursor_ - pushback_buffer_- 1] = |
| 113 static_cast<uc16>(ch); | 113 static_cast<uc16>(ch); |
| 114 pos_--; | 114 pos_--; |
| 115 } | 115 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 if (result == preparser::PreParser::kPreParseStackOverflow) { | 187 if (result == preparser::PreParser::kPreParseStackOverflow) { |
| 188 return PreParserData::StackOverflow(); | 188 return PreParserData::StackOverflow(); |
| 189 } | 189 } |
| 190 internal::Vector<unsigned> pre_data = recorder.ExtractData(); | 190 internal::Vector<unsigned> pre_data = recorder.ExtractData(); |
| 191 size_t size = pre_data.length() * sizeof(pre_data[0]); | 191 size_t size = pre_data.length() * sizeof(pre_data[0]); |
| 192 unsigned char* data = reinterpret_cast<unsigned char*>(pre_data.start()); | 192 unsigned char* data = reinterpret_cast<unsigned char*>(pre_data.start()); |
| 193 return PreParserData(size, data); | 193 return PreParserData(size, data); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace v8. | 196 } // namespace v8. |
| OLD | NEW |