const AstConsString* AstValueFactory::NewConsString(
const AstString* left, const AstString* right) {
+ // This Vector will be valid as long as the Collector is alive (meaning that
+ // the AstRawString will not be moved).
AstConsString* new_string = new (zone_) AstConsString(left, right);
+ strings_.Add(new_string);
if (isolate_) {
new_string->Internalize(isolate_);
- } else {
- strings_.Add(new_string);
}
return new_string;
}
AstValue* value = new (zone_) AstValue(string);
DCHECK(string != NULL);
if (isolate_) {
- // If we're creating immediately-internalized AstValues, the underlying
- // strings must already be internalized at this point.
- DCHECK(!string->string_.is_null());
+ value->Internalize(isolate_);
}
- // These AstValues don't need to be added to values_, since the AstRawStrings
- // will be insternalized separately.
+ values_.Add(value);
return value;
}
AstValue* value = new (zone_) AstValue(name);
if (isolate_) {
value->Internalize(isolate_);
- } else {
- values_.Add(value);
}
+ values_.Add(value);
return value;
}
AstValue* value = new (zone_) AstValue(number);
if (isolate_) {
value->Internalize(isolate_);
- } else {
- values_.Add(value);
}
+ values_.Add(value);
return value;
}
new (zone_) AstValue(AstValue::SMI, number);
if (isolate_) {
value->Internalize(isolate_);
- } else {
- values_.Add(value);
}
+ values_.Add(value);
return value;
}
value = new (zone_) AstValue(initializer); \
if (isolate_) { \
value->Internalize(isolate_); \
- } else { \
- values_.Add(value); \
} \
+ values_.Add(value); \
} \
return value;
AstRawString* new_string = new (zone_) AstRawString(
is_one_byte, Vector<const byte>(new_literal_bytes, length), hash);
entry->key = new_string;
+ strings_.Add(new_string);
if (isolate_) {
new_string->Internalize(isolate_);
- } else {
- strings_.Add(new_string);
}
entry->value = reinterpret_cast<void*>(1);
}
}
Handle<SharedFunctionInfo> shared_info = info()->shared_info();
- // Lazy parsing is only done during runtime, when we're already using the
- // heap. So make the AstValueFactory also internalize all values when it
- // creates them (this is more efficient).
- ast_value_factory()->Internalize(isolate());
-
// Initialize parser state.
source = String::Flatten(source);
FunctionLiteral* result;