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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 } else { | 1135 } else { |
1136 return isolate->factory()->InternalizeTwoByteString( | 1136 return isolate->factory()->InternalizeTwoByteString( |
1137 literal_two_byte_string()); | 1137 literal_two_byte_string()); |
1138 } | 1138 } |
1139 } | 1139 } |
1140 | 1140 |
1141 | 1141 |
1142 double Scanner::DoubleValue() { | 1142 double Scanner::DoubleValue() { |
1143 ASSERT(is_literal_one_byte()); | 1143 ASSERT(is_literal_one_byte()); |
1144 return StringToDouble( | 1144 return StringToDouble( |
1145 unicode_cache_, Vector<const char>::cast(literal_one_byte_string()), | 1145 unicode_cache_, |
| 1146 literal_one_byte_string(), |
1146 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); | 1147 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); |
1147 } | 1148 } |
1148 | 1149 |
1149 | 1150 |
1150 int Scanner::FindNumber(DuplicateFinder* finder, int value) { | 1151 int Scanner::FindNumber(DuplicateFinder* finder, int value) { |
1151 return finder->AddNumber(literal_one_byte_string(), value); | 1152 return finder->AddNumber(literal_one_byte_string(), value); |
1152 } | 1153 } |
1153 | 1154 |
1154 | 1155 |
1155 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { | 1156 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 | 1195 |
1195 int DuplicateFinder::AddNumber(Vector<const uint8_t> key, int value) { | 1196 int DuplicateFinder::AddNumber(Vector<const uint8_t> key, int value) { |
1196 ASSERT(key.length() > 0); | 1197 ASSERT(key.length() > 0); |
1197 // Quick check for already being in canonical form. | 1198 // Quick check for already being in canonical form. |
1198 if (IsNumberCanonical(key)) { | 1199 if (IsNumberCanonical(key)) { |
1199 return AddOneByteSymbol(key, value); | 1200 return AddOneByteSymbol(key, value); |
1200 } | 1201 } |
1201 | 1202 |
1202 int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY; | 1203 int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY; |
1203 double double_value = StringToDouble( | 1204 double double_value = StringToDouble( |
1204 unicode_constants_, Vector<const char>::cast(key), flags, 0.0); | 1205 unicode_constants_, key, flags, 0.0); |
1205 int length; | 1206 int length; |
1206 const char* string; | 1207 const char* string; |
1207 if (!std::isfinite(double_value)) { | 1208 if (!std::isfinite(double_value)) { |
1208 string = "Infinity"; | 1209 string = "Infinity"; |
1209 length = 8; // strlen("Infinity"); | 1210 length = 8; // strlen("Infinity"); |
1210 } else { | 1211 } else { |
1211 string = DoubleToCString(double_value, | 1212 string = DoubleToCString(double_value, |
1212 Vector<char>(number_buffer_, kBufferSize)); | 1213 Vector<char>(number_buffer_, kBufferSize)); |
1213 length = StrLength(string); | 1214 length = StrLength(string); |
1214 } | 1215 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 } | 1303 } |
1303 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1304 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1304 } | 1305 } |
1305 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1306 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1306 | 1307 |
1307 backing_store_.AddBlock(bytes); | 1308 backing_store_.AddBlock(bytes); |
1308 return backing_store_.EndSequence().start(); | 1309 return backing_store_.EndSequence().start(); |
1309 } | 1310 } |
1310 | 1311 |
1311 } } // namespace v8::internal | 1312 } } // namespace v8::internal |
OLD | NEW |