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

Side by Side Diff: src/sksl/ir/SkSLFunctionDeclaration.h

Issue 2131223002: SkSL performance improvements (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: minor fixes 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SKSL_FUNCTIONDECLARATION 8 #ifndef SKSL_FUNCTIONDECLARATION
9 #define SKSL_FUNCTIONDECLARATION 9 #define SKSL_FUNCTIONDECLARATION
10 10
11 #include "SkSLModifiers.h" 11 #include "SkSLModifiers.h"
12 #include "SkSLSymbol.h" 12 #include "SkSLSymbol.h"
13 #include "SkSLType.h" 13 #include "SkSLType.h"
14 #include "SkSLVariable.h" 14 #include "SkSLVariable.h"
15 15
16 namespace SkSL { 16 namespace SkSL {
17 17
18 /** 18 /**
19 * A function declaration (not a definition -- does not contain a body). 19 * A function declaration (not a definition -- does not contain a body).
20 */ 20 */
21 struct FunctionDeclaration : public Symbol { 21 struct FunctionDeclaration : public Symbol {
22 FunctionDeclaration(Position position, std::string name, 22 FunctionDeclaration(Position position, std::string name,
23 std::vector<std::shared_ptr<Variable>> parameters, 23 std::vector<const Variable*> parameters, const Type& ret urnType)
24 std::shared_ptr<Type> returnType)
25 : INHERITED(position, kFunctionDeclaration_Kind, std::move(name)) 24 : INHERITED(position, kFunctionDeclaration_Kind, std::move(name))
26 , fDefined(false) 25 , fDefined(false)
27 , fParameters(parameters) 26 , fParameters(parameters)
dogben 2016/07/08 19:56:40 nit: std::move
28 , fReturnType(returnType) {} 27 , fReturnType(returnType) {}
29 28
30 std::string description() const override { 29 std::string description() const override {
31 std::string result = fReturnType->description() + " " + fName + "("; 30 std::string result = fReturnType.description() + " " + fName + "(";
32 std::string separator = ""; 31 std::string separator = "";
33 for (auto p : fParameters) { 32 for (auto p : fParameters) {
34 result += separator; 33 result += separator;
35 separator = ", "; 34 separator = ", ";
36 result += p->description(); 35 result += p->description();
37 } 36 }
38 result += ")"; 37 result += ")";
39 return result; 38 return result;
40 } 39 }
41 40
42 bool matches(FunctionDeclaration& f) { 41 bool matches(const FunctionDeclaration& f) const {
43 return fName == f.fName && fParameters == f.fParameters; 42 return fName == f.fName && fParameters == f.fParameters;
dogben 2016/07/08 19:56:40 (Not exactly related to this CL, but...) Seems lik
44 } 43 }
45 44
46 mutable bool fDefined; 45 mutable bool fDefined;
47 const std::vector<std::shared_ptr<Variable>> fParameters; 46 const std::vector<const Variable*> fParameters;
48 const std::shared_ptr<Type> fReturnType; 47 const Type& fReturnType;
49 48
50 typedef Symbol INHERITED; 49 typedef Symbol INHERITED;
51 }; 50 };
52 51
53 } // namespace 52 } // namespace
54 53
55 #endif 54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698