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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 } | 1111 } |
1112 literal.Complete(); | 1112 literal.Complete(); |
1113 | 1113 |
1114 next_.location.end_pos = source_pos() - 1; | 1114 next_.location.end_pos = source_pos() - 1; |
1115 return true; | 1115 return true; |
1116 } | 1116 } |
1117 | 1117 |
1118 | 1118 |
1119 Handle<String> Scanner::AllocateNextLiteralString(Isolate* isolate, | 1119 Handle<String> Scanner::AllocateNextLiteralString(Isolate* isolate, |
1120 PretenureFlag tenured) { | 1120 PretenureFlag tenured) { |
| 1121 MaybeHandle<String> maybe_result; |
1121 if (is_next_literal_one_byte()) { | 1122 if (is_next_literal_one_byte()) { |
1122 return isolate->factory()->NewStringFromOneByte( | 1123 maybe_result = isolate->factory()->NewStringFromOneByte( |
1123 Vector<const uint8_t>::cast(next_literal_one_byte_string()), tenured); | 1124 next_literal_one_byte_string(), tenured); |
1124 } else { | 1125 } else { |
1125 return isolate->factory()->NewStringFromTwoByte( | 1126 maybe_result = isolate->factory()->NewStringFromTwoByte( |
1126 next_literal_two_byte_string(), tenured); | 1127 next_literal_two_byte_string(), tenured); |
1127 } | 1128 } |
| 1129 // TODO(ishell): Temporarily returning null handle from here. I will proceed |
| 1130 // with maybehandlification in next CLs. |
| 1131 Handle<String> result; |
| 1132 if (!maybe_result.ToHandle(&result)) return Handle<String>(); |
| 1133 return result; |
1128 } | 1134 } |
1129 | 1135 |
1130 | 1136 |
1131 Handle<String> Scanner::AllocateInternalizedString(Isolate* isolate) { | 1137 Handle<String> Scanner::AllocateInternalizedString(Isolate* isolate) { |
1132 if (is_literal_one_byte()) { | 1138 if (is_literal_one_byte()) { |
1133 return isolate->factory()->InternalizeOneByteString( | 1139 return isolate->factory()->InternalizeOneByteString( |
1134 literal_one_byte_string()); | 1140 literal_one_byte_string()); |
1135 } else { | 1141 } else { |
1136 return isolate->factory()->InternalizeTwoByteString( | 1142 return isolate->factory()->InternalizeTwoByteString( |
1137 literal_two_byte_string()); | 1143 literal_two_byte_string()); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 } | 1309 } |
1304 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1310 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1305 } | 1311 } |
1306 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1312 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1307 | 1313 |
1308 backing_store_.AddBlock(bytes); | 1314 backing_store_.AddBlock(bytes); |
1309 return backing_store_.EndSequence().start(); | 1315 return backing_store_.EndSequence().start(); |
1310 } | 1316 } |
1311 | 1317 |
1312 } } // namespace v8::internal | 1318 } } // namespace v8::internal |
OLD | NEW |