X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4e4e5a6f2694187498445a6ac6f1634ce8141119..93a3786624b2768d89bfa27e46598dc64e2fb70a:/bytecompiler/BytecodeGenerator.h diff --git a/bytecompiler/BytecodeGenerator.h b/bytecompiler/BytecodeGenerator.h index 0bd8184..c828c72 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 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 @@ -31,16 +32,18 @@ #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 @@ -48,12 +51,43 @@ namespace JSC { class Identifier; - class ScopeChain; - class ScopeNode; + class Label; + class JSScope; + + enum ExpectedFunction { + NoExpectedFunction, + ExpectObjectConstructor, + ExpectArrayConstructor + }; + + class CallArguments { + public: + CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode); + + RegisterID* thisRegister() { return m_argv[0].get(); } + RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); } + unsigned registerOffset() { return m_argv.last()->index() + CallFrame::offsetFor(argumentCountIncludingThis()); } + unsigned argumentCountIncludingThis() { return m_argv.size(); } + RegisterID* profileHookRegister() { return m_profileHookRegister.get(); } + ArgumentsNode* argumentsNode() { return m_argumentsNode; } + + private: + void newArgument(BytecodeGenerator&); + + RefPtr m_profileHookRegister; + ArgumentsNode* m_argumentsNode; + Vector, 8, UnsafeVectorOverflow> m_argv; + }; struct FinallyContext { - Label* finallyAddr; - RegisterID* retAddrDst; + StatementNode* finallyBlock; + unsigned scopeContextStackSize; + unsigned switchContextStackSize; + unsigned forInContextStackSize; + unsigned tryContextStackSize; + unsigned labelScopesSize; + int finallyDepth; + int dynamicScopeDepth; }; struct ControlFlowContext { @@ -68,60 +102,183 @@ namespace JSC { RefPtr propertyRegister; }; - class BytecodeGenerator : public FastAllocBase { + struct TryData { + RefPtr