Changeset 153218 in webkit for trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp
- Timestamp:
- Jul 24, 2013, 9:02:28 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp
r153215 r153218 68 68 69 69 #if ENABLE(DFG_JIT) 70 CallFrame* CallFrame::trueCallFrame()71 {72 // Am I an inline call frame? If so, we're done.73 if (isInlinedFrame())74 return this;75 76 // If I don't have a code block, then I'm not DFG code, so I'm the true call frame.77 CodeBlock* machineCodeBlock = codeBlock();78 if (!machineCodeBlock)79 return this;80 81 // If the code block does not have any code origins, then there was no inlining, so82 // I'm done.83 if (!machineCodeBlock->hasCodeOrigins())84 return this;85 86 // Try to determine the CodeOrigin. If we don't have a pc set then the only way87 // that this makes sense is if the CodeOrigin index was set in the call frame.88 CodeOrigin codeOrigin;89 unsigned index = locationAsCodeOriginIndex();90 ASSERT(machineCodeBlock->canGetCodeOrigin(index));91 if (!machineCodeBlock->canGetCodeOrigin(index)) {92 // See above. In release builds, we try to protect ourselves from crashing even93 // though stack walking will be goofed up.94 return 0;95 }96 codeOrigin = machineCodeBlock->codeOrigin(index);97 98 if (!codeOrigin.inlineCallFrame)99 return this; // Not currently in inlined code.100 101 CodeOrigin innerMostCodeOrigin = codeOrigin;102 103 for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame;) {104 InlineCallFrame* nextInlineCallFrame = inlineCallFrame->caller.inlineCallFrame;105 106 CallFrame* inlinedCaller = this + inlineCallFrame->stackOffset;107 108 JSFunction* calleeAsFunction = inlineCallFrame->callee.get();109 110 // Fill in the inlinedCaller111 inlinedCaller->setCodeBlock(inlineCallFrame->baselineCodeBlock());112 if (calleeAsFunction)113 inlinedCaller->setScope(calleeAsFunction->scope());114 if (nextInlineCallFrame)115 inlinedCaller->setCallerFrame(this + nextInlineCallFrame->stackOffset);116 else117 inlinedCaller->setCallerFrame(this);118 119 inlinedCaller->setInlineCallFrame(inlineCallFrame);120 inlinedCaller->setArgumentCountIncludingThis(inlineCallFrame->arguments.size());121 inlinedCaller->setLocationAsBytecodeOffset(codeOrigin.bytecodeIndex);122 inlinedCaller->setIsInlinedFrame();123 if (calleeAsFunction)124 inlinedCaller->setCallee(calleeAsFunction);125 126 codeOrigin = inlineCallFrame->caller;127 inlineCallFrame = nextInlineCallFrame;128 }129 130 return this + innerMostCodeOrigin.inlineCallFrame->stackOffset;131 }132 133 CallFrame* CallFrame::trueCallerFrame()134 {135 CallFrame* callerFrame = this->callerFrame()->removeHostCallFrameFlag();136 if (!codeBlock())137 return callerFrame;138 139 // this -> The callee; this is either an inlined callee in which case it already has140 // a pointer to the true caller. Otherwise it contains current PC in the machine141 // caller.142 //143 // machineCaller -> The caller according to the machine, which may be zero or144 // more frames above the true caller due to inlining.145 146 // Am I an inline call frame? If so, we're done.147 if (isInlinedFrame())148 return callerFrame;149 150 // I am a machine call frame, so the question is: is my caller a machine call frame151 // that has inlines or a machine call frame that doesn't?152 if (!callerFrame)153 return 0;154 155 if (!callerFrame->codeBlock())156 return callerFrame;157 ASSERT(!callerFrame->isInlinedFrame());158 159 return callerFrame->trueCallFrame()->removeHostCallFrameFlag();160 }161 162 70 unsigned CallFrame::bytecodeOffsetFromCodeOriginIndex() 163 71 { … … 190 98 } 191 99 100 StackIterator CallFrame::begin(StackIterator::FrameFilter filter) 101 { 102 ASSERT(this); 103 return StackIterator(this, filter); 192 104 } 105 106 StackIterator CallFrame::find(JSFunction* calleeFunctionObj, StackIterator::FrameFilter filter) 107 { 108 ASSERT(this); 109 StackIterator iter = StackIterator(this, filter); 110 iter.find(calleeFunctionObj); 111 return iter; 112 } 113 114 StackIterator::Frame* CallFrame::end() 115 { 116 return StackIterator::end(); 117 } 118 119 }
Note:
See TracChangeset
for help on using the changeset viewer.