blob: 343b02cbae7354f6e98c1c2892af2a6de3ec0fd2 [file] [log] [blame]
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00001/*
fpizlo@apple.combcfd39e2015-02-10 23:16:36 +00002 * Copyright (C) 2008, 2013, 2015 Apple Inc. All rights reserved.
commit-queue@webkit.orgd106bf22012-07-04 21:36:52 +00003 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +00004 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
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.
mjs@apple.com92047332014-03-15 04:08:27 +000014 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000015 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
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.
28 */
weinig@apple.coma963b962008-06-05 05:36:55 +000029
ggaren@apple.com901a8a22008-11-17 20:57:18 +000030#ifndef Interpreter_h
31#define Interpreter_h
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000032
weinig@apple.com49b32502008-07-06 00:10:04 +000033#include "ArgList.h"
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +000034#include "JSArrowFunction.h"
mhahnenberg@apple.comc1bc9d32013-01-24 21:39:55 +000035#include "JSCJSValue.h"
ggaren@apple.com1d72f772008-07-03 00:47:00 +000036#include "JSCell.h"
ggaren@apple.combb639262009-02-20 06:04:21 +000037#include "JSObject.h"
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +000038#include "JSStack.h"
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +000039#include "LLIntData.h"
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000040#include "Opcode.h"
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +000041#include "SourceProvider.h"
fpizlo@apple.combcfd39e2015-02-10 23:16:36 +000042#include "StackAlignment.h"
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000043
hausmann@webkit.orgf71db052009-07-15 15:14:15 +000044#include <wtf/HashMap.h>
commit-queue@webkit.orgd106bf22012-07-04 21:36:52 +000045#include <wtf/text/StringBuilder.h>
hausmann@webkit.orgf71db052009-07-15 15:14:15 +000046
cwzwarich@webkit.org3f782f62008-09-08 01:28:33 +000047namespace JSC {
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000048
49 class CodeBlock;
barraclough@apple.com836511562009-08-15 01:14:00 +000050 class EvalExecutable;
oliver@apple.comddf4b482012-02-17 21:17:59 +000051 class ExecutableBase;
barraclough@apple.com306bb122009-08-18 05:34:52 +000052 class FunctionExecutable;
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +000053 class VM;
commit-queue@webkit.orga4201b02015-08-17 22:24:20 +000054 class JSArrowFunction;
fpizlo@apple.com3a2fa4c2015-04-13 22:13:12 +000055 class JSFunction;
oliver@apple.comc8f3a752008-06-28 04:02:03 +000056 class JSGlobalObject;
utatane.tea@gmail.com6c389582015-09-04 04:29:04 +000057 class JSModuleEnvironment;
utatane.tea@gmail.coma8309d92015-09-01 02:05:30 +000058 class JSModuleRecord;
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +000059 class LLIntOffsetsExtractor;
barraclough@apple.com836511562009-08-15 01:14:00 +000060 class ProgramExecutable;
utatane.tea@gmail.coma8309d92015-09-01 02:05:30 +000061 class ModuleProgramExecutable;
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000062 class Register;
ggaren@apple.comb11e7872012-08-30 22:50:00 +000063 class JSScope;
barraclough@apple.comeb51bd92008-07-30 17:38:35 +000064 class SamplingTool;
oliver@apple.comef1f5ce2009-04-15 07:31:48 +000065 struct CallFrameClosure;
weinig@apple.com18064e72008-12-10 00:26:13 +000066 struct HandlerInfo;
levin@chromium.org93604aa2009-07-29 08:04:19 +000067 struct Instruction;
msaboff@apple.com6f0b31a2013-12-04 16:40:17 +000068 struct ProtoCallFrame;
69
mark.lam@apple.com4348a432015-09-07 05:19:28 +000070 enum UnwindStart { UnwindFromCurrentFrame, UnwindFromCallerFrame };
71
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000072 enum DebugHookID {
ggaren@apple.comd0740c82008-05-28 20:47:13 +000073 WillExecuteProgram,
74 DidExecuteProgram,
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000075 DidEnterCallFrame,
oliver@apple.com139b5292008-06-03 22:48:52 +000076 DidReachBreakpoint,
ggaren@apple.comd0740c82008-05-28 20:47:13 +000077 WillLeaveCallFrame,
78 WillExecuteStatement
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +000079 };
80
oliver@apple.comddf4b482012-02-17 21:17:59 +000081 enum StackFrameCodeType {
82 StackFrameGlobalCode,
83 StackFrameEvalCode,
utatane.tea@gmail.coma8309d92015-09-01 02:05:30 +000084 StackFrameModuleCode,
oliver@apple.comddf4b482012-02-17 21:17:59 +000085 StackFrameFunctionCode,
86 StackFrameNativeCode
87 };
88
89 struct StackFrame {
90 Strong<JSObject> callee;
91 StackFrameCodeType codeType;
ggaren@apple.com7a6a0f62015-03-26 23:12:39 +000092 Strong<ScriptExecutable> executable;
oliver@apple.come47f99d2013-04-06 22:47:56 +000093 Strong<UnlinkedCodeBlock> codeBlock;
94 RefPtr<SourceProvider> code;
95 int lineOffset;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +000096 unsigned firstLineColumnOffset;
oliver@apple.come47f99d2013-04-06 22:47:56 +000097 unsigned characterOffset;
98 unsigned bytecodeOffset;
benjamin@webkit.orgcff06e42012-08-30 21:23:51 +000099 String sourceURL;
oliver@apple.come47f99d2013-04-06 22:47:56 +0000100 JS_EXPORT_PRIVATE String toString(CallFrame*);
fpizlo@apple.com3a2fa4c2015-04-13 22:13:12 +0000101 String friendlySourceURL() const;
102 String friendlyFunctionName(CallFrame*) const;
mark.lam@apple.com5b45f902013-07-09 16:15:12 +0000103 JS_EXPORT_PRIVATE void computeLineAndColumn(unsigned& line, unsigned& column);
104
105 private:
106 void expressionInfo(int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column);
oliver@apple.comddf4b482012-02-17 21:17:59 +0000107 };
108
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000109 class SuspendExceptionScope {
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000110 public:
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000111 SuspendExceptionScope(VM* vm)
112 : m_vm(vm)
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000113 {
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000114 oldException = vm->exception();
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000115 vm->clearException();
116 }
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000117 ~SuspendExceptionScope()
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000118 {
saambarati1@gmail.com284319e2015-09-17 18:30:04 +0000119 m_vm->restorePreviousException(oldException);
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000120 }
121 private:
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000122 Exception* oldException;
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000123 VM* m_vm;
124 };
125
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000126 class TopCallFrameSetter {
127 public:
mark.lam@apple.com315b9822013-08-16 01:47:41 +0000128 TopCallFrameSetter(VM& currentVM, CallFrame* callFrame)
129 : vm(currentVM)
130 , oldCallFrame(currentVM.topCallFrame)
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000131 {
mark.lam@apple.com315b9822013-08-16 01:47:41 +0000132 currentVM.topCallFrame = callFrame;
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000133 }
134
135 ~TopCallFrameSetter()
136 {
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000137 vm.topCallFrame = oldCallFrame;
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000138 }
139 private:
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000140 VM& vm;
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000141 CallFrame* oldCallFrame;
142 };
oliver@apple.come07a4592012-01-25 19:43:06 +0000143
144 class NativeCallFrameTracer {
145 public:
mark.lam@apple.com315b9822013-08-16 01:47:41 +0000146 ALWAYS_INLINE NativeCallFrameTracer(VM* vm, CallFrame* callFrame)
oliver@apple.come07a4592012-01-25 19:43:06 +0000147 {
mark.lam@apple.com315b9822013-08-16 01:47:41 +0000148 ASSERT(vm);
oliver@apple.come07a4592012-01-25 19:43:06 +0000149 ASSERT(callFrame);
mark.lam@apple.com4348a432015-09-07 05:19:28 +0000150 ASSERT(callFrame < vm->topVMEntryFrame);
msaboff@apple.com59979042014-08-20 00:36:13 +0000151 vm->topCallFrame = callFrame;
152 }
msaboff@apple.com0576b242014-08-22 19:54:30 +0000153 };
msaboff@apple.com59979042014-08-20 00:36:13 +0000154
msaboff@apple.com0576b242014-08-22 19:54:30 +0000155 class NativeCallFrameTracerWithRestore {
156 public:
157 ALWAYS_INLINE NativeCallFrameTracerWithRestore(VM* vm, VMEntryFrame* vmEntryFrame, CallFrame* callFrame)
158 : m_vm(vm)
msaboff@apple.com59979042014-08-20 00:36:13 +0000159 {
160 ASSERT(vm);
161 ASSERT(callFrame);
msaboff@apple.com0576b242014-08-22 19:54:30 +0000162 m_savedTopVMEntryFrame = vm->topVMEntryFrame;
163 m_savedTopCallFrame = vm->topCallFrame;
msaboff@apple.com59979042014-08-20 00:36:13 +0000164 vm->topVMEntryFrame = vmEntryFrame;
mark.lam@apple.com315b9822013-08-16 01:47:41 +0000165 vm->topCallFrame = callFrame;
oliver@apple.come07a4592012-01-25 19:43:06 +0000166 }
msaboff@apple.com0576b242014-08-22 19:54:30 +0000167
168 ALWAYS_INLINE ~NativeCallFrameTracerWithRestore()
169 {
170 m_vm->topVMEntryFrame = m_savedTopVMEntryFrame;
171 m_vm->topCallFrame = m_savedTopCallFrame;
172 }
173
174 private:
175 VM* m_vm;
176 VMEntryFrame* m_savedTopVMEntryFrame;
177 CallFrame* m_savedTopCallFrame;
oliver@apple.come07a4592012-01-25 19:43:06 +0000178 };
commit-queue@webkit.org84814622011-08-25 01:25:38 +0000179
ossy@webkit.org95c1bc42011-01-20 16:30:54 +0000180 class Interpreter {
181 WTF_MAKE_FAST_ALLOCATED;
aroben@apple.come089d622012-02-21 16:26:12 +0000182 friend class CachedCall;
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +0000183 friend class LLIntOffsetsExtractor;
184 friend class JIT;
commit-queue@webkit.org3f922f92013-08-29 00:28:42 +0000185 friend class VM;
mark.lam@apple.com8b97fde2012-10-22 22:09:58 +0000186
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000187 public:
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000188 Interpreter(VM &);
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +0000189 ~Interpreter();
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000190
mark.lam@apple.coma6f900b2015-08-18 17:37:21 +0000191 void initialize();
barraclough@apple.com7c876fc2008-11-11 05:09:46 +0000192
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +0000193 JSStack& stack() { return m_stack; }
ggaren@apple.com82a62d02008-06-27 22:35:33 +0000194
ggaren@apple.com47d3f052008-11-15 21:37:49 +0000195 Opcode getOpcode(OpcodeID id)
ggaren@apple.come5af6d52008-09-26 22:43:16 +0000196 {
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000197 ASSERT(m_initialized);
commit-queue@webkit.orgb8419482012-08-30 22:21:48 +0000198#if ENABLE(COMPUTED_GOTO_OPCODES)
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000199 return m_opcodeTable[id];
200#else
201 return id;
202#endif
ggaren@apple.come5af6d52008-09-26 22:43:16 +0000203 }
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000204
ggaren@apple.com47d3f052008-11-15 21:37:49 +0000205 OpcodeID getOpcodeID(Opcode opcode)
weinig@apple.coma963b962008-06-05 05:36:55 +0000206 {
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000207 ASSERT(m_initialized);
dbatyai.u-szeged@partner.samsung.com46f07e52014-06-19 16:32:31 +0000208#if ENABLE(COMPUTED_GOTO_OPCODES)
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000209 ASSERT(isOpcode(opcode));
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +0000210 return m_opcodeIDTable.get(opcode);
mark.lam@apple.com74a9e832012-09-25 04:30:20 +0000211#else
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000212 return opcode;
mark.lam@apple.com74a9e832012-09-25 04:30:20 +0000213#endif
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000214 }
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +0000215
ggaren@apple.com47d3f052008-11-15 21:37:49 +0000216 bool isOpcode(Opcode);
barraclough@apple.com2607dd02010-10-27 20:46:09 +0000217
ggaren@apple.comb11e7872012-08-30 22:50:00 +0000218 JSValue execute(ProgramExecutable*, CallFrame*, JSObject* thisObj);
barraclough@apple.com2607dd02010-10-27 20:46:09 +0000219 JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&);
utatane.tea@gmail.com221fbc42015-07-22 00:29:39 +0000220 JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&, JSValue newTarget);
ggaren@apple.comb11e7872012-08-30 22:50:00 +0000221 JSValue execute(EvalExecutable*, CallFrame*, JSValue thisValue, JSScope*);
utatane.tea@gmail.com6c389582015-09-04 04:29:04 +0000222 JSValue execute(ModuleProgramExecutable*, CallFrame*, JSModuleEnvironment*);
weinig@apple.coma963b962008-06-05 05:36:55 +0000223
darin@apple.com8c2bac02008-10-09 00:40:43 +0000224 void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
oliver@apple.comc8f3a752008-06-28 04:02:03 +0000225
oliver@apple.comebd0b4c2009-09-29 21:48:52 +0000226 SamplingTool* sampler() { return m_sampler.get(); }
ggaren@apple.com82a62d02008-06-27 22:35:33 +0000227
mark.lam@apple.com4348a432015-09-07 05:19:28 +0000228 NEVER_INLINE HandlerInfo* unwind(VM&, CallFrame*&, Exception*, UnwindStart);
saambarati1@gmail.com284319e2015-09-17 18:30:04 +0000229 void notifyDebuggerOfExceptionToBeThrown(CallFrame*, Exception*);
mark.lam@apple.come72693d2013-09-24 23:52:57 +0000230 NEVER_INLINE void debug(CallFrame*, DebugHookID);
commit-queue@webkit.org0fc0afa2013-07-30 04:33:35 +0000231 JSString* stackTraceAsString(ExecState*, Vector<StackFrame>);
barraclough@apple.com5b374fc2009-06-02 05:36:18 +0000232
mark.lam@apple.comb07f4c42013-08-08 16:38:31 +0000233 static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState*);
234 static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState*);
235 static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecState*);
236 static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(ExecState*);
237
oliver@apple.comebd0b4c2009-09-29 21:48:52 +0000238 void dumpSampleData(ExecState* exec);
239 void startSampling();
240 void stopSampling();
oliver@apple.coma08210b2012-07-18 23:26:06 +0000241
242 JS_EXPORT_PRIVATE void dumpCallFrame(CallFrame*);
243
mmirman@apple.comc35dac92015-04-07 21:34:05 +0000244 void getStackTrace(Vector<StackFrame>& results, size_t maxStackSize = std::numeric_limits<size_t>::max());
245
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000246 private:
weinig@apple.coma963b962008-06-05 05:36:55 +0000247 enum ExecutionFlag { Normal, InitializeAndReturn };
oliver@apple.com9a4dea52009-04-15 07:13:25 +0000248
msaboff@apple.com6f0b31a2013-12-04 16:40:17 +0000249 CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, ProtoCallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*, JSValue*);
mark.lam@apple.comafeead12013-12-05 20:33:35 +0000250
barraclough@apple.com2607dd02010-10-27 20:46:09 +0000251 JSValue execute(CallFrameClosure&);
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000252
mmirman@apple.comc35dac92015-04-07 21:34:05 +0000253
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000254
ggaren@apple.com68313b02008-11-13 00:48:23 +0000255 void dumpRegisters(CallFrame*);
ggaren@apple.com4b8c0fb2008-10-20 16:48:30 +0000256
msaboff@apple.comc15ae7e2015-09-16 23:40:35 +0000257 bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval) || opcode == getOpcode(op_tail_call); }
mrowe@apple.comf88a4632008-09-07 05:44:58 +0000258
oliver@apple.comebd0b4c2009-09-29 21:48:52 +0000259 void enableSampler();
260 int m_sampleEntryDepth;
gyuyoung.kim@samsung.com2ddbadc2014-11-25 02:40:06 +0000261 std::unique_ptr<SamplingTool> m_sampler;
ggaren@apple.combe95ccf2008-10-25 19:59:47 +0000262
oliver@apple.come0b15ee2013-07-25 04:01:06 +0000263 VM& m_vm;
mark.lam@apple.com4fbb9c32012-10-09 07:12:56 +0000264 JSStack m_stack;
mark.lam@apple.com8b97fde2012-10-22 22:09:58 +0000265 int m_errorHandlingModeReentry;
ggaren@apple.com1d72f772008-07-03 00:47:00 +0000266
dbatyai.u-szeged@partner.samsung.com46f07e52014-06-19 16:32:31 +0000267#if ENABLE(COMPUTED_GOTO_OPCODES)
fpizlo@apple.com7bbcaab2012-02-22 05:23:19 +0000268 Opcode* m_opcodeTable; // Maps OpcodeID => Opcode for compiling
269 HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000270#endif
fpizlo@apple.com0afe9662011-12-20 02:42:06 +0000271
272#if !ASSERT_DISABLED
273 bool m_initialized;
274#endif
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000275 };
barraclough@apple.com19afece2011-07-15 19:51:49 +0000276
ggaren@apple.com539d1bb2011-11-14 19:21:40 +0000277 JSValue eval(CallFrame*);
fpizlo@apple.combcfd39e2015-02-10 23:16:36 +0000278
279 inline CallFrame* calleeFrameForVarargs(CallFrame* callFrame, unsigned numUsedStackSlots, unsigned argumentCountIncludingThis)
280 {
msaboff@apple.comc15ae7e2015-09-16 23:40:35 +0000281 // We want the new frame to be allocated on a stack aligned offset with a stack
282 // aligned size. Align the size here.
283 argumentCountIncludingThis = WTF::roundUpToMultipleOf(
284 stackAlignmentRegisters(),
285 argumentCountIncludingThis + JSStack::CallFrameHeaderSize) - JSStack::CallFrameHeaderSize;
286
287 // Align the frame offset here.
fpizlo@apple.combcfd39e2015-02-10 23:16:36 +0000288 unsigned paddedCalleeFrameOffset = WTF::roundUpToMultipleOf(
289 stackAlignmentRegisters(),
290 numUsedStackSlots + argumentCountIncludingThis + JSStack::CallFrameHeaderSize);
291 return CallFrame::create(callFrame->registers() - paddedCalleeFrameOffset);
292 }
293
fpizlo@apple.com8fefdd32015-02-18 19:55:47 +0000294 unsigned sizeOfVarargs(CallFrame* exec, JSValue arguments, uint32_t firstVarArgOffset);
fpizlo@apple.comda834ae2015-03-26 04:28:43 +0000295 static const unsigned maxArguments = 0x10000;
fpizlo@apple.combcfd39e2015-02-10 23:16:36 +0000296 unsigned sizeFrameForVarargs(CallFrame* exec, JSStack*, JSValue arguments, unsigned numUsedStackSlots, uint32_t firstVarArgOffset);
297 void loadVarargs(CallFrame* execCaller, VirtualRegister firstElementDest, JSValue source, uint32_t offset, uint32_t length);
298 void setupVarargsFrame(CallFrame* execCaller, CallFrame* execCallee, JSValue arguments, uint32_t firstVarArgOffset, uint32_t length);
299 void setupVarargsFrameAndSetThis(CallFrame* execCaller, CallFrame* execCallee, JSValue thisValue, JSValue arguments, uint32_t firstVarArgOffset, uint32_t length);
fpizlo@apple.com74485fb2015-02-10 03:27:43 +0000300
cwzwarich@webkit.org3f782f62008-09-08 01:28:33 +0000301} // namespace JSC
mrowe@apple.com2f6dfdf2008-05-22 01:20:45 +0000302
ggaren@apple.com901a8a22008-11-17 20:57:18 +0000303#endif // Interpreter_h