Changeset 243365 in webkit
- Timestamp:
- Mar 22, 2019, 12:14:43 AM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 16 edited
- 2 copied
-
CMakeLists.txt (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
JavaScriptCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Sources.txt (modified) (1 diff)
-
bytecode/UnlinkedFunctionExecutable.cpp (modified) (1 diff)
-
runtime/EvalExecutable.cpp (modified) (1 diff)
-
runtime/EvalExecutable.h (modified) (1 diff)
-
runtime/FunctionExecutable.cpp (modified) (4 diffs)
-
runtime/FunctionExecutable.h (modified) (7 diffs)
-
runtime/GlobalExecutable.cpp (copied) (copied from trunk/Source/JavaScriptCore/tools/FunctionOverrides.h ) (2 diffs)
-
runtime/GlobalExecutable.h (copied) (copied from trunk/Source/JavaScriptCore/tools/FunctionOverrides.h ) (2 diffs)
-
runtime/ModuleProgramExecutable.cpp (modified) (1 diff)
-
runtime/ModuleProgramExecutable.h (modified) (1 diff)
-
runtime/ProgramExecutable.cpp (modified) (1 diff)
-
runtime/ProgramExecutable.h (modified) (1 diff)
-
runtime/ScriptExecutable.cpp (modified) (8 diffs)
-
runtime/ScriptExecutable.h (modified) (4 diffs)
-
tools/FunctionOverrides.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r243312 r243365 804 804 runtime/GenericTypedArrayViewInlines.h 805 805 runtime/GetPutInfo.h 806 runtime/GlobalExecutable.h 806 807 runtime/HashMapImpl.h 807 808 runtime/Identifier.h -
trunk/Source/JavaScriptCore/ChangeLog
r243364 r243365 1 2019-03-21 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Shrink sizeof(FunctionExecutable) by 16bytes 4 https://bugs.webkit.org/show_bug.cgi?id=196122 5 6 Reviewed by Saam Barati. 7 8 This patch reduces sizeof(FunctionExecutable) by 16 bytes. 9 10 1. ScriptExecutable::m_numParametersForCall and ScriptExecutable::m_numParametersForConstruct are not used in a meaningful way. Removed them. 11 2. ScriptExecutable::m_lastLine and ScriptExecutable::m_endColumn can be calculated from UnlinkedFunctionExecutable. So FunctionExecutable does not need to hold it. 12 This patch adds GlobalExecutable, which are non-function ScriptExecutables, and move m_lastLine and m_endColumn to this class. 13 3. FunctionExecutable still needs to have the feature overriding m_lastLine and m_endColumn. We move overridden data in FunctionExecutable::RareData. 14 15 * CMakeLists.txt: 16 * JavaScriptCore.xcodeproj/project.pbxproj: 17 * Sources.txt: 18 * bytecode/UnlinkedFunctionExecutable.cpp: 19 (JSC::UnlinkedFunctionExecutable::link): 20 * runtime/EvalExecutable.cpp: 21 (JSC::EvalExecutable::EvalExecutable): 22 * runtime/EvalExecutable.h: 23 * runtime/FunctionExecutable.cpp: 24 (JSC::FunctionExecutable::FunctionExecutable): 25 (JSC::FunctionExecutable::ensureRareDataSlow): 26 (JSC::FunctionExecutable::overrideInfo): 27 * runtime/FunctionExecutable.h: 28 * runtime/GlobalExecutable.cpp: Copied from Source/JavaScriptCore/tools/FunctionOverrides.h. 29 * runtime/GlobalExecutable.h: Copied from Source/JavaScriptCore/tools/FunctionOverrides.h. 30 (JSC::GlobalExecutable::lastLine const): 31 (JSC::GlobalExecutable::endColumn const): 32 (JSC::GlobalExecutable::recordParse): 33 (JSC::GlobalExecutable::GlobalExecutable): 34 * runtime/ModuleProgramExecutable.cpp: 35 (JSC::ModuleProgramExecutable::ModuleProgramExecutable): 36 * runtime/ModuleProgramExecutable.h: 37 * runtime/ProgramExecutable.cpp: 38 (JSC::ProgramExecutable::ProgramExecutable): 39 * runtime/ProgramExecutable.h: 40 * runtime/ScriptExecutable.cpp: 41 (JSC::ScriptExecutable::clearCode): 42 (JSC::ScriptExecutable::installCode): 43 (JSC::ScriptExecutable::hasClearableCode const): 44 (JSC::ScriptExecutable::newCodeBlockFor): 45 (JSC::ScriptExecutable::typeProfilingEndOffset const): 46 (JSC::ScriptExecutable::recordParse): 47 (JSC::ScriptExecutable::lastLine const): 48 (JSC::ScriptExecutable::endColumn const): 49 * runtime/ScriptExecutable.h: 50 (JSC::ScriptExecutable::hasJITCodeForCall const): 51 (JSC::ScriptExecutable::hasJITCodeForConstruct const): 52 (JSC::ScriptExecutable::recordParse): 53 (JSC::ScriptExecutable::lastLine const): Deleted. 54 (JSC::ScriptExecutable::endColumn const): Deleted. 55 * tools/FunctionOverrides.h: 56 1 57 2019-03-21 Yusuke Suzuki <ysuzuki@apple.com> 2 58 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r243312 r243365 1767 1767 E354622B1B6065D100545386 /* ConstructAbility.h in Headers */ = {isa = PBXBuildFile; fileRef = E354622A1B6065D100545386 /* ConstructAbility.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1768 1768 E3555B8A1DAE03A500F36921 /* DOMJITCallDOMGetterSnippet.h in Headers */ = {isa = PBXBuildFile; fileRef = E3555B891DAE03A200F36921 /* DOMJITCallDOMGetterSnippet.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1769 E355D38F22446877008F1AD6 /* GlobalExecutable.h in Headers */ = {isa = PBXBuildFile; fileRef = E355D38D2244686B008F1AD6 /* GlobalExecutable.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1769 1770 E35A0B9D220AD87A00AC4474 /* ExecutableBaseInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = E35A0B9C220AD87A00AC4474 /* ExecutableBaseInlines.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1770 1771 E35CA1541DBC3A5C00F83516 /* DOMJITHeapRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E35CA1521DBC3A5600F83516 /* DOMJITHeapRange.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 4717 4718 E354622A1B6065D100545386 /* ConstructAbility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstructAbility.h; sourceTree = "<group>"; }; 4718 4719 E3555B891DAE03A200F36921 /* DOMJITCallDOMGetterSnippet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITCallDOMGetterSnippet.h; sourceTree = "<group>"; }; 4720 E355D38D2244686B008F1AD6 /* GlobalExecutable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GlobalExecutable.h; sourceTree = "<group>"; }; 4721 E355D38E2244686C008F1AD6 /* GlobalExecutable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalExecutable.cpp; sourceTree = "<group>"; }; 4719 4722 E35A0B9C220AD87A00AC4474 /* ExecutableBaseInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableBaseInlines.h; sourceTree = "<group>"; }; 4720 4723 E35CA14F1DBC3A5600F83516 /* DOMJITAbstractHeap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMJITAbstractHeap.cpp; sourceTree = "<group>"; }; … … 6807 6810 BC02E9B80E184545000F9297 /* GetterSetter.cpp */, 6808 6811 BC337BDE0E1AF0B80076918A /* GetterSetter.h */, 6812 E355D38E2244686C008F1AD6 /* GlobalExecutable.cpp */, 6813 E355D38D2244686B008F1AD6 /* GlobalExecutable.h */, 6809 6814 79A0907D1D768465008B889B /* HashMapImpl.cpp */, 6810 6815 79A0907E1D768465008B889B /* HashMapImpl.h */, … … 9127 9132 0FEC3C5B1F33A48900F59B6C /* GigacageAlignedMemoryAllocator.h in Headers */, 9128 9133 14AD910E1DCA92940014F9FE /* GlobalCodeBlock.h in Headers */, 9134 E355D38F22446877008F1AD6 /* GlobalExecutable.h in Headers */, 9129 9135 0F24E54417EA9F5900ABB217 /* GPRInfo.h in Headers */, 9130 9136 142E3134134FF0A600AFADB5 /* Handle.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r243279 r243365 769 769 runtime/GetPutInfo.cpp 770 770 runtime/GetterSetter.cpp 771 runtime/GlobalExecutable.cpp 771 772 runtime/HashMapImpl.cpp 772 773 runtime/Identifier.cpp -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
r242605 r243365 159 159 { 160 160 SourceCode source = linkedSourceCode(passedParentSource); 161 unsigned firstLine = source.firstLine().oneBasedInt();162 unsigned lineCount = m_lineCount;163 unsigned endColumn = linkedEndColumn(source.startColumn().oneBasedInt());164 161 FunctionOverrides::OverrideInfo overrideInfo; 165 162 bool hasFunctionOverride = false; 166 if (UNLIKELY(Options::functionOverrides())) {163 if (UNLIKELY(Options::functionOverrides())) 167 164 hasFunctionOverride = FunctionOverrides::initializeOverrideFor(source, overrideInfo); 168 if (UNLIKELY(hasFunctionOverride)) { 169 firstLine = overrideInfo.firstLine; 170 lineCount = overrideInfo.lineCount; 171 endColumn = overrideInfo.endColumn; 172 source = overrideInfo.sourceCode; 173 } 174 } 175 176 FunctionExecutable* result = FunctionExecutable::create(vm, source, this, firstLine + lineCount, endColumn, intrinsic); 165 166 FunctionExecutable* result = FunctionExecutable::create(vm, source, this, intrinsic); 177 167 if (overrideLineNumber) 178 168 result->setOverrideLineNumber(*overrideLineNumber); 179 169 180 if (UNLIKELY(hasFunctionOverride)) { 181 result->overrideParameterAndTypeProfilingStartEndOffsets( 182 overrideInfo.parametersStartOffset, 183 overrideInfo.typeProfilingStartOffset, 184 overrideInfo.typeProfilingEndOffset); 185 } 170 if (UNLIKELY(hasFunctionOverride)) 171 result->overrideInfo(overrideInfo); 186 172 187 173 return result; -
trunk/Source/JavaScriptCore/runtime/EvalExecutable.cpp
r233085 r243365 32 32 namespace JSC { 33 33 34 const ClassInfo EvalExecutable::s_info = { "EvalExecutable", & ScriptExecutable::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(EvalExecutable) };34 const ClassInfo EvalExecutable::s_info = { "EvalExecutable", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(EvalExecutable) }; 35 35 36 36 EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType) 37 : ScriptExecutable(exec->vm().evalExecutableStructure.get(), exec->vm(), source, inStrictContext, derivedContextType, isArrowFunctionContext, evalContextType, NoIntrinsic)37 : Base(exec->vm().evalExecutableStructure.get(), exec->vm(), source, inStrictContext, derivedContextType, isArrowFunctionContext, evalContextType, NoIntrinsic) 38 38 { 39 39 ASSERT(source.provider()->sourceType() == SourceProviderSourceType::Program); -
trunk/Source/JavaScriptCore/runtime/EvalExecutable.h
r241038 r243365 27 27 28 28 #include "ExecutableToCodeBlockEdge.h" 29 #include " ScriptExecutable.h"29 #include "GlobalExecutable.h" 30 30 #include "UnlinkedEvalCodeBlock.h" 31 31 32 32 namespace JSC { 33 33 34 class EvalExecutable : public ScriptExecutable {34 class EvalExecutable : public GlobalExecutable { 35 35 friend class LLIntOffsetsExtractor; 36 36 public: 37 typedef ScriptExecutable Base;37 using Base = GlobalExecutable; 38 38 static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; 39 39 -
trunk/Source/JavaScriptCore/runtime/FunctionExecutable.cpp
r240938 r243365 30 30 #include "Debugger.h" 31 31 #include "FunctionCodeBlock.h" 32 #include "FunctionOverrides.h" 32 33 #include "JIT.h" 33 34 #include "JSCInlines.h" … … 42 43 const ClassInfo FunctionExecutable::s_info = { "FunctionExecutable", &ScriptExecutable::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(FunctionExecutable) }; 43 44 44 FunctionExecutable::FunctionExecutable(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, unsigned lastLine, unsigned endColumn, Intrinsic intrinsic) 45 static_assert(sizeof(FunctionExecutable) <= 128, "FunctionExecutable should fit in a 128-byte cell since it is so frequently allocated."); 46 47 FunctionExecutable::FunctionExecutable(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, Intrinsic intrinsic) 45 48 : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable->isInStrictContext(), unlinkedExecutable->derivedContextType(), false, EvalContextType::None, intrinsic) 46 49 , m_unlinkedExecutable(vm, this, unlinkedExecutable) … … 48 51 RELEASE_ASSERT(!source.isNull()); 49 52 ASSERT(source.length()); 50 m_lastLine = lastLine;51 ASSERT(endColumn != UINT_MAX);52 m_endColumn = endColumn;53 53 if (VM::canUseJIT()) 54 54 new (&m_singletonFunction) WriteBarrier<InferredValue>(); … … 112 112 { 113 113 ASSERT(!m_rareData); 114 m_rareData = std::make_unique<RareData>(); 115 m_rareData->m_parametersStartOffset = m_unlinkedExecutable->parametersStartOffset(); 116 m_rareData->m_typeProfilingStartOffset = m_unlinkedExecutable->typeProfilingStartOffset(); 117 m_rareData->m_typeProfilingEndOffset = m_unlinkedExecutable->typeProfilingEndOffset(); 114 auto rareData = std::make_unique<RareData>(); 115 rareData->m_lineCount = lineCount(); 116 rareData->m_endColumn = endColumn(); 117 rareData->m_parametersStartOffset = parametersStartOffset(); 118 rareData->m_typeProfilingStartOffset = typeProfilingStartOffset(); 119 rareData->m_typeProfilingEndOffset = typeProfilingEndOffset(); 120 m_rareData = WTFMove(rareData); 118 121 return *m_rareData; 119 122 } 120 123 124 void FunctionExecutable::overrideInfo(const FunctionOverrideInfo& overrideInfo) 125 { 126 auto& rareData = ensureRareData(); 127 m_source = overrideInfo.sourceCode; 128 rareData.m_lineCount = overrideInfo.lineCount; 129 rareData.m_endColumn = overrideInfo.endColumn; 130 rareData.m_parametersStartOffset = overrideInfo.parametersStartOffset; 131 rareData.m_typeProfilingStartOffset = overrideInfo.typeProfilingStartOffset; 132 rareData.m_typeProfilingEndOffset = overrideInfo.typeProfilingEndOffset; 133 } 134 121 135 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/FunctionExecutable.h
r241645 r243365 34 34 namespace JSC { 35 35 36 struct FunctionOverrideInfo; 37 36 38 class FunctionExecutable final : public ScriptExecutable { 37 39 friend class JIT; … … 47 49 } 48 50 49 static FunctionExecutable* create( 50 VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, 51 unsigned lastLine, unsigned endColumn, Intrinsic intrinsic) 52 { 53 FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(vm.heap)) FunctionExecutable(vm, source, unlinkedExecutable, lastLine, endColumn, intrinsic); 51 static FunctionExecutable* create(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, Intrinsic intrinsic) 52 { 53 FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(vm.heap)) FunctionExecutable(vm, source, unlinkedExecutable, intrinsic); 54 54 executable->finishCreation(vm); 55 55 return executable; … … 191 191 } 192 192 193 int lineCount() const 194 { 195 if (UNLIKELY(m_rareData)) 196 return m_rareData->m_lineCount; 197 return m_unlinkedExecutable->lineCount(); 198 } 199 200 int endColumn() const 201 { 202 if (UNLIKELY(m_rareData)) 203 return m_rareData->m_endColumn; 204 return m_unlinkedExecutable->linkedEndColumn(m_source.startColumn().oneBasedInt()); 205 } 206 207 int firstLine() const 208 { 209 return source().firstLine().oneBasedInt(); 210 } 211 212 int lastLine() const 213 { 214 return firstLine() + lineCount(); 215 } 216 193 217 unsigned typeProfilingStartOffset(VM&) const 218 { 219 return typeProfilingStartOffset(); 220 } 221 222 unsigned typeProfilingStartOffset() const 194 223 { 195 224 if (UNLIKELY(m_rareData)) … … 200 229 unsigned typeProfilingEndOffset(VM&) const 201 230 { 231 return typeProfilingEndOffset(); 232 } 233 234 unsigned typeProfilingEndOffset() const 235 { 202 236 if (UNLIKELY(m_rareData)) 203 237 return m_rareData->m_typeProfilingEndOffset; … … 212 246 } 213 247 214 void overrideParameterAndTypeProfilingStartEndOffsets(unsigned parametersStartOffset, unsigned typeProfilingStartOffset, unsigned typeProfilingEndOffset) 215 { 216 auto& rareData = ensureRareData(); 217 rareData.m_parametersStartOffset = parametersStartOffset; 218 rareData.m_typeProfilingStartOffset = typeProfilingStartOffset; 219 rareData.m_typeProfilingEndOffset = typeProfilingEndOffset; 220 } 248 void overrideInfo(const FunctionOverrideInfo&); 221 249 222 250 DECLARE_INFO; … … 269 297 private: 270 298 friend class ExecutableBase; 271 FunctionExecutable( 272 VM&, const SourceCode&, UnlinkedFunctionExecutable*, 273 unsigned lastLine, unsigned endColumn, Intrinsic); 299 FunctionExecutable(VM&, const SourceCode&, UnlinkedFunctionExecutable*, Intrinsic); 274 300 275 301 void finishCreation(VM&); … … 279 305 struct RareData { 280 306 WTF_MAKE_STRUCT_FAST_ALLOCATED; 307 RefPtr<TypeSet> m_returnStatementTypeSet; 308 unsigned m_lineCount; 309 unsigned m_endColumn; 281 310 Markable<int, IntegralMarkableTraits<int, -1>> m_overrideLineNumber; 282 311 unsigned m_parametersStartOffset { 0 }; 283 312 unsigned m_typeProfilingStartOffset { UINT_MAX }; 284 313 unsigned m_typeProfilingEndOffset { UINT_MAX }; 285 RefPtr<TypeSet> m_returnStatementTypeSet;286 314 }; 287 315 -
trunk/Source/JavaScriptCore/runtime/GlobalExecutable.cpp
r243364 r243365 1 1 /* 2 * Copyright (C) 201 5-2016Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 #pragma once 27 28 #include "SourceCode.h" 29 #include <wtf/HashMap.h> 30 #include <wtf/text/WTFString.h> 26 #include "config.h" 27 #include "GlobalExecutable.h" 31 28 32 29 namespace JSC { 33 30 34 class ScriptExecutable; 35 36 class FunctionOverrides { 37 public: 38 struct OverrideInfo { 39 SourceCode sourceCode; 40 unsigned firstLine; 41 unsigned lineCount; 42 unsigned startColumn; 43 unsigned endColumn; 44 unsigned parametersStartOffset; 45 unsigned typeProfilingStartOffset; 46 unsigned typeProfilingEndOffset; 47 }; 48 49 static FunctionOverrides& overrides(); 50 FunctionOverrides(const char* functionOverridesFileName); 51 52 static bool initializeOverrideFor(const SourceCode& origCode, OverrideInfo& result); 53 54 JS_EXPORT_PRIVATE static void reinstallOverrides(); 55 56 private: 57 void parseOverridesInFile(const char* fileName); 58 void clear() { m_entries.clear(); } 59 60 HashMap<String, String> m_entries; 61 }; 31 const ClassInfo GlobalExecutable::s_info = { "GlobalExecutable", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(GlobalExecutable) }; 62 32 63 33 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/GlobalExecutable.h
r243364 r243365 1 1 /* 2 * Copyright (C) 201 5-2016Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "SourceCode.h" 29 #include <wtf/HashMap.h> 30 #include <wtf/text/WTFString.h> 28 #include "ExecutableToCodeBlockEdge.h" 29 #include "ScriptExecutable.h" 31 30 32 31 namespace JSC { 33 32 34 class ScriptExecutable; 33 class GlobalExecutable : public ScriptExecutable { 34 public: 35 using Base = ScriptExecutable; 36 static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; 35 37 36 class FunctionOverrides { 37 public: 38 struct OverrideInfo { 39 SourceCode sourceCode; 40 unsigned firstLine; 41 unsigned lineCount; 42 unsigned startColumn; 43 unsigned endColumn; 44 unsigned parametersStartOffset; 45 unsigned typeProfilingStartOffset; 46 unsigned typeProfilingEndOffset; 47 }; 38 DECLARE_INFO; 48 39 49 static FunctionOverrides& overrides();50 FunctionOverrides(const char* functionOverridesFileName);40 unsigned lastLine() const { return m_lastLine; } 41 unsigned endColumn() const { return m_endColumn; } 51 42 52 static bool initializeOverrideFor(const SourceCode& origCode, OverrideInfo& result); 43 void recordParse(CodeFeatures features, bool hasCapturedVariables, int lastLine, unsigned endColumn) 44 { 45 Base::recordParse(features, hasCapturedVariables); 46 m_lastLine = lastLine; 47 m_endColumn = endColumn; 48 ASSERT(endColumn != UINT_MAX); 49 } 53 50 54 JS_EXPORT_PRIVATE static void reinstallOverrides(); 51 protected: 52 GlobalExecutable(Structure* structure, VM& vm, const SourceCode& sourceCode, bool isInStrictContext, DerivedContextType derivedContextType, bool isInArrowFunctionContext, EvalContextType evalContextType, Intrinsic intrinsic) 53 : Base(structure, vm, sourceCode, isInStrictContext, derivedContextType, isInArrowFunctionContext, evalContextType, intrinsic) 54 { 55 } 55 56 56 private: 57 void parseOverridesInFile(const char* fileName); 58 void clear() { m_entries.clear(); } 59 60 HashMap<String, String> m_entries; 57 int m_lastLine { -1 }; 58 unsigned m_endColumn { UINT_MAX }; 61 59 }; 62 60 -
trunk/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
r240938 r243365 41 41 namespace JSC { 42 42 43 const ClassInfo ModuleProgramExecutable::s_info = { "ModuleProgramExecutable", & ScriptExecutable::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ModuleProgramExecutable) };43 const ClassInfo ModuleProgramExecutable::s_info = { "ModuleProgramExecutable", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ModuleProgramExecutable) }; 44 44 45 45 ModuleProgramExecutable::ModuleProgramExecutable(ExecState* exec, const SourceCode& source) 46 : ScriptExecutable(exec->vm().moduleProgramExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false, EvalContextType::None, NoIntrinsic)46 : Base(exec->vm().moduleProgramExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false, EvalContextType::None, NoIntrinsic) 47 47 { 48 48 ASSERT(source.provider()->sourceType() == SourceProviderSourceType::Module); -
trunk/Source/JavaScriptCore/runtime/ModuleProgramExecutable.h
r240965 r243365 27 27 28 28 #include "ExecutableToCodeBlockEdge.h" 29 #include " ScriptExecutable.h"29 #include "GlobalExecutable.h" 30 30 31 31 namespace JSC { 32 32 33 class ModuleProgramExecutable final : public ScriptExecutable {33 class ModuleProgramExecutable final : public GlobalExecutable { 34 34 friend class LLIntOffsetsExtractor; 35 35 public: 36 typedef ScriptExecutable Base;36 using Base = GlobalExecutable; 37 37 static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; 38 38 -
trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp
r242596 r243365 42 42 namespace JSC { 43 43 44 const ClassInfo ProgramExecutable::s_info = { "ProgramExecutable", & ScriptExecutable::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ProgramExecutable) };44 const ClassInfo ProgramExecutable::s_info = { "ProgramExecutable", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ProgramExecutable) }; 45 45 46 46 ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source) 47 : ScriptExecutable(exec->vm().programExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false, EvalContextType::None, NoIntrinsic)47 : Base(exec->vm().programExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false, EvalContextType::None, NoIntrinsic) 48 48 { 49 49 ASSERT(source.provider()->sourceType() == SourceProviderSourceType::Program); -
trunk/Source/JavaScriptCore/runtime/ProgramExecutable.h
r240965 r243365 27 27 28 28 #include "ExecutableToCodeBlockEdge.h" 29 #include " ScriptExecutable.h"29 #include "GlobalExecutable.h" 30 30 31 31 namespace JSC { 32 32 33 class ProgramExecutable final : public ScriptExecutable {33 class ProgramExecutable final : public GlobalExecutable { 34 34 friend class LLIntOffsetsExtractor; 35 35 public: 36 typedef ScriptExecutable Base;36 using Base = GlobalExecutable; 37 37 static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; 38 38 -
trunk/Source/JavaScriptCore/runtime/ScriptExecutable.cpp
r243136 r243365 31 31 #include "EvalCodeBlock.h" 32 32 #include "FunctionCodeBlock.h" 33 #include "GlobalExecutable.h" 33 34 #include "IsoCellSetInlines.h" 34 35 #include "JIT.h" … … 69 70 void ScriptExecutable::clearCode(IsoCellSet& clearableCodeSet) 70 71 { 71 #if ENABLE(JIT)72 72 m_jitCodeForCall = nullptr; 73 73 m_jitCodeForConstruct = nullptr; 74 74 m_jitCodeForCallWithArityCheck = MacroAssemblerCodePtr<JSEntryPtrTag>(); 75 75 m_jitCodeForConstructWithArityCheck = MacroAssemblerCodePtr<JSEntryPtrTag>(); 76 #endif77 m_numParametersForCall = NUM_PARAMETERS_NOT_COMPILED;78 m_numParametersForConstruct = NUM_PARAMETERS_NOT_COMPILED;79 76 80 77 switch (type()) { … … 181 178 m_jitCodeForCall = genericCodeBlock ? genericCodeBlock->jitCode() : nullptr; 182 179 m_jitCodeForCallWithArityCheck = nullptr; 183 m_numParametersForCall = genericCodeBlock ? genericCodeBlock->numParameters() : NUM_PARAMETERS_NOT_COMPILED;184 180 break; 185 181 case CodeForConstruct: 186 182 m_jitCodeForConstruct = genericCodeBlock ? genericCodeBlock->jitCode() : nullptr; 187 183 m_jitCodeForConstructWithArityCheck = nullptr; 188 m_numParametersForConstruct = genericCodeBlock ? genericCodeBlock->numParameters() : NUM_PARAMETERS_NOT_COMPILED;189 184 break; 190 185 } … … 219 214 bool ScriptExecutable::hasClearableCode(VM& vm) const 220 215 { 221 #if ENABLE(JIT)222 216 if (m_jitCodeForCall 223 217 || m_jitCodeForConstruct … … 225 219 || m_jitCodeForConstructWithArityCheck) 226 220 return true; 227 #endif228 221 229 222 if (structure(vm)->classInfo() == FunctionExecutable::info()) { … … 323 316 UnlinkedFunctionCodeBlock* unlinkedCodeBlock = 324 317 executable->m_unlinkedExecutable->unlinkedCodeBlockFor( 325 *vm, executable-> m_source, kind, debuggerMode, error,318 *vm, executable->source(), kind, debuggerMode, error, 326 319 executable->parseMode()); 327 320 recordParse( … … 332 325 exception = throwException( 333 326 globalObject->globalExec(), throwScope, 334 error.toErrorObject(globalObject, executable-> m_source));327 error.toErrorObject(globalObject, executable->source())); 335 328 return nullptr; 336 329 } … … 460 453 if (inherits<EvalExecutable>(vm)) 461 454 return UINT_MAX; 462 return m_source.length() - 1; 455 return source().length() - 1; 456 } 457 458 void ScriptExecutable::recordParse(CodeFeatures features, bool hasCapturedVariables, int lastLine, unsigned endColumn) 459 { 460 switch (type()) { 461 case FunctionExecutableType: 462 // Since UnlinkedFunctionExecutable holds the information to calculate lastLine and endColumn, we do not need to remember them in ScriptExecutable's fields. 463 jsCast<FunctionExecutable*>(this)->recordParse(features, hasCapturedVariables); 464 return; 465 default: 466 jsCast<GlobalExecutable*>(this)->recordParse(features, hasCapturedVariables, lastLine, endColumn); 467 return; 468 } 469 } 470 471 int ScriptExecutable::lastLine() const 472 { 473 switch (type()) { 474 case FunctionExecutableType: 475 return jsCast<const FunctionExecutable*>(this)->lastLine(); 476 default: 477 return jsCast<const GlobalExecutable*>(this)->lastLine(); 478 } 479 return 0; 480 } 481 482 unsigned ScriptExecutable::endColumn() const 483 { 484 switch (type()) { 485 case FunctionExecutableType: 486 return jsCast<const FunctionExecutable*>(this)->endColumn(); 487 default: 488 return jsCast<const GlobalExecutable*>(this)->endColumn(); 489 } 490 return 0; 463 491 } 464 492 -
trunk/Source/JavaScriptCore/runtime/ScriptExecutable.h
r242596 r243365 46 46 const String& sourceURL() const { return m_source.provider()->url(); } 47 47 int firstLine() const { return m_source.firstLine().oneBasedInt(); } 48 int lastLine() const { return m_lastLine; }48 JS_EXPORT_PRIVATE int lastLine() const; 49 49 unsigned startColumn() const { return m_source.startColumn().oneBasedInt(); } 50 unsigned endColumn() const { return m_endColumn; }50 JS_EXPORT_PRIVATE unsigned endColumn() const; 51 51 52 52 Optional<int> overrideLineNumber(VM&) const; … … 82 82 DECLARE_EXPORT_INFO; 83 83 84 void recordParse(CodeFeatures features, bool hasCapturedVariables, int lastLine, unsigned endColumn) 85 { 86 m_features = features; 87 m_hasCapturedVariables = hasCapturedVariables; 88 m_lastLine = lastLine; 89 ASSERT(endColumn != UINT_MAX); 90 m_endColumn = endColumn; 91 } 92 84 void recordParse(CodeFeatures, bool hasCapturedVariables, int lastLine, unsigned endColumn); 93 85 void installCode(CodeBlock*); 94 86 void installCode(VM&, CodeBlock*, CodeType, CodeSpecializationKind); … … 103 95 } 104 96 105 static constexpr int NUM_PARAMETERS_NOT_COMPILED = -1;106 107 97 bool hasJITCodeForCall() const 108 98 { 109 return m_ numParametersForCall >= 0;99 return m_jitCodeForCall; 110 100 } 111 101 bool hasJITCodeForConstruct() const 112 102 { 113 return m_ numParametersForConstruct >= 0;103 return m_jitCodeForConstruct; 114 104 } 115 105 … … 142 132 } 143 133 134 void recordParse(CodeFeatures features, bool hasCapturedVariables) 135 { 136 m_features = features; 137 m_hasCapturedVariables = hasCapturedVariables; 138 } 139 144 140 SourceCode m_source; 145 146 int m_numParametersForCall { NUM_PARAMETERS_NOT_COMPILED };147 int m_numParametersForConstruct { NUM_PARAMETERS_NOT_COMPILED };148 149 int m_lastLine { -1 };150 unsigned m_endColumn { UINT_MAX };151 152 141 Intrinsic m_intrinsic { NoIntrinsic }; 153 142 bool m_didTryToEnterInLoop { false }; -
trunk/Source/JavaScriptCore/tools/FunctionOverrides.h
r218794 r243365 34 34 class ScriptExecutable; 35 35 36 struct FunctionOverrideInfo { 37 SourceCode sourceCode; 38 unsigned firstLine; 39 unsigned lineCount; 40 unsigned startColumn; 41 unsigned endColumn; 42 unsigned parametersStartOffset; 43 unsigned typeProfilingStartOffset; 44 unsigned typeProfilingEndOffset; 45 }; 46 36 47 class FunctionOverrides { 37 48 public: 38 struct OverrideInfo { 39 SourceCode sourceCode; 40 unsigned firstLine; 41 unsigned lineCount; 42 unsigned startColumn; 43 unsigned endColumn; 44 unsigned parametersStartOffset; 45 unsigned typeProfilingStartOffset; 46 unsigned typeProfilingEndOffset; 47 }; 49 using OverrideInfo = FunctionOverrideInfo; 48 50 49 51 static FunctionOverrides& overrides();
Note:
See TracChangeset
for help on using the changeset viewer.