diff options
Diffstat (limited to 'JavaScriptCore/bytecompiler/BytecodeGenerator.h')
-rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.h | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 0a49392..7626bf4 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -83,6 +83,8 @@ namespace JSC { JSGlobalData* globalData() const { return m_globalData; } const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; } + bool isConstructor() { return m_codeBlock->m_isConstructor; } + void generate(); // Returns the register corresponding to a local variable, or 0 if no @@ -103,9 +105,6 @@ namespace JSC { // VariableObject that defines the property. If the property cannot be found // statically, depth will contain the depth of the scope chain where dynamic // lookup must begin. - // - // NB: depth does _not_ include the local scope. eg. a depth of 0 refers - // to the scope containing this codeblock. bool findScopedProperty(const Identifier&, int& index, size_t& depth, bool forWriting, bool& includesDynamicScopes, JSObject*& globalObject); // Returns the register storing "this" @@ -150,6 +149,17 @@ namespace JSC { return newTemporary(); } + // Returns the place to write the final output of an operation. + RegisterID* finalDestinationOrIgnored(RegisterID* originalDst, RegisterID* tempDst = 0) + { + if (originalDst) + return originalDst; + ASSERT(tempDst != ignoredResult()); + if (tempDst && tempDst->isTemporary()) + return tempDst; + return newTemporary(); + } + RegisterID* destinationForAssignResult(RegisterID* dst) { if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain()) @@ -404,15 +414,23 @@ namespace JSC { RegisterID* newRegister(); - // Returns the RegisterID corresponding to ident. + // Adds a var slot and maps it to the name ident in symbolTable(). RegisterID* addVar(const Identifier& ident, bool isConstant) { RegisterID* local; addVar(ident, isConstant, local); return local; } - // Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used. + + // Ditto. Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used. bool addVar(const Identifier&, bool isConstant, RegisterID*&); + + // Adds an anonymous var slot. To give this slot a name, add it to symbolTable(). + RegisterID* addVar() + { + ++m_codeBlock->m_numVars; + return newRegister(); + } // Returns the RegisterID corresponding to ident. RegisterID* addGlobalVar(const Identifier& ident, bool isConstant) @@ -433,9 +451,6 @@ namespace JSC { if (index >= 0) return m_calleeRegisters[index]; - if (index == RegisterFile::OptionalCalleeArguments) - return m_argumentsRegister; - if (m_parameters.size()) { ASSERT(!m_globals.size()); return m_parameters[index + m_parameters.size() + RegisterFile::CallFrameHeaderSize]; @@ -482,8 +497,7 @@ namespace JSC { HashSet<RefPtr<UString::Rep>, IdentifierRepHash> m_functions; RegisterID m_ignoredResultRegister; RegisterID m_thisRegister; - RegisterID m_argumentsRegister; - int m_activationRegisterIndex; + RegisterID* m_activationRegister; SegmentedVector<RegisterID, 32> m_constantPoolRegisters; SegmentedVector<RegisterID, 32> m_calleeRegisters; SegmentedVector<RegisterID, 32> m_parameters; |