From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/JavaScriptCore/jsc.cpp | 3785 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 3325 insertions(+), 460 deletions(-) (limited to 'Source/JavaScriptCore/jsc.cpp') diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp index 40784b494..aedf42e17 100644 --- a/Source/JavaScriptCore/jsc.cpp +++ b/Source/JavaScriptCore/jsc.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved. + * Copyright (C) 2004-2017 Apple Inc. All rights reserved. * Copyright (C) 2006 Bjoern Graf (bjoern.graf@gmail.com) * * This library is free software; you can redistribute it and/or @@ -22,38 +22,74 @@ #include "config.h" -#include "APIShims.h" +#include "ArrayBuffer.h" +#include "ArrayPrototype.h" +#include "BuiltinExecutableCreator.h" +#include "BuiltinNames.h" #include "ButterflyInlines.h" -#include "BytecodeGenerator.h" -#include "CallFrameInlines.h" +#include "CodeBlock.h" #include "Completion.h" -#include "CopiedSpaceInlines.h" +#include "DOMJITGetterSetter.h" +#include "DOMJITPatchpoint.h" +#include "DOMJITPatchpointParams.h" +#include "Disassembler.h" +#include "Exception.h" #include "ExceptionHelpers.h" -#include "HeapStatistics.h" +#include "GetterSetter.h" +#include "HeapProfiler.h" +#include "HeapSnapshotBuilder.h" #include "InitializeThreading.h" #include "Interpreter.h" +#include "JIT.h" #include "JSArray.h" #include "JSArrayBuffer.h" +#include "JSCInlines.h" #include "JSFunction.h" +#include "JSInternalPromise.h" +#include "JSInternalPromiseDeferred.h" #include "JSLock.h" +#include "JSModuleLoader.h" +#include "JSNativeStdFunction.h" +#include "JSONObject.h" #include "JSProxy.h" +#include "JSSourceCode.h" #include "JSString.h" -#include "Operations.h" -#include "SamplingTool.h" +#include "JSTypedArrays.h" +#include "JSWebAssemblyCallee.h" +#include "LLIntData.h" +#include "LLIntThunks.h" +#include "ObjectConstructor.h" +#include "ParserError.h" +#include "ProfilerDatabase.h" +#include "ProtoCallFrame.h" +#include "ReleaseHeapAccessScope.h" +#include "SamplingProfiler.h" +#include "ShadowChicken.h" #include "StackVisitor.h" +#include "StructureInlines.h" #include "StructureRareDataInlines.h" +#include "SuperSampler.h" #include "TestRunnerUtils.h" +#include "TypeProfilerLog.h" +#include "WasmPlan.h" +#include "WasmMemory.h" +#include #include #include #include #include #include +#include +#include #include #include +#include #include #include -#if !OS(WINDOWS) +#if OS(WINDOWS) +#include +#else #include #endif @@ -74,7 +110,7 @@ #include #endif -#if COMPILER(MSVC) && !OS(WINCE) +#if COMPILER(MSVC) #include #include #include @@ -85,457 +121,3072 @@ #include #endif -#if PLATFORM(EFL) -#include +#if !defined(PATH_MAX) +#define PATH_MAX 4096 #endif using namespace JSC; using namespace WTF; -static bool fillBufferWithContentsOfFile(const String& fileName, Vector& buffer); +namespace { -static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionDescribe(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*); -#ifndef NDEBUG -static EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState*); +NO_RETURN_WITH_VALUE static void jscExit(int status) +{ + waitForAsynchronousDisassembly(); + +#if ENABLE(DFG_JIT) + if (DFG::isCrashing()) { + for (;;) { +#if OS(WINDOWS) + Sleep(1000); +#else + pause(); #endif -static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionReadFile(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionTransferArrayBuffer(ExecState*); -static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*); + } + } +#endif // ENABLE(DFG_JIT) + exit(status); +} -#if ENABLE(SAMPLING_FLAGS) -static EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*); -static EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*); -#endif +class Element; +class ElementHandleOwner; +class Masuqerader; +class Root; +class RuntimeArray; -struct Script { - bool isFile; - char* argument; +class Element : public JSNonFinalObject { +public: + Element(VM& vm, Structure* structure) + : Base(vm, structure) + { + } - Script(bool isFile, char *argument) - : isFile(isFile) - , argument(argument) + typedef JSNonFinalObject Base; + + Root* root() const { return m_root.get(); } + void setRoot(VM& vm, Root* root) { m_root.set(vm, this, root); } + + static Element* create(VM& vm, JSGlobalObject* globalObject, Root* root) { + Structure* structure = createStructure(vm, globalObject, jsNull()); + Element* element = new (NotNull, allocateCell(vm.heap, sizeof(Element))) Element(vm, structure); + element->finishCreation(vm, root); + return element; } -}; -class CommandLine { -public: - CommandLine(int argc, char** argv) - : m_interactive(false) - , m_dump(false) - , m_exitCode(false) - , m_profile(false) + void finishCreation(VM&, Root*); + + static void visitChildren(JSCell* cell, SlotVisitor& visitor) { - parseArguments(argc, argv); + Element* thisObject = jsCast(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + visitor.append(thisObject->m_root); } - bool m_interactive; - bool m_dump; - bool m_exitCode; - Vector