Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1087)

Side by Side Diff: src/ast/ast-value-factory.cc

Issue 2630343002: [Parser] Introduce AstStringConstants to share constants across AstValueFactory (Closed)
Patch Set: Fix test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 break; 214 break;
215 case THE_HOLE: 215 case THE_HOLE:
216 set_value(isolate->factory()->the_hole_value()); 216 set_value(isolate->factory()->the_hole_value());
217 break; 217 break;
218 case UNDEFINED: 218 case UNDEFINED:
219 set_value(isolate->factory()->undefined_value()); 219 set_value(isolate->factory()->undefined_value());
220 break; 220 break;
221 } 221 }
222 } 222 }
223 223
224
225 AstRawString* AstValueFactory::GetOneByteStringInternal( 224 AstRawString* AstValueFactory::GetOneByteStringInternal(
226 Vector<const uint8_t> literal) { 225 Vector<const uint8_t> literal) {
227 if (literal.length() == 1 && IsInRange(literal[0], 'a', 'z')) { 226 if (literal.length() == 1 && IsInRange(literal[0], 'a', 'z')) {
228 int key = literal[0] - 'a'; 227 int key = literal[0] - 'a';
229 if (one_character_strings_[key] == nullptr) { 228 if (one_character_strings_[key] == nullptr) {
230 uint32_t hash = StringHasher::HashSequentialString<uint8_t>( 229 uint32_t hash = StringHasher::HashSequentialString<uint8_t>(
231 literal.start(), literal.length(), hash_seed_); 230 literal.start(), literal.length(), hash_seed_);
232 one_character_strings_[key] = GetString(hash, true, literal); 231 one_character_strings_[key] = GetString(hash, true, literal);
233 } 232 }
234 return one_character_strings_[key]; 233 return one_character_strings_[key];
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 length) == 0; 397 length) == 0;
399 } else { 398 } else {
400 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), 399 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l),
401 reinterpret_cast<const uint16_t*>(r), 400 reinterpret_cast<const uint16_t*>(r),
402 length) == 0; 401 length) == 0;
403 } 402 }
404 } 403 }
405 } 404 }
406 } // namespace internal 405 } // namespace internal
407 } // namespace v8 406 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698