[torque] hide internal variables used for labels with parameters
This fixes a bug that the variables used to implement labels with parameters in CSA leak into the user-accessible scope. Example: macro Foo() labels Bar(Smi) { Bar0 = 5; } Bug: v8:7793 Change-Id: I33bf5a207c7e9e7337fa79fc7591c05901b2fa5b Reviewed-on: https://chromium-review.googlesource.com/1246183 Reviewed-by: Daniel Clifford <danno@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#56257}
This commit is contained in:
parent
0ba3de6089
commit
1c2d611145
@ -638,7 +638,8 @@ void DeclarationVisitor::DeclareSignature(const Signature& signature) {
|
||||
}
|
||||
|
||||
std::string var_name = label.name + std::to_string(i++);
|
||||
new_label->AddVariable(DeclareVariable(var_name, var_type, false));
|
||||
new_label->AddVariable(
|
||||
declarations()->CreateVariable(var_name, var_type, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +304,15 @@ RuntimeFunction* Declarations::DeclareRuntimeFunction(
|
||||
return result;
|
||||
}
|
||||
|
||||
Variable* Declarations::CreateVariable(const std::string& var, const Type* type,
|
||||
bool is_const) {
|
||||
std::string name(var + "_" +
|
||||
std::to_string(GetNextUniqueDeclarationNumber()));
|
||||
std::replace(name.begin(), name.end(), '.', '_');
|
||||
return RegisterDeclarable(
|
||||
std::unique_ptr<Variable>(new Variable(var, name, type, is_const)));
|
||||
}
|
||||
|
||||
Variable* Declarations::DeclareVariable(const std::string& var,
|
||||
const Type* type, bool is_const) {
|
||||
std::string name(var + "_" +
|
||||
|
@ -91,6 +91,8 @@ class Declarations {
|
||||
RuntimeFunction* DeclareRuntimeFunction(const std::string& name,
|
||||
const Signature& signature);
|
||||
|
||||
Variable* CreateVariable(const std::string& var, const Type* type,
|
||||
bool is_const);
|
||||
Variable* DeclareVariable(const std::string& var, const Type* type,
|
||||
bool is_const);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user