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 4131 matching lines...) Loading... |
4142 i::Handle<i::String> str = Utils::OpenHandle(this); | 4142 i::Handle<i::String> str = Utils::OpenHandle(this); |
4143 isolate->string_tracker()->RecordWrite(str); | 4143 isolate->string_tracker()->RecordWrite(str); |
4144 if (options & HINT_MANY_WRITES_EXPECTED) { | 4144 if (options & HINT_MANY_WRITES_EXPECTED) { |
4145 FlattenString(str); // Flatten the string for efficiency. | 4145 FlattenString(str); // Flatten the string for efficiency. |
4146 } | 4146 } |
4147 | 4147 |
4148 if (str->HasOnlyAsciiChars()) { | 4148 if (str->HasOnlyAsciiChars()) { |
4149 // WriteToFlat is faster than using the StringCharacterStream. | 4149 // WriteToFlat is faster than using the StringCharacterStream. |
4150 if (length == -1) length = str->length() + 1; | 4150 if (length == -1) length = str->length() + 1; |
4151 int len = i::Min(length, str->length() - start); | 4151 int len = i::Min(length, str->length() - start); |
4152 i::String::WriteToFlat(*str, buffer, start, start + len); | 4152 i::String::WriteToFlat(*str, |
| 4153 reinterpret_cast<uint8_t*>(buffer), |
| 4154 start, |
| 4155 start + len); |
4153 if (!(options & PRESERVE_ASCII_NULL)) { | 4156 if (!(options & PRESERVE_ASCII_NULL)) { |
4154 for (int i = 0; i < len; i++) { | 4157 for (int i = 0; i < len; i++) { |
4155 if (buffer[i] == '\0') buffer[i] = ' '; | 4158 if (buffer[i] == '\0') buffer[i] = ' '; |
4156 } | 4159 } |
4157 } | 4160 } |
4158 if (!(options & NO_NULL_TERMINATION) && length > len) { | 4161 if (!(options & NO_NULL_TERMINATION) && length > len) { |
4159 buffer[len] = '\0'; | 4162 buffer[len] = '\0'; |
4160 } | 4163 } |
4161 return len; | 4164 return len; |
4162 } | 4165 } |
(...skipping 2570 matching lines...) Loading... |
6733 | 6736 |
6734 v->VisitPointers(blocks_.first(), first_block_limit_); | 6737 v->VisitPointers(blocks_.first(), first_block_limit_); |
6735 | 6738 |
6736 for (int i = 1; i < blocks_.length(); i++) { | 6739 for (int i = 1; i < blocks_.length(); i++) { |
6737 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6740 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6738 } | 6741 } |
6739 } | 6742 } |
6740 | 6743 |
6741 | 6744 |
6742 } } // namespace v8::internal | 6745 } } // namespace v8::internal |
OLD | NEW |