Commit 75288a03 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[torque] Use StringConstant when generating strings

Use StringConstant instead of NewStringFromAsciiChecked so strings are
deduplicated.

Change-Id: I0c5395be6d06caacd7d257b61bd2372da2fce427
Reviewed-on: https://chromium-review.googlesource.com/1025815Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52763}
parent 6e830964
...@@ -426,9 +426,8 @@ VisitResult ImplementationVisitor::Visit(NumberLiteralExpression* expr) { ...@@ -426,9 +426,8 @@ VisitResult ImplementationVisitor::Visit(NumberLiteralExpression* expr) {
VisitResult ImplementationVisitor::Visit(StringLiteralExpression* expr) { VisitResult ImplementationVisitor::Visit(StringLiteralExpression* expr) {
std::string temp = GenerateNewTempVariable(GetTypeOracle().GetStringType()); std::string temp = GenerateNewTempVariable(GetTypeOracle().GetStringType());
source_out() source_out() << "StringConstant(\""
<< "HeapConstant(isolate()->factory()->NewStringFromAsciiChecked(\"" << expr->literal.substr(1, expr->literal.size() - 2) << "\");"
<< expr->literal.substr(1, expr->literal.size() - 2) << "\"));"
<< std::endl; << std::endl;
return VisitResult{GetTypeOracle().GetStringType(), temp}; return VisitResult{GetTypeOracle().GetStringType(), temp};
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment