summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/interpreter/CachedCall.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/interpreter/CachedCall.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/interpreter/CachedCall.h')
-rw-r--r--Source/JavaScriptCore/interpreter/CachedCall.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/Source/JavaScriptCore/interpreter/CachedCall.h b/Source/JavaScriptCore/interpreter/CachedCall.h
index 2ca3e9794..fb770cb99 100644
--- a/Source/JavaScriptCore/interpreter/CachedCall.h
+++ b/Source/JavaScriptCore/interpreter/CachedCall.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,8 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CachedCall_h
-#define CachedCall_h
+#pragma once
#include "CallFrameClosure.h"
#include "ExceptionHelpers.h"
@@ -33,41 +32,50 @@
#include "Interpreter.h"
#include "ProtoCallFrame.h"
#include "VMEntryScope.h"
+#include "VMInlines.h"
+#include <wtf/ForbidHeapAllocation.h>
namespace JSC {
class CachedCall {
- WTF_MAKE_NONCOPYABLE(CachedCall); WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(CachedCall);
+ WTF_FORBID_HEAP_ALLOCATION;
public:
CachedCall(CallFrame* callFrame, JSFunction* function, int argumentCount)
: m_valid(false)
, m_interpreter(callFrame->interpreter())
- , m_entryScope(callFrame->vm(), function->scope()->globalObject())
+ , m_vm(callFrame->vm())
+ , m_entryScope(m_vm, function->scope()->globalObject(m_vm))
{
- ASSERT(!function->isHostFunction());
- if (callFrame->vm().isSafeToRecurse()) {
- m_arguments.resize(argumentCount);
- m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, &m_protoCallFrame, function, argumentCount + 1, function->scope(), m_arguments.data());
+ VM& vm = m_entryScope.vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ ASSERT(!function->isHostFunctionNonInline());
+ if (UNLIKELY(vm.isSafeToRecurseSoft())) {
+ m_arguments.ensureCapacity(argumentCount);
+ m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, &m_protoCallFrame, function, argumentCount + 1, function->scope(), m_arguments);
} else
- throwStackOverflowError(callFrame);
- m_valid = !callFrame->hadException();
+ throwStackOverflowError(callFrame, scope);
+ m_valid = !scope.exception();
}
JSValue call()
{
ASSERT(m_valid);
+ ASSERT(m_arguments.size() == static_cast<size_t>(m_protoCallFrame.argumentCount()));
return m_interpreter->execute(m_closure);
}
void setThis(JSValue v) { m_protoCallFrame.setThisValue(v); }
- void setArgument(int n, JSValue v) { m_protoCallFrame.setArgument(n, v); }
+
+ void clearArguments() { m_arguments.clear(); }
+ void appendArgument(JSValue v) { m_arguments.append(v); }
private:
bool m_valid;
Interpreter* m_interpreter;
+ VM& m_vm;
VMEntryScope m_entryScope;
ProtoCallFrame m_protoCallFrame;
- Vector<JSValue> m_arguments;
+ MarkedArgumentBuffer m_arguments;
CallFrameClosure m_closure;
};
}
-
-#endif