| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/heap-snapshot-generator-inl.h" | 7 #include "src/heap-snapshot-generator-inl.h" |
| 8 | 8 |
| 9 #include "src/allocation-tracker.h" | 9 #include "src/allocation-tracker.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3095 writer_->AddCharacter(*s); | 3095 writer_->AddCharacter(*s); |
| 3096 continue; | 3096 continue; |
| 3097 default: | 3097 default: |
| 3098 if (*s > 31 && *s < 128) { | 3098 if (*s > 31 && *s < 128) { |
| 3099 writer_->AddCharacter(*s); | 3099 writer_->AddCharacter(*s); |
| 3100 } else if (*s <= 31) { | 3100 } else if (*s <= 31) { |
| 3101 // Special character with no dedicated literal. | 3101 // Special character with no dedicated literal. |
| 3102 WriteUChar(writer_, *s); | 3102 WriteUChar(writer_, *s); |
| 3103 } else { | 3103 } else { |
| 3104 // Convert UTF-8 into \u UTF-16 literal. | 3104 // Convert UTF-8 into \u UTF-16 literal. |
| 3105 unsigned length = 1, cursor = 0; | 3105 size_t length = 1, cursor = 0; |
| 3106 for ( ; length <= 4 && *(s + length) != '\0'; ++length) { } | 3106 for ( ; length <= 4 && *(s + length) != '\0'; ++length) { } |
| 3107 unibrow::uchar c = unibrow::Utf8::CalculateValue(s, length, &cursor); | 3107 unibrow::uchar c = unibrow::Utf8::CalculateValue(s, length, &cursor); |
| 3108 if (c != unibrow::Utf8::kBadChar) { | 3108 if (c != unibrow::Utf8::kBadChar) { |
| 3109 WriteUChar(writer_, c); | 3109 WriteUChar(writer_, c); |
| 3110 DCHECK(cursor != 0); | 3110 DCHECK(cursor != 0); |
| 3111 s += cursor - 1; | 3111 s += cursor - 1; |
| 3112 } else { | 3112 } else { |
| 3113 writer_->AddCharacter('?'); | 3113 writer_->AddCharacter('?'); |
| 3114 } | 3114 } |
| 3115 } | 3115 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3131 writer_->AddString("\"<dummy>\""); | 3131 writer_->AddString("\"<dummy>\""); |
| 3132 for (int i = 1; i < sorted_strings.length(); ++i) { | 3132 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3133 writer_->AddCharacter(','); | 3133 writer_->AddCharacter(','); |
| 3134 SerializeString(sorted_strings[i]); | 3134 SerializeString(sorted_strings[i]); |
| 3135 if (writer_->aborted()) return; | 3135 if (writer_->aborted()) return; |
| 3136 } | 3136 } |
| 3137 } | 3137 } |
| 3138 | 3138 |
| 3139 | 3139 |
| 3140 } } // namespace v8::internal | 3140 } } // namespace v8::internal |
| OLD | NEW |