Changeset 231889 in webkit for trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
- Timestamp:
- May 16, 2018, 10:21:41 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
r231477 r231889 1 1 /* 2 * Copyright (C) 2012-201 3, 2015-2016Apple Inc. All Rights Reserved.2 * Copyright (C) 2012-2018 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #include "UnlinkedFunctionExecutable.h" 28 28 29 #include "BuiltinExecutables.h" 29 30 #include "BytecodeGenerator.h" 30 31 #include "ClassInfo.h" … … 41 42 namespace JSC { 42 43 43 static_assert(sizeof(UnlinkedFunctionExecutable) <= 256, "UnlinkedFunctionExecutable should fit in a 256-byte cell.");44 static_assert(sizeof(UnlinkedFunctionExecutable) <= 160, "UnlinkedFunctionExecutable should fit in a 160-byte cell. If you increase the size of this class, consider making a size class that perfectly fits it."); 44 45 45 46 const ClassInfo UnlinkedFunctionExecutable::s_info = { "UnlinkedFunctionExecutable", nullptr, nullptr, nullptr, CREATE_METHOD_TABLE(UnlinkedFunctionExecutable) }; … … 77 78 } 78 79 79 UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& parentSource, SourceCode&& parentSourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, JSParserScriptMode scriptMode, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType)80 UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& parentSource, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, JSParserScriptMode scriptMode, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType, bool isBuiltinDefaultClassConstructor) 80 81 : Base(*vm, structure) 81 82 , m_firstLineOffset(node->firstLine() - parentSource.firstLine().oneBasedInt()) … … 95 96 , m_hasCapturedVariables(false) 96 97 , m_isBuiltinFunction(kind == UnlinkedBuiltinFunction) 98 , m_isBuiltinDefaultClassConstructor(isBuiltinDefaultClassConstructor) 97 99 , m_constructAbility(static_cast<unsigned>(constructAbility)) 98 100 , m_constructorKind(static_cast<unsigned>(node->constructorKind())) … … 104 106 , m_ecmaName(node->ecmaName()) 105 107 , m_inferredName(node->inferredName()) 106 , m_parentSourceOverride(WTFMove(parentSourceOverride))107 108 , m_classSource(node->classSource()) 108 109 , m_parentScopeTDZVariables(vm->m_compactVariableMap->get(parentScopeTDZVariables)) … … 115 116 ASSERT(m_superBinding == static_cast<unsigned>(node->superBinding())); 116 117 ASSERT(m_derivedContextType == static_cast<unsigned>(derivedContextType)); 118 ASSERT(!(m_isBuiltinDefaultClassConstructor && constructorKind() == ConstructorKind::None)); 117 119 } 118 120 … … 133 135 FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& passedParentSource, std::optional<int> overrideLineNumber, Intrinsic intrinsic) 134 136 { 135 const SourceCode& parentSource = m_parentSourceOverride.isNull() ? passedParentSource : m_parentSourceOverride;137 const SourceCode& parentSource = !m_isBuiltinDefaultClassConstructor ? passedParentSource : BuiltinExecutables::defaultConstructorSourceCode(constructorKind()); 136 138 unsigned firstLine = parentSource.firstLine().oneBasedInt() + m_firstLineOffset; 137 139 unsigned startOffset = parentSource.startOffset() + m_startOffset;
Note:
See TracChangeset
for help on using the changeset viewer.