X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..b80e619319b1def83d1e8b4f84042b661be1be7f:/bytecompiler/BytecodeGenerator.h?ds=inline diff --git a/bytecompiler/BytecodeGenerator.h b/bytecompiler/BytecodeGenerator.h index c273597..3667198 100644 --- a/bytecompiler/BytecodeGenerator.h +++ b/bytecompiler/BytecodeGenerator.h @@ -61,7 +61,14 @@ namespace JSC { FinallyContext finallyContext; }; - class BytecodeGenerator : public WTF::FastAllocBase { + struct ForInContext { + RefPtr expectedSubscriptRegister; + RefPtr iterRegister; + RefPtr indexRegister; + RefPtr propertyRegister; + }; + + class BytecodeGenerator : public FastAllocBase { public: typedef DeclarationStacks::VarStack VarStack; typedef DeclarationStacks::FunctionStack FunctionStack; @@ -99,7 +106,7 @@ namespace JSC { // // 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, JSObject*& globalObject); + bool findScopedProperty(const Identifier&, int& index, size_t& depth, bool forWriting, bool& includesDynamicScopes, JSObject*& globalObject); // Returns the register storing "this" RegisterID* thisRegister() { return &m_thisRegister; } @@ -185,6 +192,19 @@ namespace JSC { return emitNode(0, n); } + void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue) + { + if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) { + LineInfo info = { instructions().size(), n->lineNo() }; + m_codeBlock->addLineInfo(info); + } + if (m_emitNodeDepth >= s_maxEmitNodeDepth) + emitThrowExpressionTooDeepException(); + ++m_emitNodeDepth; + n->emitBytecodeInConditionContext(*this, trueTarget, falseTarget, fallThroughMeansTrue); + --m_emitNodeDepth; + } + void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset) { divot -= m_codeBlock->sourceOffset(); @@ -254,7 +274,7 @@ namespace JSC { RegisterID* emitNewObject(RegisterID* dst); RegisterID* emitNewArray(RegisterID* dst, ElementNode*); // stops at first elision - RegisterID* emitNewFunction(RegisterID* dst, FuncDeclNode* func); + RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body); RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func); RegisterID* emitNewRegExp(RegisterID* dst, RegExp* regExp); @@ -281,6 +301,7 @@ namespace JSC { RegisterID* emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property); RegisterID* emitPutById(RegisterID* base, const Identifier& property, RegisterID* value); + RegisterID* emitDirectPutById(RegisterID* base, const Identifier& property, RegisterID* value); RegisterID* emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier&); RegisterID* emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property); RegisterID* emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value); @@ -312,13 +333,13 @@ namespace JSC { PassRefPtr