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

Unified Diff: src/ast/ast-value-factory.cc

Issue 2328593002: [Parser] Don't internalize on-the-fly. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/ast/ast-value-factory.cc
diff --git a/src/ast/ast-value-factory.cc b/src/ast/ast-value-factory.cc
index a2717518395623b08591b835d798d7238556dea7..d110bacecd1c59301948b7b5e939882b007b7537 100644
--- a/src/ast/ast-value-factory.cc
+++ b/src/ast/ast-value-factory.cc
@@ -237,28 +237,14 @@ AstRawString* AstValueFactory::GetTwoByteStringInternal(
const AstRawString* AstValueFactory::GetString(Handle<String> literal) {
- // For the FlatContent to stay valid, we shouldn't do any heap
- // allocation. Make sure we won't try to internalize the string in GetString.
AstRawString* result = NULL;
- Isolate* saved_isolate = isolate_;
- isolate_ = NULL;
- {
- DisallowHeapAllocation no_gc;
- String::FlatContent content = literal->GetFlatContent();
- if (content.IsOneByte()) {
- result = GetOneByteStringInternal(content.ToOneByteVector());
- } else {
- DCHECK(content.IsTwoByte());
- result = GetTwoByteStringInternal(content.ToUC16Vector());
- }
- }
- isolate_ = saved_isolate;
- if (strings_ != nullptr && isolate_) {
- // Only the string we are creating is uninternalized at this point.
- DCHECK_EQ(result, strings_);
- DCHECK_NULL(strings_->next());
- result->Internalize(isolate_);
- ResetStrings();
+ DisallowHeapAllocation no_gc;
+ String::FlatContent content = literal->GetFlatContent();
+ if (content.IsOneByte()) {
+ result = GetOneByteStringInternal(content.ToOneByteVector());
+ } else {
+ DCHECK(content.IsTwoByte());
+ result = GetTwoByteStringInternal(content.ToUC16Vector());
}
return result;
}
@@ -276,13 +262,6 @@ const AstConsString* AstValueFactory::NewConsString(
void AstValueFactory::Internalize(Isolate* isolate) {
- if (isolate_) {
- DCHECK_NULL(strings_);
- DCHECK_NULL(values_);
- // Everything is already internalized.
- return;
- }
-
// Strings need to be internalized before values, because values refer to
// strings.
for (AstString* current = strings_; current != nullptr;) {
@@ -295,7 +274,6 @@ void AstValueFactory::Internalize(Isolate* isolate) {
current->Internalize(isolate);
current = next;
}
- isolate_ = isolate;
ResetStrings();
values_ = nullptr;
}
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/parsing/parser.h » ('j') | src/parsing/rewriter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698