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

Unified Diff: src/PNaClTranslator.cpp

Issue 1738443002: Subzero. Performance tweaks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments -- all of them Created 4 years, 10 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/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index ed19f61ccfd5b869ecceec984fd3c7785b07c25a..1fb84c16b76e32f44592ed8670210b7e12031439 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -1355,33 +1355,35 @@ public:
// done to install a CfgLocalAllocator for various internal containers.
Func = Ice::Cfg::create(getTranslator().getContext(),
getTranslator().getNextSequenceNumber());
- Ice::Cfg::setCurrentCfg(Func.get());
-
- // TODO(kschimpf) Clean up API to add a function signature to a CFG.
- const Ice::FuncSigType &Signature = FuncDecl->getSignature();
-
- Func->setFunctionName(FuncDecl->getName());
- Func->setReturnType(Signature.getReturnType());
- Func->setInternal(FuncDecl->getLinkage() == GlobalValue::InternalLinkage);
- CurrentNode = installNextBasicBlock();
- Func->setEntryNode(CurrentNode);
- for (Ice::Type ArgType : Signature.getArgList()) {
- Func->addArg(getNextInstVar(ArgType));
- }
+ bool ParserResult;
+ {
+ Ice::CfgLocalAllocatorScope _(Func.get());
+
+ // TODO(kschimpf) Clean up API to add a function signature to a CFG.
+ const Ice::FuncSigType &Signature = FuncDecl->getSignature();
+
+ Func->setFunctionName(FuncDecl->getName());
+ Func->setReturnType(Signature.getReturnType());
+ Func->setInternal(FuncDecl->getLinkage() == GlobalValue::InternalLinkage);
+ CurrentNode = installNextBasicBlock();
+ Func->setEntryNode(CurrentNode);
+ for (Ice::Type ArgType : Signature.getArgList()) {
+ Func->addArg(getNextInstVar(ArgType));
+ }
- bool ParserResult = ParseThisBlock();
+ ParserResult = ParseThisBlock();
- // Temporarily end per-function timing, which will be resumed by the
- // translator function. This is because translation may be done
- // asynchronously in a separate thread.
- if (TimeThisFunction)
- getTranslator().getContext()->popTimer(TimerID, StackID);
+ // Temporarily end per-function timing, which will be resumed by the
+ // translator function. This is because translation may be done
+ // asynchronously in a separate thread.
+ if (TimeThisFunction)
+ getTranslator().getContext()->popTimer(TimerID, StackID);
- Ice::Cfg::setCurrentCfg(nullptr);
- // Note: Once any errors have been found, we turn off all translation of
- // all remaining functions. This allows successive parsing errors to be
- // reported, without adding extra checks to the translator for such parsing
- // errors.
+ // Note: Once any errors have been found, we turn off all translation of
+ // all remaining functions. This allows successive parsing errors to be
+ // reported, without adding extra checks to the translator for such
+ // parsing errors.
+ }
if (Context->getNumErrors() == 0 && Func) {
getTranslator().translateFcn(std::move(Func));
// The translator now has ownership of Func.
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698