2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef BytecodeGenerator_h
31 #define BytecodeGenerator_h
33 #include "CodeBlock.h"
34 #include "HashTraits.h"
35 #include "Instruction.h"
37 #include "LabelScope.h"
38 #include "Interpreter.h"
39 #include "RegisterID.h"
40 #include "SymbolTable.h"
43 #include <wtf/PassRefPtr.h>
44 #include <wtf/SegmentedVector.h>
45 #include <wtf/Vector.h>
54 CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode);
56 RegisterID* thisRegister() { return m_argv[0].get(); }
57 RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); }
58 unsigned callFrame() { return thisRegister()->index() + count() + RegisterFile::CallFrameHeaderSize; }
59 unsigned count() { return m_argv.size(); }
60 RegisterID* profileHookRegister() { return m_profileHookRegister.get(); }
61 ArgumentsNode* argumentsNode() { return m_argumentsNode; }
64 RefPtr<RegisterID> m_profileHookRegister;
65 ArgumentsNode* m_argumentsNode;
66 Vector<RefPtr<RegisterID>, 16> m_argv;
69 struct FinallyContext {
71 RegisterID* retAddrDst;
74 struct ControlFlowContext {
76 FinallyContext finallyContext;
80 RefPtr<RegisterID> expectedSubscriptRegister;
81 RefPtr<RegisterID> iterRegister;
82 RefPtr<RegisterID> indexRegister;
83 RefPtr<RegisterID> propertyRegister;
86 class BytecodeGenerator {
87 WTF_MAKE_FAST_ALLOCATED;
89 typedef DeclarationStacks::VarStack VarStack;
90 typedef DeclarationStacks::FunctionStack FunctionStack;
92 JS_EXPORT_PRIVATE static void setDumpsGeneratedCode(bool dumpsGeneratedCode);
93 static bool dumpsGeneratedCode();
95 enum CompilationKind { FirstCompilation, OptimizingCompilation };
97 BytecodeGenerator(ProgramNode*, ScopeChainNode*, SymbolTable*, ProgramCodeBlock*, CompilationKind);
98 BytecodeGenerator(FunctionBodyNode*, ScopeChainNode*, SymbolTable*, CodeBlock*, CompilationKind);
99 BytecodeGenerator(EvalNode*, ScopeChainNode*, SymbolTable*, EvalCodeBlock*, CompilationKind);
101 JSGlobalData* globalData() const { return m_globalData; }
102 const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
104 bool isConstructor() { return m_codeBlock->m_isConstructor; }
106 JSObject* generate();
108 // Returns the register corresponding to a local variable, or 0 if no
109 // such register exists. Registers returned by registerFor do not
110 // require explicit reference counting.
111 RegisterID* registerFor(const Identifier&);
113 // Returns the agument number if this is an argument, or 0 if not.
114 int argumentNumberFor(const Identifier&);
116 void setIsNumericCompareFunction(bool isNumericCompareFunction);
118 bool willResolveToArguments(const Identifier&);
119 RegisterID* uncheckedRegisterForArguments();
121 // Behaves as registerFor does, but ignores dynamic scope as
122 // dynamic scope should not interfere with const initialisation
123 RegisterID* constRegisterFor(const Identifier&);
125 // Searches the scope chain in an attempt to statically locate the requested
126 // property. Returns false if for any reason the property cannot be safely
127 // optimised at all. Otherwise it will return the index and depth of the
128 // VariableObject that defines the property. If the property cannot be found
129 // statically, depth will contain the depth of the scope chain where dynamic
130 // lookup must begin.
131 bool findScopedProperty(const Identifier&, int& index, size_t& depth, bool forWriting, bool& includesDynamicScopes, JSObject*& globalObject);
133 // Returns the register storing "this"
134 RegisterID* thisRegister() { return &m_thisRegister; }
136 bool isLocal(const Identifier&);
137 bool isLocalConstant(const Identifier&);
139 // Returns the next available temporary register. Registers returned by
140 // newTemporary require a modified form of reference counting: any
141 // register with a refcount of 0 is considered "available", meaning that
142 // the next instruction may overwrite it.
143 RegisterID* newTemporary();
145 RegisterID* highestUsedRegister();
147 // The same as newTemporary(), but this function returns "suggestion" if
148 // "suggestion" is a temporary. This function is helpful in situations
149 // where you've put "suggestion" in a RefPtr, but you'd like to allow
150 // the next instruction to overwrite it anyway.
151 RegisterID* newTemporaryOr(RegisterID* suggestion) { return suggestion->isTemporary() ? suggestion : newTemporary(); }
153 // Functions for handling of dst register
155 RegisterID* ignoredResult() { return &m_ignoredResultRegister; }
157 // Returns a place to write intermediate values of an operation
158 // which reuses dst if it is safe to do so.
159 RegisterID* tempDestination(RegisterID* dst)
161 return (dst && dst != ignoredResult() && dst->isTemporary()) ? dst : newTemporary();
164 // Returns the place to write the final output of an operation.
165 RegisterID* finalDestination(RegisterID* originalDst, RegisterID* tempDst = 0)
167 if (originalDst && originalDst != ignoredResult())
169 ASSERT(tempDst != ignoredResult());
170 if (tempDst && tempDst->isTemporary())
172 return newTemporary();
175 // Returns the place to write the final output of an operation.
176 RegisterID* finalDestinationOrIgnored(RegisterID* originalDst, RegisterID* tempDst = 0)
180 ASSERT(tempDst != ignoredResult());
181 if (tempDst && tempDst->isTemporary())
183 return newTemporary();
186 RegisterID* destinationForAssignResult(RegisterID* dst)
188 if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain())
189 return dst->isTemporary() ? dst : newTemporary();
193 // Moves src to dst if dst is not null and is different from src, otherwise just returns src.
194 RegisterID* moveToDestinationIfNeeded(RegisterID* dst, RegisterID* src)
196 return dst == ignoredResult() ? 0 : (dst && dst != src) ? emitMove(dst, src) : src;
199 PassRefPtr<LabelScope> newLabelScope(LabelScope::Type, const Identifier* = 0);
200 PassRefPtr<Label> newLabel();
202 // The emitNode functions are just syntactic sugar for calling
203 // Node::emitCode. These functions accept a 0 for the register,
204 // meaning that the node should allocate a register, or ignoredResult(),
205 // meaning that the node need not put the result in a register.
206 // Other emit functions do not accept 0 or ignoredResult().
207 RegisterID* emitNode(RegisterID* dst, Node* n)
209 // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
210 ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
211 addLineInfo(n->lineNo());
212 return m_stack.recursionCheck()
213 ? n->emitBytecode(*this, dst)
214 : emitThrowExpressionTooDeepException();
217 RegisterID* emitNode(Node* n)
219 return emitNode(0, n);
222 void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
224 addLineInfo(n->lineNo());
225 if (m_stack.recursionCheck())
226 n->emitBytecodeInConditionContext(*this, trueTarget, falseTarget, fallThroughMeansTrue);
228 emitThrowExpressionTooDeepException();
231 void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset)
233 if (!m_shouldEmitRichSourceInfo)
236 divot -= m_codeBlock->sourceOffset();
237 if (divot > ExpressionRangeInfo::MaxDivot) {
238 // Overflow has occurred, we can only give line number info for errors for this region
242 } else if (startOffset > ExpressionRangeInfo::MaxOffset) {
243 // If the start offset is out of bounds we clear both offsets
244 // so we only get the divot marker. Error message will have to be reduced
245 // to line and column number.
248 } else if (endOffset > ExpressionRangeInfo::MaxOffset) {
249 // The end offset is only used for additional context, and is much more likely
250 // to overflow (eg. function call arguments) so we are willing to drop it without
251 // dropping the rest of the range.
255 ExpressionRangeInfo info;
256 info.instructionOffset = instructions().size();
257 info.divotPoint = divot;
258 info.startOffset = startOffset;
259 info.endOffset = endOffset;
260 m_codeBlock->addExpressionInfo(info);
263 ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments, bool rightIsPure)
265 return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain() || rightHasAssignments) && !rightIsPure;
268 ALWAYS_INLINE PassRefPtr<RegisterID> emitNodeForLeftHandSide(ExpressionNode* n, bool rightHasAssignments, bool rightIsPure)
270 if (leftHandSideNeedsCopy(rightHasAssignments, rightIsPure)) {
271 PassRefPtr<RegisterID> dst = newTemporary();
272 emitNode(dst.get(), n);
276 return PassRefPtr<RegisterID>(emitNode(n));
279 RegisterID* emitLoad(RegisterID* dst, bool);
280 RegisterID* emitLoad(RegisterID* dst, double);
281 RegisterID* emitLoad(RegisterID* dst, const Identifier&);
282 RegisterID* emitLoad(RegisterID* dst, JSValue);
284 RegisterID* emitUnaryOp(OpcodeID, RegisterID* dst, RegisterID* src);
285 RegisterID* emitBinaryOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2, OperandTypes);
286 RegisterID* emitEqualityOp(OpcodeID, RegisterID* dst, RegisterID* src1, RegisterID* src2);
287 RegisterID* emitUnaryNoDstOp(OpcodeID, RegisterID* src);
289 RegisterID* emitNewObject(RegisterID* dst);
290 RegisterID* emitNewArray(RegisterID* dst, ElementNode*, unsigned length); // stops at first elision
292 RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body);
293 RegisterID* emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* body);
294 RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck);
295 RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func);
296 RegisterID* emitNewRegExp(RegisterID* dst, RegExp*);
298 RegisterID* emitMove(RegisterID* dst, RegisterID* src);
300 RegisterID* emitToJSNumber(RegisterID* dst, RegisterID* src) { return emitUnaryOp(op_to_jsnumber, dst, src); }
301 RegisterID* emitPreInc(RegisterID* srcDst);
302 RegisterID* emitPreDec(RegisterID* srcDst);
303 RegisterID* emitPostInc(RegisterID* dst, RegisterID* srcDst);
304 RegisterID* emitPostDec(RegisterID* dst, RegisterID* srcDst);
306 void emitCheckHasInstance(RegisterID* base);
307 RegisterID* emitInstanceOf(RegisterID* dst, RegisterID* value, RegisterID* base, RegisterID* basePrototype);
308 RegisterID* emitTypeOf(RegisterID* dst, RegisterID* src) { return emitUnaryOp(op_typeof, dst, src); }
309 RegisterID* emitIn(RegisterID* dst, RegisterID* property, RegisterID* base) { return emitBinaryOp(op_in, dst, property, base, OperandTypes()); }
311 RegisterID* emitResolve(RegisterID* dst, const Identifier& property);
312 RegisterID* emitGetScopedVar(RegisterID* dst, size_t skip, int index, JSValue globalObject);
313 RegisterID* emitPutScopedVar(size_t skip, int index, RegisterID* value, JSValue globalObject);
315 RegisterID* emitResolveBase(RegisterID* dst, const Identifier& property);
316 RegisterID* emitResolveBaseForPut(RegisterID* dst, const Identifier& property);
317 RegisterID* emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property);
318 RegisterID* emitResolveWithThis(RegisterID* baseDst, RegisterID* propDst, const Identifier& property);
320 void emitMethodCheck();
322 RegisterID* emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property);
323 RegisterID* emitGetArgumentsLength(RegisterID* dst, RegisterID* base);
324 RegisterID* emitPutById(RegisterID* base, const Identifier& property, RegisterID* value);
325 RegisterID* emitDirectPutById(RegisterID* base, const Identifier& property, RegisterID* value);
326 RegisterID* emitDeleteById(RegisterID* dst, RegisterID* base, const Identifier&);
327 RegisterID* emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
328 RegisterID* emitGetArgumentByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
329 RegisterID* emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value);
330 RegisterID* emitDeleteByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
331 RegisterID* emitPutByIndex(RegisterID* base, unsigned index, RegisterID* value);
332 RegisterID* emitPutGetter(RegisterID* base, const Identifier& property, RegisterID* value);
333 RegisterID* emitPutSetter(RegisterID* base, const Identifier& property, RegisterID* value);
335 RegisterID* emitCall(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
336 RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
337 RegisterID* emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* argCount, unsigned divot, unsigned startOffset, unsigned endOffset);
338 RegisterID* emitLoadVarargs(RegisterID* argCountDst, RegisterID* thisRegister, RegisterID* args);
340 RegisterID* emitReturn(RegisterID* src);
341 RegisterID* emitEnd(RegisterID* src) { return emitUnaryNoDstOp(op_end, src); }
343 RegisterID* emitConstruct(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
344 RegisterID* emitStrcat(RegisterID* dst, RegisterID* src, int count);
345 void emitToPrimitive(RegisterID* dst, RegisterID* src);
347 PassRefPtr<Label> emitLabel(Label*);
349 PassRefPtr<Label> emitJump(Label* target);
350 PassRefPtr<Label> emitJumpIfTrue(RegisterID* cond, Label* target);
351 PassRefPtr<Label> emitJumpIfFalse(RegisterID* cond, Label* target);
352 PassRefPtr<Label> emitJumpIfNotFunctionCall(RegisterID* cond, Label* target);
353 PassRefPtr<Label> emitJumpIfNotFunctionApply(RegisterID* cond, Label* target);
354 PassRefPtr<Label> emitJumpScopes(Label* target, int targetScopeDepth);
356 PassRefPtr<Label> emitJumpSubroutine(RegisterID* retAddrDst, Label*);
357 void emitSubroutineReturn(RegisterID* retAddrSrc);
359 RegisterID* emitGetPropertyNames(RegisterID* dst, RegisterID* base, RegisterID* i, RegisterID* size, Label* breakTarget);
360 RegisterID* emitNextPropertyName(RegisterID* dst, RegisterID* base, RegisterID* i, RegisterID* size, RegisterID* iter, Label* target);
362 RegisterID* emitCatch(RegisterID*, Label* start, Label* end);
363 void emitThrow(RegisterID* exc)
365 m_usesExceptions = true;
366 emitUnaryNoDstOp(op_throw, exc);
369 void emitThrowReferenceError(const UString& message);
371 void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
373 RegisterID* emitPushScope(RegisterID* scope);
376 void emitDebugHook(DebugHookID, int firstLine, int lastLine);
378 int scopeDepth() { return m_dynamicScopeDepth + m_finallyDepth; }
379 bool hasFinaliser() { return m_finallyDepth != 0; }
381 void pushFinallyContext(Label* target, RegisterID* returnAddrDst);
382 void popFinallyContext();
384 void pushOptimisedForIn(RegisterID* expectedBase, RegisterID* iter, RegisterID* index, RegisterID* propertyRegister)
386 ForInContext context = { expectedBase, iter, index, propertyRegister };
387 m_forInContextStack.append(context);
390 void popOptimisedForIn()
392 m_forInContextStack.removeLast();
395 LabelScope* breakTarget(const Identifier&);
396 LabelScope* continueTarget(const Identifier&);
398 void beginSwitch(RegisterID*, SwitchInfo::SwitchType);
399 void endSwitch(uint32_t clauseCount, RefPtr<Label>*, ExpressionNode**, Label* defaultLabel, int32_t min, int32_t range);
401 CodeType codeType() const { return m_codeType; }
403 bool shouldEmitProfileHooks() { return m_shouldEmitProfileHooks; }
405 bool isStrictMode() const { return m_codeBlock->isStrictMode(); }
407 ScopeChainNode* scopeChain() const { return m_scopeChain.get(); }
410 void emitOpcode(OpcodeID);
411 void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index);
412 void retrieveLastUnaryOp(int& dstIndex, int& srcIndex);
413 ALWAYS_INLINE void rewindBinaryOp();
414 ALWAYS_INLINE void rewindUnaryOp();
416 PassRefPtr<Label> emitComplexJumpScopes(Label* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope);
418 typedef HashMap<EncodedJSValue, unsigned, EncodedJSValueHash, EncodedJSValueHashTraits> JSValueMap;
420 struct IdentifierMapIndexHashTraits {
421 typedef int TraitType;
422 typedef IdentifierMapIndexHashTraits StorageTraits;
423 static int emptyValue() { return std::numeric_limits<int>::max(); }
424 static const bool emptyValueIsZero = false;
425 static const bool needsDestruction = false;
426 static const bool needsRef = false;
429 typedef HashMap<RefPtr<StringImpl>, int, IdentifierRepHash, HashTraits<RefPtr<StringImpl> >, IdentifierMapIndexHashTraits> IdentifierMap;
430 typedef HashMap<double, JSValue> NumberMap;
431 typedef HashMap<StringImpl*, JSString*, IdentifierRepHash> IdentifierStringMap;
433 RegisterID* emitCall(OpcodeID, RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
435 RegisterID* newRegister();
437 // Adds a var slot and maps it to the name ident in symbolTable().
438 RegisterID* addVar(const Identifier& ident, bool isConstant)
441 addVar(ident, isConstant, local);
445 // Ditto. Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
446 bool addVar(const Identifier&, bool isConstant, RegisterID*&);
448 // Adds an anonymous var slot. To give this slot a name, add it to symbolTable().
451 ++m_codeBlock->m_numVars;
452 return newRegister();
455 // Returns the index of the added var.
456 int addGlobalVar(const Identifier&, bool isConstant);
458 void addParameter(const Identifier&, int parameterIndex);
460 void preserveLastVar();
461 bool shouldAvoidResolveGlobal();
463 RegisterID& registerFor(int index)
466 return m_calleeRegisters[index];
468 ASSERT(m_parameters.size());
469 return m_parameters[index + m_parameters.size() + RegisterFile::CallFrameHeaderSize];
472 unsigned addConstant(const Identifier&);
473 RegisterID* addConstantValue(JSValue);
474 unsigned addRegExp(RegExp*);
476 unsigned addConstantBuffer(unsigned length);
478 FunctionExecutable* makeFunction(ExecState* exec, FunctionBodyNode* body)
480 return FunctionExecutable::create(exec, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
483 FunctionExecutable* makeFunction(JSGlobalData* globalData, FunctionBodyNode* body)
485 return FunctionExecutable::create(*globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
488 JSString* addStringConstant(const Identifier&);
490 void addLineInfo(unsigned lineNo)
492 #if !ENABLE(OPCODE_SAMPLING)
493 if (m_shouldEmitRichSourceInfo)
495 m_codeBlock->addLineInfo(instructions().size(), lineNo);
498 RegisterID* emitInitLazyRegister(RegisterID*);
500 Vector<Instruction>& instructions() { return m_codeBlock->instructions(); }
501 SymbolTable& symbolTable() { return *m_symbolTable; }
503 bool shouldOptimizeLocals()
505 if (m_dynamicScopeDepth)
508 if (m_codeType != FunctionCode)
514 bool canOptimizeNonLocals()
516 if (m_dynamicScopeDepth)
519 if (m_codeType == EvalCode)
522 if (m_codeType == FunctionCode && m_codeBlock->usesEval())
528 RegisterID* emitThrowExpressionTooDeepException();
530 void createArgumentsIfNecessary();
531 void createActivationIfNecessary();
532 RegisterID* createLazyRegisterIfNecessary(RegisterID*);
534 bool m_shouldEmitDebugHooks;
535 bool m_shouldEmitProfileHooks;
536 bool m_shouldEmitRichSourceInfo;
538 Strong<ScopeChainNode> m_scopeChain;
539 SymbolTable* m_symbolTable;
541 ScopeNode* m_scopeNode;
542 CodeBlock* m_codeBlock;
544 // Some of these objects keep pointers to one another. They are arranged
545 // to ensure a sane destruction order that avoids references to freed memory.
546 HashSet<RefPtr<StringImpl>, IdentifierRepHash> m_functions;
547 RegisterID m_ignoredResultRegister;
548 RegisterID m_thisRegister;
549 RegisterID* m_activationRegister;
550 SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
551 SegmentedVector<RegisterID, 32> m_calleeRegisters;
552 SegmentedVector<RegisterID, 32> m_parameters;
553 SegmentedVector<Label, 32> m_labels;
554 SegmentedVector<LabelScope, 8> m_labelScopes;
555 RefPtr<RegisterID> m_lastVar;
557 int m_dynamicScopeDepth;
558 int m_baseScopeDepth;
561 Vector<ControlFlowContext> m_scopeContextStack;
562 Vector<SwitchInfo> m_switchContextStack;
563 Vector<ForInContext> m_forInContextStack;
565 int m_firstConstantIndex;
566 int m_nextConstantOffset;
567 unsigned m_globalConstantIndex;
569 int m_globalVarStorageOffset;
571 bool m_hasCreatedActivation;
572 int m_firstLazyFunction;
573 int m_lastLazyFunction;
574 HashMap<unsigned int, FunctionBodyNode*, WTF::IntHash<unsigned int>, WTF::UnsignedWithZeroKeyHashTraits<unsigned int> > m_lazyFunctions;
575 typedef HashMap<FunctionBodyNode*, unsigned> FunctionOffsetMap;
576 FunctionOffsetMap m_functionOffsets;
579 IdentifierMap m_identifierMap;
580 JSValueMap m_jsValueMap;
581 NumberMap m_numberMap;
582 IdentifierStringMap m_stringMap;
584 JSGlobalData* m_globalData;
586 OpcodeID m_lastOpcodeID;
588 size_t m_lastOpcodePosition;
593 bool m_usesExceptions;
594 bool m_expressionTooDeep;
599 #endif // BytecodeGenerator_h