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

Unified Diff: src/sksl/SkSLParser.cpp

Issue 2143323003: Revert of SkSL performance improvements (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/sksl/SkSLIRGenerator.cpp ('k') | src/sksl/SkSLSPIRVCodeGenerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLParser.cpp
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index edff0c67d15516a9f4b4f8def23c9bdced04ea36..fa302af0d3debf78f31d2ee0db0fd4912fb616f4 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -52,7 +52,6 @@
#include "ast/SkSLASTVarDeclarationStatement.h"
#include "ast/SkSLASTWhileStatement.h"
#include "ir/SkSLSymbolTable.h"
-#include "ir/SkSLType.h"
namespace SkSL {
@@ -291,17 +290,17 @@
return nullptr;
}
for (size_t i = 0; i < decl->fNames.size(); i++) {
- auto type = (const Type*) fTypes[decl->fType->fName];
+ auto type = std::static_pointer_cast<Type>(fTypes[decl->fType->fName]);
for (int j = (int) decl->fSizes[i].size() - 1; j >= 0; j--) {
- if (decl->fSizes[i][j]->fKind != ASTExpression::kInt_Kind) {
+ if (decl->fSizes[i][j]->fKind == ASTExpression::kInt_Kind) {
this->error(decl->fPosition, "array size in struct field must be a constant");
}
uint64_t columns = ((ASTIntLiteral&) *decl->fSizes[i][j]).fValue;
std::string name = type->name() + "[" + to_string(columns) + "]";
- type = new Type(name, Type::kArray_Kind, *type, (int) columns);
- fTypes.takeOwnership((Type*) type);
- }
- fields.push_back(Type::Field(decl->fModifiers, decl->fNames[i], *type));
+ type = std::shared_ptr<Type>(new Type(name, Type::kArray_Kind, std::move(type),
+ (int) columns));
+ }
+ fields.push_back(Type::Field(decl->fModifiers, decl->fNames[i], std::move(type)));
if (decl->fValues[i]) {
this->error(decl->fPosition, "initializers are not permitted on struct fields");
}
@@ -310,8 +309,9 @@
if (!this->expect(Token::RBRACE, "'}'")) {
return nullptr;
}
- fTypes.add(name.fText, std::unique_ptr<Type>(new Type(name.fText, fields)));
- return std::unique_ptr<ASTType>(new ASTType(name.fPosition, name.fText,
+ std::shared_ptr<Type> type(new Type(name.fText, fields));
+ fTypes.add(type->fName, type);
+ return std::unique_ptr<ASTType>(new ASTType(name.fPosition, type->fName,
ASTType::kStruct_Kind));
}
« no previous file with comments | « src/sksl/SkSLIRGenerator.cpp ('k') | src/sksl/SkSLSPIRVCodeGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698