OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 Vector<const uint16_t> literal) { | 242 Vector<const uint16_t> literal) { |
243 uint32_t hash = StringHasher::HashSequentialString<uint16_t>( | 243 uint32_t hash = StringHasher::HashSequentialString<uint16_t>( |
244 literal.start(), literal.length(), hash_seed_); | 244 literal.start(), literal.length(), hash_seed_); |
245 return GetString(hash, false, Vector<const byte>::cast(literal)); | 245 return GetString(hash, false, Vector<const byte>::cast(literal)); |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 const AstRawString* AstValueFactory::GetString(Handle<String> literal) { | 249 const AstRawString* AstValueFactory::GetString(Handle<String> literal) { |
250 DisallowHeapAllocation no_gc; | 250 DisallowHeapAllocation no_gc; |
251 String::FlatContent content = literal->GetFlatContent(); | 251 String::FlatContent content = literal->GetFlatContent(); |
252 if (content.IsAscii()) { | 252 if (content.IsOneByte()) { |
253 return GetOneByteString(content.ToOneByteVector()); | 253 return GetOneByteString(content.ToOneByteVector()); |
254 } | 254 } |
255 DCHECK(content.IsTwoByte()); | 255 DCHECK(content.IsTwoByte()); |
256 return GetTwoByteString(content.ToUC16Vector()); | 256 return GetTwoByteString(content.ToUC16Vector()); |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 const AstConsString* AstValueFactory::NewConsString( | 260 const AstConsString* AstValueFactory::NewConsString( |
261 const AstString* left, const AstString* right) { | 261 const AstString* left, const AstString* right) { |
262 // This Vector will be valid as long as the Collector is alive (meaning that | 262 // This Vector will be valid as long as the Collector is alive (meaning that |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 if (isolate_) { | 400 if (isolate_) { |
401 new_string->Internalize(isolate_); | 401 new_string->Internalize(isolate_); |
402 } | 402 } |
403 entry->value = reinterpret_cast<void*>(1); | 403 entry->value = reinterpret_cast<void*>(1); |
404 } | 404 } |
405 return reinterpret_cast<AstRawString*>(entry->key); | 405 return reinterpret_cast<AstRawString*>(entry->key); |
406 } | 406 } |
407 | 407 |
408 | 408 |
409 } } // namespace v8::internal | 409 } } // namespace v8::internal |
OLD | NEW |