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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // This Vector will be valid as long as the Collector is alive (meaning that | 255 // This Vector will be valid as long as the Collector is alive (meaning that |
256 // the AstRawString will not be moved). | 256 // the AstRawString will not be moved). |
257 AstConsString* new_string = new (zone_) AstConsString(left, right); | 257 AstConsString* new_string = new (zone_) AstConsString(left, right); |
258 CHECK(new_string != nullptr); | 258 CHECK(new_string != nullptr); |
259 AddString(new_string); | 259 AddString(new_string); |
260 return new_string; | 260 return new_string; |
261 } | 261 } |
262 | 262 |
263 | 263 |
264 void AstValueFactory::Internalize(Isolate* isolate) { | 264 void AstValueFactory::Internalize(Isolate* isolate) { |
| 265 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 266 // required by the constant array builder to de-duplicate objects without |
| 267 // dereferencing handles. |
| 268 std::unique_ptr<CanonicalHandleScope> canonical; |
| 269 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate)); |
| 270 |
265 // Strings need to be internalized before values, because values refer to | 271 // Strings need to be internalized before values, because values refer to |
266 // strings. | 272 // strings. |
267 for (AstString* current = strings_; current != nullptr;) { | 273 for (AstString* current = strings_; current != nullptr;) { |
268 AstString* next = current->next(); | 274 AstString* next = current->next(); |
269 current->Internalize(isolate); | 275 current->Internalize(isolate); |
270 current = next; | 276 current = next; |
271 } | 277 } |
272 for (AstValue* current = values_; current != nullptr;) { | 278 for (AstValue* current = values_; current != nullptr;) { |
273 AstValue* next = current->next(); | 279 AstValue* next = current->next(); |
274 current->Internalize(isolate); | 280 current->Internalize(isolate); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 length) == 0; | 391 length) == 0; |
386 } else { | 392 } else { |
387 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), | 393 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), |
388 reinterpret_cast<const uint16_t*>(r), | 394 reinterpret_cast<const uint16_t*>(r), |
389 length) == 0; | 395 length) == 0; |
390 } | 396 } |
391 } | 397 } |
392 } | 398 } |
393 } // namespace internal | 399 } // namespace internal |
394 } // namespace v8 | 400 } // namespace v8 |
OLD | NEW |