diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-08-03 11:40:33 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-08-03 11:15:43 +0000 |
commit | a88bc4e5aa0dfbf71cbe53c1dd8bfbae4d2a90f6 (patch) | |
tree | f7bdab35ea616050c5c00f245a74ea2636fc98fb /src/qml | |
parent | eabcd4c2dd15e120aa5b79eb66a2af394e3a55c1 (diff) |
Where applicable, rename Temp* to Register*
Change-Id: Ib7839ac09f520aaff3fadfdb37ea63d85a257bfd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator.cpp | 20 | ||||
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator_p.h | 8 | ||||
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 76 | ||||
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 14 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilercontrolflow_p.h | 8 |
6 files changed, 65 insertions, 65 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index a9cef5a76d..1a26396bbc 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -2048,8 +2048,8 @@ static void initScopedEnumResolver(QV4::IR::MemberExpressionResolver *resolver, void JSCodeGen::beginFunctionBodyHook() { - _qmlContextSlot = bytecodeGenerator->newTemp(); - _importedScriptsSlot = bytecodeGenerator->newTemp(); + _qmlContextSlot = bytecodeGenerator->newRegister(); + _importedScriptsSlot = bytecodeGenerator->newRegister(); #ifndef V4_BOOTSTRAP Instruction::LoadQmlContext load; diff --git a/src/qml/compiler/qv4bytecodegenerator.cpp b/src/qml/compiler/qv4bytecodegenerator.cpp index 825d823d3e..1fa1852d80 100644 --- a/src/qml/compiler/qv4bytecodegenerator.cpp +++ b/src/qml/compiler/qv4bytecodegenerator.cpp @@ -54,20 +54,20 @@ void BytecodeGenerator::setLocation(const QQmlJS::AST::SourceLocation &loc) addInstruction(line); //### put line numbers in a side-table, not in the instruction stream } -int BytecodeGenerator::newTemp() +int BytecodeGenerator::newRegister() { - int t = currentTemp++; - if (tempCount < currentTemp) - tempCount = currentTemp; + int t = currentReg++; + if (regCount < currentReg) + regCount = currentReg; return t; } -int BytecodeGenerator::newTempArray(int n) +int BytecodeGenerator::newRegisterArray(int n) { - int t = currentTemp; - currentTemp += n; - if (tempCount < currentTemp) - tempCount = currentTemp; + int t = currentReg; + currentReg += n; + if (regCount < currentReg) + regCount = currentReg; return t; } @@ -77,7 +77,7 @@ QByteArray BytecodeGenerator::finalize() Instruction::InitStackFrame init; init.instructionType = Instr::InitStackFrame; - init.value = tempCount; + init.value = regCount; code.append(reinterpret_cast<const char *>(&init), InstrMeta<Instr::InitStackFrame>::Size); // content diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h index 8034ac9327..bfb1ada6e4 100644 --- a/src/qml/compiler/qv4bytecodegenerator_p.h +++ b/src/qml/compiler/qv4bytecodegenerator_p.h @@ -193,8 +193,8 @@ public: return currentExceptionHandler; } - int newTemp(); - int newTempArray(int n); + int newRegister(); + int newRegisterArray(int n); QByteArray finalize(); @@ -233,9 +233,9 @@ private: QVector<int> labels; QVector<JumpData> jumps; ExceptionHandler *currentExceptionHandler; - int tempCount = 0; + int regCount = 0; public: - int currentTemp = 0; + int currentReg = 0; private: int currentLine = -1; }; diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 5777a209c8..d3cfdbb7fc 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -280,7 +280,7 @@ void Codegen::accept(Node *node) void Codegen::statement(Statement *ast) { - TempScope scope(this); + RegisterScope scope(this); bytecodeGenerator->setLocation(ast->firstSourceLocation()); accept(ast); @@ -288,7 +288,7 @@ void Codegen::statement(Statement *ast) void Codegen::statement(ExpressionNode *ast) { - TempScope scope(this); + RegisterScope scope(this); if (! ast) { return; @@ -371,7 +371,7 @@ void Codegen::sourceElements(SourceElements *ast) void Codegen::variableDeclaration(VariableDeclaration *ast) { - TempScope scope(this); + RegisterScope scope(this); if (!ast->expression) return; @@ -582,19 +582,19 @@ bool Codegen::visit(ArrayLiteral *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); int argc = 0; int args = -1; auto push = [this, &argc, &args](AST::ExpressionNode *arg) { - int temp = bytecodeGenerator->newTemp(); + int temp = bytecodeGenerator->newRegister(); if (args == -1) args = temp; if (!arg) { auto c = Reference::fromConst(this, Primitive::emptyValue().asReturnedValue()); (void) c.storeOnStack(temp); } else { - TempScope scope(this); + RegisterScope scope(this); (void) expression(arg).storeOnStack(temp); } ++argc; @@ -1005,7 +1005,7 @@ bool Codegen::visit(CallExpression *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); Reference base = expression(ast->base); if (hasError) @@ -1074,14 +1074,14 @@ Moth::StackSlot Codegen::pushArgs(ArgumentList *args) int argc = 0; for (ArgumentList *it = args; it; it = it->next) ++argc; - int calldata = bytecodeGenerator->newTempArray(argc + 2); // 2 additional values for CallData + int calldata = bytecodeGenerator->newRegisterArray(argc + 2); // 2 additional values for CallData (void) Reference::fromConst(this, QV4::Encode(argc)).storeOnStack(calldata); (void) Reference::fromConst(this, QV4::Encode::undefined()).storeOnStack(calldata + 1); argc = 0; for (ArgumentList *it = args; it; it = it->next) { - TempScope scope(this); + RegisterScope scope(this); Reference e = expression(it->expression); if (hasError) break; @@ -1097,7 +1097,7 @@ bool Codegen::visit(ConditionalExpression *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); BytecodeGenerator::Label iftrue = bytecodeGenerator->newLabel(); BytecodeGenerator::Label iffalse = bytecodeGenerator->newLabel(); @@ -1210,7 +1210,7 @@ bool Codegen::visit(FunctionExpression *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); int function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0); _expr.setResult(Reference::fromClosure(this, function)); @@ -1295,7 +1295,7 @@ bool Codegen::visit(NewExpression *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); Reference base = expression(ast->expression); if (hasError) @@ -1318,7 +1318,7 @@ bool Codegen::visit(NewMemberExpression *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); Reference base = expression(ast->base); if (hasError) @@ -1375,7 +1375,7 @@ bool Codegen::visit(ObjectLiteral *ast) QMap<QString, ObjectPropertyValue> valueMap; - TempScope scope(this); + RegisterScope scope(this); for (PropertyAssignmentList *it = ast->properties; it; it = it->next) { QString name = it->assignment->name->asString(); @@ -1433,7 +1433,7 @@ bool Codegen::visit(ObjectLiteral *ast) int args = -1; auto push = [this, &args](const Reference &arg) { - int temp = bytecodeGenerator->newTemp(); + int temp = bytecodeGenerator->newRegister(); if (args == -1) args = temp; (void) arg.storeOnStack(temp); @@ -1632,7 +1632,7 @@ bool Codegen::visit(TypeOfExpression *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); Reference expr = expression(ast->expression); if (hasError) @@ -1676,7 +1676,7 @@ bool Codegen::visit(VoidExpression *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); statement(ast->expression); _expr.setResult(Reference::fromConst(this, Encode::undefined())); @@ -1688,7 +1688,7 @@ bool Codegen::visit(FunctionDeclaration * ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); if (_context->compilationMode == QmlBinding) { Reference::fromName(this, ast->name.toString()).loadInAccumulator(); @@ -1723,7 +1723,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, savedBytecodeGenerator = bytecodeGenerator; bytecodeGenerator = &bytecode; - int returnAddress = bytecodeGenerator->newTemp(); + int returnAddress = bytecodeGenerator->newRegister(); if (!_context->parent || _context->usesArgumentsObject == Context::ArgumentsObjectUnknown) _context->usesArgumentsObject = Context::ArgumentsObjectNotUsed; @@ -1742,7 +1742,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, it->index = _context->locals.size(); _context->locals.append(local); } else { - it->index = bytecodeGenerator->newTemp(); + it->index = bytecodeGenerator->newRegister(); } } } else { @@ -1838,7 +1838,7 @@ bool Codegen::visit(Block *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); for (StatementList *it = ast->statements; it; it = it->next) { statement(it->statement); @@ -1875,7 +1875,7 @@ bool Codegen::visit(ContinueStatement *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); if (!_context->controlFlow) { throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Continue outside of loop")); @@ -1907,7 +1907,7 @@ bool Codegen::visit(DoWhileStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); BytecodeGenerator::Label body = bytecodeGenerator->label(); BytecodeGenerator::Label cond = bytecodeGenerator->newLabel(); @@ -1938,7 +1938,7 @@ bool Codegen::visit(ExpressionStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); if (_context->compilationMode == EvalCode || _context->compilationMode == QmlBinding) { Reference e = expression(ast->expression); @@ -1956,7 +1956,7 @@ bool Codegen::visit(ForEachStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); Reference obj = Reference::fromStackSlot(this); Reference expr = expression(ast->expression); @@ -2001,7 +2001,7 @@ bool Codegen::visit(ForStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); statement(ast->initialiser); @@ -2031,7 +2031,7 @@ bool Codegen::visit(IfStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); BytecodeGenerator::Label trueLabel = bytecodeGenerator->newLabel(); BytecodeGenerator::Label falseLabel = bytecodeGenerator->newLabel(); @@ -2056,7 +2056,7 @@ bool Codegen::visit(LabelledStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); // check that no outer loop contains the label ControlFlow *l = _context->controlFlow; @@ -2093,7 +2093,7 @@ bool Codegen::visit(LocalForEachStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); Reference obj = Reference::fromStackSlot(this); Reference expr = expression(ast->expression); @@ -2138,7 +2138,7 @@ bool Codegen::visit(LocalForStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); variableDeclarationList(ast->declarations); @@ -2193,7 +2193,7 @@ bool Codegen::visit(SwitchStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); if (ast->block) { BytecodeGenerator::Label switchEnd = bytecodeGenerator->newLabel(); @@ -2274,7 +2274,7 @@ bool Codegen::visit(ThrowStatement *ast) if (hasError) return false; - TempScope scope(this); + RegisterScope scope(this); Reference expr = expression(ast->expression); if (hasError) @@ -2299,11 +2299,11 @@ void Codegen::handleTryCatch(TryStatement *ast) return; } - TempScope scope(this); + RegisterScope scope(this); BytecodeGenerator::Label noException = bytecodeGenerator->newLabel(); { ControlFlowCatch catchFlow(this, ast->catchExpression); - TempScope scope(this); + RegisterScope scope(this); statement(ast->statement); bytecodeGenerator->jump().link(noException); } @@ -2312,13 +2312,13 @@ void Codegen::handleTryCatch(TryStatement *ast) void Codegen::handleTryFinally(TryStatement *ast) { - TempScope scope(this); + RegisterScope scope(this); ControlFlowFinally finally(this, ast->finallyExpression); if (ast->catchExpression) { handleTryCatch(ast); } else { - TempScope scope(this); + RegisterScope scope(this); statement(ast->statement); } } @@ -2330,7 +2330,7 @@ bool Codegen::visit(TryStatement *ast) Q_ASSERT(_context->hasTry); - TempScope scope(this); + RegisterScope scope(this); if (ast->finallyExpression && ast->finallyExpression->statement) { handleTryFinally(ast); @@ -2376,7 +2376,7 @@ bool Codegen::visit(WithStatement *ast) if (hasError) return true; - TempScope scope(this); + RegisterScope scope(this); _context->hasWith = true; diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index 4187a96719..2a482196ca 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -209,7 +209,7 @@ public: static Reference fromStackSlot(Codegen *cg, int tempIndex = -1, bool isLocal = false) { Reference r(cg, StackSlot); if (tempIndex == -1) - tempIndex = cg->bytecodeGenerator->newTemp(); + tempIndex = cg->bytecodeGenerator->newRegister(); r.theStackSlot = Moth::StackSlot::create(tempIndex); r.stackSlotIsLocal = isLocal; return r; @@ -328,15 +328,15 @@ public: void storeAccumulator() const; }; - struct TempScope { - TempScope(Codegen *cg) + struct RegisterScope { + RegisterScope(Codegen *cg) : generator(cg->bytecodeGenerator), - tempCountForScope(generator->currentTemp) {} - ~TempScope() { - generator->currentTemp = tempCountForScope; + regCountForScope(generator->currentReg) {} + ~RegisterScope() { + generator->currentReg = regCountForScope; } BytecodeGenerator *generator; - int tempCountForScope; + int regCountForScope; }; struct ObjectPropertyValue { diff --git a/src/qml/compiler/qv4compilercontrolflow_p.h b/src/qml/compiler/qv4compilercontrolflow_p.h index 5080b4e595..2735761246 100644 --- a/src/qml/compiler/qv4compilercontrolflow_p.h +++ b/src/qml/compiler/qv4compilercontrolflow_p.h @@ -214,7 +214,7 @@ struct ControlFlowUnwind : public ControlFlow : ControlFlow(cg, type), unwindLabel(generator()->newExceptionHandler()) { Q_ASSERT(type != Loop); - controlFlowTemp = static_cast<int>(generator()->newTemp()); + controlFlowTemp = static_cast<int>(generator()->newRegister()); Reference::storeConstOnStack(cg, QV4::Encode::undefined(), controlFlowTemp); // we'll need at least a handler for throw getHandler(Throw); @@ -226,7 +226,7 @@ struct ControlFlowUnwind : public ControlFlow Reference temp = Reference::fromStackSlot(cg, controlFlowTemp); for (const auto &h : qAsConst(handlers)) { - Codegen::TempScope tempScope(cg); + Codegen::RegisterScope tempScope(cg); Handler parentHandler = getParentHandler(h.type, h.label); if (h.type == Throw || parentHandler.tempIndex >= 0) { @@ -387,10 +387,10 @@ struct ControlFlowFinally : public ControlFlowUnwind // emit code for unwinding unwindLabel.link(); - Codegen::TempScope scope(cg); + Codegen::RegisterScope scope(cg); insideFinally = true; - exceptionTemp = generator()->newTemp(); + exceptionTemp = generator()->newRegister(); Instruction::GetException instr; generator()->addInstruction(instr); Reference::fromStackSlot(cg, exceptionTemp).storeConsumeAccumulator(); |