X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..ef99ff287df9046eb88937225e0554eabb00e33c:/bytecompiler/BytecodeGenerator.h diff --git a/bytecompiler/BytecodeGenerator.h b/bytecompiler/BytecodeGenerator.h index c273597..5e5ed61 100644 --- a/bytecompiler/BytecodeGenerator.h +++ b/bytecompiler/BytecodeGenerator.h @@ -1,6 +1,7 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2012, 2013, 2014 Apple Inc. All rights reserved. * Copyright (C) 2008 Cameron Zwarich + * Copyright (C) 2012 Igalia, S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,7 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -31,29 +32,64 @@ #define BytecodeGenerator_h #include "CodeBlock.h" -#include "HashTraits.h" +#include #include "Instruction.h" #include "Label.h" #include "LabelScope.h" #include "Interpreter.h" +#include "ParserError.h" #include "RegisterID.h" #include "SymbolTable.h" #include "Debugger.h" #include "Nodes.h" -#include +#include "StaticPropertyAnalyzer.h" +#include "UnlinkedCodeBlock.h" + +#include + #include #include #include + namespace JSC { class Identifier; - class ScopeChain; - class ScopeNode; + class Label; + + enum ExpectedFunction { + NoExpectedFunction, + ExpectObjectConstructor, + ExpectArrayConstructor + }; + + class CallArguments { + public: + CallArguments(BytecodeGenerator&, ArgumentsNode*, unsigned additionalArguments = 0); + + RegisterID* thisRegister() { return m_argv[0].get(); } + RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); } + unsigned stackOffset() { return -m_argv[0]->index() + JSStack::CallFrameHeaderSize; } + unsigned argumentCountIncludingThis() { return m_argv.size() - m_padding; } + RegisterID* profileHookRegister() { return m_profileHookRegister.get(); } + ArgumentsNode* argumentsNode() { return m_argumentsNode; } + + private: + RefPtr m_profileHookRegister; + ArgumentsNode* m_argumentsNode; + Vector, 8, UnsafeVectorOverflow> m_argv; + unsigned m_padding; + }; struct FinallyContext { - Label* finallyAddr; - RegisterID* retAddrDst; + StatementNode* finallyBlock; + unsigned scopeContextStackSize; + unsigned switchContextStackSize; + unsigned forInContextStackSize; + unsigned tryContextStackSize; + unsigned labelScopesSize; + int finallyDepth; + int dynamicScopeDepth; }; struct ControlFlowContext { @@ -61,60 +97,105 @@ namespace JSC { FinallyContext finallyContext; }; - class BytecodeGenerator : public WTF::FastAllocBase { + struct ForInContext { + RefPtr expectedSubscriptRegister; + RefPtr iterRegister; + RefPtr indexRegister; + RefPtr propertyRegister; + }; + + struct TryData { + RefPtr