Chromium Code Reviews| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 | 160 |
| 161 | 161 |
| 162 void AstValue::Internalize(Isolate* isolate) { | 162 void AstValue::Internalize(Isolate* isolate) { |
| 163 switch (type_) { | 163 switch (type_) { |
| 164 case STRING: | 164 case STRING: |
| 165 DCHECK(string_ != NULL); | 165 DCHECK(string_ != NULL); |
| 166 // Strings are already internalized. | 166 // Strings are already internalized. |
| 167 DCHECK(!string_->string().is_null()); | 167 DCHECK(!string_->string().is_null()); |
| 168 break; | 168 break; |
| 169 case SYMBOL: | 169 case SYMBOL: |
| 170 DCHECK_EQ(0, strcmp(symbol_name_, "iterator_symbol")); | 170 if (symbol_name_[0] == 'i') { |
|
adamk
2015/06/03 22:39:12
This is not going to scale well, I wonder if we sh
| |
| 171 value_ = isolate->factory()->iterator_symbol(); | 171 DCHECK_EQ(0, strcmp(symbol_name_, "iterator_symbol")); |
| 172 value_ = isolate->factory()->iterator_symbol(); | |
| 173 } else { | |
| 174 DCHECK_EQ(0, strcmp(symbol_name_, "home_object_symbol")); | |
| 175 value_ = isolate->factory()->home_object_symbol(); | |
| 176 } | |
| 172 break; | 177 break; |
| 173 case NUMBER: | 178 case NUMBER: |
| 174 value_ = isolate->factory()->NewNumber(number_, TENURED); | 179 value_ = isolate->factory()->NewNumber(number_, TENURED); |
| 175 break; | 180 break; |
| 176 case SMI: | 181 case SMI: |
| 177 value_ = handle(Smi::FromInt(smi_), isolate); | 182 value_ = handle(Smi::FromInt(smi_), isolate); |
| 178 break; | 183 break; |
| 179 case BOOLEAN: | 184 case BOOLEAN: |
| 180 if (bool_) { | 185 if (bool_) { |
| 181 value_ = isolate->factory()->true_value(); | 186 value_ = isolate->factory()->true_value(); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 const AstRawString* lhs = static_cast<AstRawString*>(a); | 378 const AstRawString* lhs = static_cast<AstRawString*>(a); |
| 374 const AstRawString* rhs = static_cast<AstRawString*>(b); | 379 const AstRawString* rhs = static_cast<AstRawString*>(b); |
| 375 if (lhs->is_one_byte() != rhs->is_one_byte()) return false; | 380 if (lhs->is_one_byte() != rhs->is_one_byte()) return false; |
| 376 if (lhs->hash() != rhs->hash()) return false; | 381 if (lhs->hash() != rhs->hash()) return false; |
| 377 int len = lhs->byte_length(); | 382 int len = lhs->byte_length(); |
| 378 if (rhs->byte_length() != len) return false; | 383 if (rhs->byte_length() != len) return false; |
| 379 return memcmp(lhs->raw_data(), rhs->raw_data(), len) == 0; | 384 return memcmp(lhs->raw_data(), rhs->raw_data(), len) == 0; |
| 380 } | 385 } |
| 381 } // namespace internal | 386 } // namespace internal |
| 382 } // namespace v8 | 387 } // namespace v8 |
| OLD | NEW |