Changeset 221327 in webkit for trunk/Source/JavaScriptCore/Scripts
- Timestamp:
- Aug 29, 2017, 5:06:43 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore/Scripts
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_header.py
r206533 r221327 124 124 function_args = { 125 125 'funcName': function.function_name, 126 'overriddenName': function.overridden_name, 126 127 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code', 127 128 } 128 129 129 lines.append(" macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)130 lines.append(" macro(%(codeName)s, %(funcName)s, %(overriddenName)s, s_%(codeName)sLength) \\" % function_args) 130 131 return '\n'.join(lines) 131 132 -
trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_combined_implementation.py
r208063 r221327 91 91 ), 92 92 (["JavaScriptCore", "WebCore"], 93 ("JavaScriptCore", "runtime/IdentifierInlines.h"), 94 ), 95 (["JavaScriptCore", "WebCore"], 93 96 ("JavaScriptCore", "runtime/Intrinsic.h"), 94 97 ), -
trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_header.py
r206533 r221327 173 173 function_args = { 174 174 'funcName': function.function_name, 175 'overriddenName': function.overridden_name, 175 176 'codeName': BuiltinsGenerator.mangledNameForFunction(function) + 'Code', 176 177 } 177 178 178 lines.append(" macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)179 lines.append(" macro(%(codeName)s, %(funcName)s, %(overriddenName)s, s_%(codeName)sLength) \\" % function_args) 179 180 return '\n'.join(lines) 180 181 -
trunk/Source/JavaScriptCore/Scripts/builtins/builtins_generate_separate_implementation.py
r208063 r221327 103 103 ), 104 104 (["JavaScriptCore", "WebCore"], 105 ("JavaScriptCore", "runtime/IdentifierInlines.h"), 106 ), 107 (["JavaScriptCore", "WebCore"], 105 108 ("JavaScriptCore", "runtime/Intrinsic.h"), 106 109 ), -
trunk/Source/JavaScriptCore/Scripts/builtins/builtins_model.py
r202986 r221327 43 43 } 44 44 45 functionHeadRegExp = re.compile(r"(?:@[\w|= ]+\s*\n)*function\s+\w+\s*\(.*?\)", re.MULTILINE | re.DOTALL)45 functionHeadRegExp = re.compile(r"(?:@[\w|=\[\] \"\.]+\s*\n)*function\s+\w+\s*\(.*?\)", re.MULTILINE | re.DOTALL) 46 46 functionGlobalPrivateRegExp = re.compile(r".*^@globalPrivate", re.MULTILINE | re.DOTALL) 47 47 functionIntrinsicRegExp = re.compile(r".*^@intrinsic=(\w+)", re.MULTILINE | re.DOTALL) 48 48 functionIsConstructorRegExp = re.compile(r".*^@constructor", re.MULTILINE | re.DOTALL) 49 functionIsGetterRegExp = re.compile(r".*^@getter", re.MULTILINE | re.DOTALL) 49 50 functionNameRegExp = re.compile(r"function\s+(\w+)\s*\(", re.MULTILINE | re.DOTALL) 51 functionOverriddenNameRegExp = re.compile(r".*^@overriddenName=(\".+\")$", re.MULTILINE | re.DOTALL) 50 52 functionParameterFinder = re.compile(r"^function\s+(?:\w+)\s*\(((?:\s*\w+)?\s*(?:\s*,\s*\w+)*)?\s*\)", re.MULTILINE | re.DOTALL) 51 53 … … 98 100 99 101 class BuiltinFunction: 100 def __init__(self, function_name, function_source, parameters, is_constructor, is_global_private, intrinsic ):102 def __init__(self, function_name, function_source, parameters, is_constructor, is_global_private, intrinsic, overridden_name): 101 103 self.function_name = function_name 102 104 self.function_source = function_source … … 105 107 self.is_global_private = is_global_private 106 108 self.intrinsic = intrinsic 109 self.overridden_name = overridden_name 107 110 self.object = None # Set by the owning BuiltinObject 108 111 … … 117 120 function_source = functionIntrinsicRegExp.sub("", function_source) 118 121 122 overridden_name = None 123 overriddenNameMatch = functionOverriddenNameRegExp.search(function_source) 124 if overriddenNameMatch: 125 overridden_name = overriddenNameMatch.group(1) 126 function_source = functionOverriddenNameRegExp.sub("", function_source) 127 119 128 if os.getenv("CONFIGURATION", "Debug").startswith("Debug"): 120 129 function_source = lineWithOnlySingleLineCommentRegExp.sub("", function_source) … … 124 133 function_name = functionNameRegExp.findall(function_source)[0] 125 134 is_constructor = functionIsConstructorRegExp.match(function_source) != None 135 is_getter = functionIsGetterRegExp.match(function_source) != None 126 136 is_global_private = functionGlobalPrivateRegExp.match(function_source) != None 127 137 parameters = [s.strip() for s in functionParameterFinder.findall(function_source)[0].split(',')] … … 129 139 parameters = [] 130 140 131 return BuiltinFunction(function_name, function_source, parameters, is_constructor, is_global_private, intrinsic) 141 if is_getter and not overridden_name: 142 overridden_name = "\"get %s\"" % (function_name) 143 144 if not overridden_name: 145 overridden_name = "static_cast<const char*>(nullptr)" 146 147 return BuiltinFunction(function_name, function_source, parameters, is_constructor, is_global_private, intrinsic, overridden_name) 132 148 133 149 def __str__(self): -
trunk/Source/JavaScriptCore/Scripts/builtins/builtins_templates.py
r210149 r221327 68 68 69 69 CombinedHeaderStaticMacros = ( 70 """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\70 """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ 71 71 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 72 72 … … 75 75 76 76 SeparateHeaderStaticMacros = ( 77 """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\77 """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ 78 78 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 79 79 … … 83 83 CombinedJSCImplementationStaticMacros = ( 84 84 """ 85 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\85 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ 86 86 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ 87 87 {\\ … … 94 94 SeparateJSCImplementationStaticMacros = ( 95 95 """ 96 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\96 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ 97 97 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ 98 98 {\\ … … 105 105 CombinedWebCoreImplementationStaticMacros = ( 106 106 """ 107 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\107 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ 108 108 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ 109 109 {\\ … … 117 117 SeparateWebCoreImplementationStaticMacros = ( 118 118 """ 119 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\119 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \\ 120 120 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\ 121 121 {\\ … … 133 133 : m_vm(*vm) 134 134 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 135 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))135 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 136 136 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 137 137 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 139 139 } 140 140 141 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \\141 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \\ 142 142 JSC::UnlinkedFunctionExecutable* name##Executable(); \\ 143 143 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 154 154 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 155 155 156 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \\156 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \\ 157 157 JSC::SourceCode m_##name##Source;\\ 158 158 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 162 162 }; 163 163 164 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \\164 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \\ 165 165 inline JSC::UnlinkedFunctionExecutable* ${objectName}BuiltinsWrapper::name##Executable() \\ 166 166 {\\ 167 if (!m_##name##Executable)\\ 168 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\\ 167 if (!m_##name##Executable) {\\ 168 JSC::Identifier executableName = functionName##PublicName();\\ 169 if (overriddenName)\\ 170 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\\ 171 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\\ 172 }\\ 169 173 return m_##name##Executable.get();\\ 170 174 } … … 198 202 inline void ${objectName}BuiltinFunctions::init(JSC::JSGlobalObject& globalObject) 199 203 { 200 #define EXPORT_FUNCTION(codeName, functionName, length)\\201 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create BuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));204 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\\ 205 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); 202 206 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(EXPORT_FUNCTION) 203 207 #undef EXPORT_FUNCTION -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Combined.js
r191433 r221327 77 77 } 78 78 } 79 80 @overriddenName="[Symbol.match]" 81 function match(strArg) 82 { 83 "use strict"; 84 85 if (!@isObject(this)) 86 @throwTypeError("RegExp.prototype.@@match requires that |this| be an Object"); 87 88 let regexp = this; 89 90 // Check for observable side effects and call the fast path if there aren't any. 91 if (!@hasObservableSideEffectsForRegExpMatch(regexp)) 92 return @regExpMatchFast.@call(regexp, strArg); 93 94 let str = @toString(strArg); 95 96 if (!regexp.global) 97 return @regExpExec(regexp, str); 98 99 let unicode = regexp.unicode; 100 regexp.lastIndex = 0; 101 let resultList = []; 102 103 // FIXME: It would be great to implement a solution similar to what we do in 104 // RegExpObject::matchGlobal(). It's not clear if this is possible, since this loop has 105 // effects. https://bugs.webkit.org/show_bug.cgi?id=158145 106 const maximumReasonableMatchSize = 100000000; 107 108 while (true) { 109 let result = @regExpExec(regexp, str); 110 111 if (result === null) { 112 if (resultList.length === 0) 113 return null; 114 return resultList; 115 } 116 117 if (resultList.length > maximumReasonableMatchSize) 118 @throwOutOfMemoryError(); 119 120 if (!@isObject(result)) 121 @throwTypeError("RegExp.prototype.@@match call to RegExp.exec didn't return null or an object"); 122 123 let resultString = @toString(result[0]); 124 125 if (!resultString.length) 126 regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode); 127 128 resultList.@push(resultString); 129 } 130 } 131 132 @intrinsic=RegExpTestIntrinsic 133 function test(strArg) 134 { 135 "use strict"; 136 137 let regexp = this; 138 139 // Check for observable side effects and call the fast path if there aren't any. 140 if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec) 141 return @regExpTestFast.@call(regexp, strArg); 142 143 // 1. Let R be the this value. 144 // 2. If Type(R) is not Object, throw a TypeError exception. 145 if (!@isObject(regexp)) 146 @throwTypeError("RegExp.prototype.test requires that |this| be an Object"); 147 148 // 3. Let string be ? ToString(S). 149 let str = @toString(strArg); 150 151 // 4. Let match be ? RegExpExec(R, string). 152 let match = @regExpExec(regexp, str); 153 154 // 5. If match is not null, return true; else return false. 155 if (match !== null) 156 return true; 157 return false; 158 } -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/JavaScriptCore-Builtin.prototype-Separate.js
r191433 r221327 77 77 } 78 78 } 79 80 @overriddenName="[Symbol.match]" 81 function match(strArg) 82 { 83 "use strict"; 84 85 if (!@isObject(this)) 86 @throwTypeError("RegExp.prototype.@@match requires that |this| be an Object"); 87 88 let regexp = this; 89 90 // Check for observable side effects and call the fast path if there aren't any. 91 if (!@hasObservableSideEffectsForRegExpMatch(regexp)) 92 return @regExpMatchFast.@call(regexp, strArg); 93 94 let str = @toString(strArg); 95 96 if (!regexp.global) 97 return @regExpExec(regexp, str); 98 99 let unicode = regexp.unicode; 100 regexp.lastIndex = 0; 101 let resultList = []; 102 103 // FIXME: It would be great to implement a solution similar to what we do in 104 // RegExpObject::matchGlobal(). It's not clear if this is possible, since this loop has 105 // effects. https://bugs.webkit.org/show_bug.cgi?id=158145 106 const maximumReasonableMatchSize = 100000000; 107 108 while (true) { 109 let result = @regExpExec(regexp, str); 110 111 if (result === null) { 112 if (resultList.length === 0) 113 return null; 114 return resultList; 115 } 116 117 if (resultList.length > maximumReasonableMatchSize) 118 @throwOutOfMemoryError(); 119 120 if (!@isObject(result)) 121 @throwTypeError("RegExp.prototype.@@match call to RegExp.exec didn't return null or an object"); 122 123 let resultString = @toString(result[0]); 124 125 if (!resultString.length) 126 regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode); 127 128 resultList.@push(resultString); 129 } 130 } 131 132 @intrinsic=RegExpTestIntrinsic 133 function test(strArg) 134 { 135 "use strict"; 136 137 let regexp = this; 138 139 // Check for observable side effects and call the fast path if there aren't any. 140 if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec) 141 return @regExpTestFast.@call(regexp, strArg); 142 143 // 1. Let R be the this value. 144 // 2. If Type(R) is not Object, throw a TypeError exception. 145 if (!@isObject(regexp)) 146 @throwTypeError("RegExp.prototype.test requires that |this| be an Object"); 147 148 // 3. Let string be ? ToString(S). 149 let str = @toString(strArg); 150 151 // 4. Let match be ? RegExpExec(R, string). 152 let match = @regExpExec(regexp, str); 153 154 // 5. If match is not null, return true; else return false. 155 if (match !== null) 156 return true; 157 return false; 158 } -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result
r208985 r221327 54 54 55 55 #define JSC_FOREACH_BUILTIN_CODE(macro) \ 56 macro(builtinPromiseRejectPromiseCode, rejectPromise, s _builtinPromiseRejectPromiseCodeLength) \57 macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s _builtinPromiseFulfillPromiseCodeLength) \56 macro(builtinPromiseRejectPromiseCode, rejectPromise, static_cast<const char*>(nullptr), s_builtinPromiseRejectPromiseCodeLength) \ 57 macro(builtinPromiseFulfillPromiseCode, fulfillPromise, static_cast<const char*>(nullptr), s_builtinPromiseFulfillPromiseCodeLength) \ 58 58 59 59 #define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ … … 63 63 #define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ 64 64 65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 66 66 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 67 67 … … 108 108 #include "BuiltinExecutables.h" 109 109 #include "HeapInlines.h" 110 #include "IdentifierInlines.h" 110 111 #include "Intrinsic.h" 111 112 #include "JSCellInlines.h" … … 150 151 151 152 152 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \153 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 153 154 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 154 155 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Separate.js-result
r208985 r221327 56 56 57 57 #define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(macro) \ 58 macro(builtinPromiseRejectPromiseCode, rejectPromise, s _builtinPromiseRejectPromiseCodeLength) \59 macro(builtinPromiseFulfillPromiseCode, fulfillPromise, s _builtinPromiseFulfillPromiseCodeLength) \58 macro(builtinPromiseRejectPromiseCode, rejectPromise, static_cast<const char*>(nullptr), s_builtinPromiseRejectPromiseCodeLength) \ 59 macro(builtinPromiseFulfillPromiseCode, fulfillPromise, static_cast<const char*>(nullptr), s_builtinPromiseFulfillPromiseCodeLength) \ 60 60 61 61 #define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_FUNCTION_NAME(macro) \ … … 63 63 macro(rejectPromise) \ 64 64 65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 66 66 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 67 67 … … 108 108 #include "BuiltinExecutables.h" 109 109 #include "HeapInlines.h" 110 #include "IdentifierInlines.h" 110 111 #include "Intrinsic.h" 111 112 #include "JSCellInlines.h" … … 149 150 150 151 151 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \152 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 152 153 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 153 154 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result
r208985 r221327 48 48 extern const int s_builtinPrototypeForEachCodeLength; 49 49 extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility; 50 extern const char* s_builtinPrototypeMatchCode; 51 extern const int s_builtinPrototypeMatchCodeLength; 52 extern const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility; 53 extern const char* s_builtinPrototypeTestCode; 54 extern const int s_builtinPrototypeTestCodeLength; 55 extern const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility; 50 56 51 57 #define JSC_FOREACH_BUILTINPROTOTYPE_BUILTIN_DATA(macro) \ 52 58 macro(every, builtinPrototypeEvery, 1) \ 53 59 macro(forEach, builtinPrototypeForEach, 1) \ 60 macro(match, builtinPrototypeMatch, 1) \ 61 macro(test, builtinPrototypeTest, 1) \ 54 62 55 63 #define JSC_FOREACH_BUILTIN_CODE(macro) \ 56 macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \ 57 macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \ 64 macro(builtinPrototypeEveryCode, every, static_cast<const char*>(nullptr), s_builtinPrototypeEveryCodeLength) \ 65 macro(builtinPrototypeForEachCode, forEach, static_cast<const char*>(nullptr), s_builtinPrototypeForEachCodeLength) \ 66 macro(builtinPrototypeMatchCode, match, "[Symbol.match]", s_builtinPrototypeMatchCodeLength) \ 67 macro(builtinPrototypeTestCode, test, static_cast<const char*>(nullptr), s_builtinPrototypeTestCodeLength) \ 58 68 59 69 #define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ 60 70 macro(every) \ 61 71 macro(forEach) \ 72 macro(match) \ 73 macro(test) \ 62 74 63 75 #define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ 64 76 65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \77 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 66 78 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 67 79 … … 108 120 #include "BuiltinExecutables.h" 109 121 #include "HeapInlines.h" 122 #include "IdentifierInlines.h" 110 123 #include "Intrinsic.h" 111 124 #include "JSCellInlines.h" … … 173 186 ; 174 187 175 176 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ 188 const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; 189 const int s_builtinPrototypeMatchCodeLength = 1198; 190 static const JSC::Intrinsic s_builtinPrototypeMatchCodeIntrinsic = JSC::NoIntrinsic; 191 const char* s_builtinPrototypeMatchCode = 192 "(function (strArg)\n" \ 193 "{\n" \ 194 " \"use strict\";\n" \ 195 " if (!@isObject(this))\n" \ 196 " @throwTypeError(\"RegExp.prototype.@@match requires that |this| be an Object\");\n" \ 197 " let regexp = this;\n" \ 198 " if (!@hasObservableSideEffectsForRegExpMatch(regexp))\n" \ 199 " return @regExpMatchFast.@call(regexp, strArg);\n" \ 200 " let str = @toString(strArg);\n" \ 201 " if (!regexp.global)\n" \ 202 " return @regExpExec(regexp, str);\n" \ 203 " \n" \ 204 " let unicode = regexp.unicode;\n" \ 205 " regexp.lastIndex = 0;\n" \ 206 " let resultList = [];\n" \ 207 " const maximumReasonableMatchSize = 100000000;\n" \ 208 " while (true) {\n" \ 209 " let result = @regExpExec(regexp, str);\n" \ 210 " \n" \ 211 " if (result === null) {\n" \ 212 " if (resultList.length === 0)\n" \ 213 " return null;\n" \ 214 " return resultList;\n" \ 215 " }\n" \ 216 " if (resultList.length > maximumReasonableMatchSize)\n" \ 217 " @throwOutOfMemoryError();\n" \ 218 " if (!@isObject(result))\n" \ 219 " @throwTypeError(\"RegExp.prototype.@@match call to RegExp.exec didn't return null or an object\");\n" \ 220 " let resultString = @toString(result[0]);\n" \ 221 " if (!resultString.length)\n" \ 222 " regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);\n" \ 223 " resultList.@push(resultString);\n" \ 224 " }\n" \ 225 "})\n" \ 226 ; 227 228 const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; 229 const int s_builtinPrototypeTestCodeLength = 456; 230 static const JSC::Intrinsic s_builtinPrototypeTestCodeIntrinsic = JSC::RegExpTestIntrinsic; 231 const char* s_builtinPrototypeTestCode = 232 "(function (strArg)\n" \ 233 "{\n" \ 234 " \"use strict\";\n" \ 235 " let regexp = this;\n" \ 236 " if (@isRegExpObject(regexp) && @tryGetById(regexp, \"exec\") === @regExpBuiltinExec)\n" \ 237 " return @regExpTestFast.@call(regexp, strArg);\n" \ 238 " if (!@isObject(regexp))\n" \ 239 " @throwTypeError(\"RegExp.prototype.test requires that |this| be an Object\");\n" \ 240 " let str = @toString(strArg);\n" \ 241 " let match = @regExpExec(regexp, str);\n" \ 242 " if (match !== null)\n" \ 243 " return true;\n" \ 244 " return false;\n" \ 245 "})\n" \ 246 ; 247 248 249 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 177 250 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 178 251 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Separate.js-result
r208985 r221327 47 47 extern const int s_builtinPrototypeForEachCodeLength; 48 48 extern const JSC::ConstructAbility s_builtinPrototypeForEachCodeConstructAbility; 49 extern const char* s_builtinPrototypeMatchCode; 50 extern const int s_builtinPrototypeMatchCodeLength; 51 extern const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility; 52 extern const char* s_builtinPrototypeTestCode; 53 extern const int s_builtinPrototypeTestCodeLength; 54 extern const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility; 49 55 50 56 #define JSC_FOREACH_BUILTIN_PROTOTYPE_BUILTIN_DATA(macro) \ 51 57 macro(every, builtinPrototypeEvery, 1) \ 52 58 macro(forEach, builtinPrototypeForEach, 1) \ 59 macro(match, builtinPrototypeMatch, 1) \ 60 macro(test, builtinPrototypeTest, 1) \ 53 61 54 62 #define JSC_BUILTIN_BUILTIN_PROTOTYPE_EVERY 1 55 63 #define JSC_BUILTIN_BUILTIN_PROTOTYPE_FOREACH 1 64 #define JSC_BUILTIN_BUILTIN_PROTOTYPE_MATCH 1 65 #define JSC_BUILTIN_BUILTIN_PROTOTYPE_TEST 1 56 66 57 67 #define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_CODE(macro) \ 58 macro(builtinPrototypeEveryCode, every, s_builtinPrototypeEveryCodeLength) \ 59 macro(builtinPrototypeForEachCode, forEach, s_builtinPrototypeForEachCodeLength) \ 68 macro(builtinPrototypeEveryCode, every, static_cast<const char*>(nullptr), s_builtinPrototypeEveryCodeLength) \ 69 macro(builtinPrototypeForEachCode, forEach, static_cast<const char*>(nullptr), s_builtinPrototypeForEachCodeLength) \ 70 macro(builtinPrototypeMatchCode, match, "[Symbol.match]", s_builtinPrototypeMatchCodeLength) \ 71 macro(builtinPrototypeTestCode, test, static_cast<const char*>(nullptr), s_builtinPrototypeTestCodeLength) \ 60 72 61 73 #define JSC_FOREACH_BUILTIN.PROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \ 62 74 macro(every) \ 63 75 macro(forEach) \ 64 65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ 76 macro(match) \ 77 macro(test) \ 78 79 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 66 80 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 67 81 … … 108 122 #include "BuiltinExecutables.h" 109 123 #include "HeapInlines.h" 124 #include "IdentifierInlines.h" 110 125 #include "Intrinsic.h" 111 126 #include "JSCellInlines.h" … … 172 187 ; 173 188 174 175 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ 189 const JSC::ConstructAbility s_builtinPrototypeMatchCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; 190 const int s_builtinPrototypeMatchCodeLength = 1198; 191 static const JSC::Intrinsic s_builtinPrototypeMatchCodeIntrinsic = JSC::NoIntrinsic; 192 const char* s_builtinPrototypeMatchCode = 193 "(function (strArg)\n" \ 194 "{\n" \ 195 " \"use strict\";\n" \ 196 " if (!@isObject(this))\n" \ 197 " @throwTypeError(\"RegExp.prototype.@@match requires that |this| be an Object\");\n" \ 198 " let regexp = this;\n" \ 199 " if (!@hasObservableSideEffectsForRegExpMatch(regexp))\n" \ 200 " return @regExpMatchFast.@call(regexp, strArg);\n" \ 201 " let str = @toString(strArg);\n" \ 202 " if (!regexp.global)\n" \ 203 " return @regExpExec(regexp, str);\n" \ 204 " \n" \ 205 " let unicode = regexp.unicode;\n" \ 206 " regexp.lastIndex = 0;\n" \ 207 " let resultList = [];\n" \ 208 " const maximumReasonableMatchSize = 100000000;\n" \ 209 " while (true) {\n" \ 210 " let result = @regExpExec(regexp, str);\n" \ 211 " \n" \ 212 " if (result === null) {\n" \ 213 " if (resultList.length === 0)\n" \ 214 " return null;\n" \ 215 " return resultList;\n" \ 216 " }\n" \ 217 " if (resultList.length > maximumReasonableMatchSize)\n" \ 218 " @throwOutOfMemoryError();\n" \ 219 " if (!@isObject(result))\n" \ 220 " @throwTypeError(\"RegExp.prototype.@@match call to RegExp.exec didn't return null or an object\");\n" \ 221 " let resultString = @toString(result[0]);\n" \ 222 " if (!resultString.length)\n" \ 223 " regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);\n" \ 224 " resultList.@push(resultString);\n" \ 225 " }\n" \ 226 "})\n" \ 227 ; 228 229 const JSC::ConstructAbility s_builtinPrototypeTestCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; 230 const int s_builtinPrototypeTestCodeLength = 456; 231 static const JSC::Intrinsic s_builtinPrototypeTestCodeIntrinsic = JSC::RegExpTestIntrinsic; 232 const char* s_builtinPrototypeTestCode = 233 "(function (strArg)\n" \ 234 "{\n" \ 235 " \"use strict\";\n" \ 236 " let regexp = this;\n" \ 237 " if (@isRegExpObject(regexp) && @tryGetById(regexp, \"exec\") === @regExpBuiltinExec)\n" \ 238 " return @regExpTestFast.@call(regexp, strArg);\n" \ 239 " if (!@isObject(regexp))\n" \ 240 " @throwTypeError(\"RegExp.prototype.test requires that |this| be an Object\");\n" \ 241 " let str = @toString(strArg);\n" \ 242 " let match = @regExpExec(regexp, str);\n" \ 243 " if (match !== null)\n" \ 244 " return true;\n" \ 245 " return false;\n" \ 246 "})\n" \ 247 ; 248 249 250 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 176 251 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 177 252 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result
r208985 r221327 53 53 54 54 #define JSC_FOREACH_BUILTIN_CODE(macro) \ 55 macro(builtinConstructorOfCode, of, s _builtinConstructorOfCodeLength) \56 macro(builtinConstructorFromCode, from, s _builtinConstructorFromCodeLength) \55 macro(builtinConstructorOfCode, of, static_cast<const char*>(nullptr), s_builtinConstructorOfCodeLength) \ 56 macro(builtinConstructorFromCode, from, static_cast<const char*>(nullptr), s_builtinConstructorFromCodeLength) \ 57 57 58 58 #define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ … … 62 62 #define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ 63 63 64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 65 65 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 66 66 … … 106 106 #include "BuiltinExecutables.h" 107 107 #include "HeapInlines.h" 108 #include "IdentifierInlines.h" 108 109 #include "Intrinsic.h" 109 110 #include "JSCellInlines.h" … … 187 188 188 189 189 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \190 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 190 191 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 191 192 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Separate.js-result
r208985 r221327 55 55 56 56 #define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_CODE(macro) \ 57 macro(builtinConstructorOfCode, of, s _builtinConstructorOfCodeLength) \58 macro(builtinConstructorFromCode, from, s _builtinConstructorFromCodeLength) \57 macro(builtinConstructorOfCode, of, static_cast<const char*>(nullptr), s_builtinConstructorOfCodeLength) \ 58 macro(builtinConstructorFromCode, from, static_cast<const char*>(nullptr), s_builtinConstructorFromCodeLength) \ 59 59 60 60 #define JSC_FOREACH_BUILTINCONSTRUCTOR_BUILTIN_FUNCTION_NAME(macro) \ … … 62 62 macro(of) \ 63 63 64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 65 65 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 66 66 … … 106 106 #include "BuiltinExecutables.h" 107 107 #include "HeapInlines.h" 108 #include "IdentifierInlines.h" 108 109 #include "Intrinsic.h" 109 110 #include "JSCellInlines.h" … … 186 187 187 188 188 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \189 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 189 190 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 190 191 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result
r208985 r221327 54 54 55 55 #define JSC_FOREACH_BUILTIN_CODE(macro) \ 56 macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s _internalClashingNamesIsReadableStreamLockedCodeLength) \57 macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, s _internalClashingNamesIsReadableStreamLockedCodeLength) \56 macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_internalClashingNamesIsReadableStreamLockedCodeLength) \ 57 macro(internalClashingNamesIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_internalClashingNamesIsReadableStreamLockedCodeLength) \ 58 58 59 59 #define JSC_FOREACH_BUILTIN_FUNCTION_NAME(macro) \ … … 62 62 #define JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(macro) \ 63 63 64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \64 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 65 65 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 66 66 … … 107 107 #include "BuiltinExecutables.h" 108 108 #include "HeapInlines.h" 109 #include "IdentifierInlines.h" 109 110 #include "Intrinsic.h" 110 111 #include "JSCellInlines.h" … … 137 138 138 139 139 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \140 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 140 141 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 141 142 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-AnotherGuardedInternalBuiltin-Separate.js-result
r210149 r221327 55 55 56 56 #define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \ 57 macro(anotherGuardedInternalBuiltinLetsFetchCode, letsFetch, s _anotherGuardedInternalBuiltinLetsFetchCodeLength) \57 macro(anotherGuardedInternalBuiltinLetsFetchCode, letsFetch, static_cast<const char*>(nullptr), s_anotherGuardedInternalBuiltinLetsFetchCodeLength) \ 58 58 59 59 #define WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ 60 60 macro(letsFetch) \ 61 61 62 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \62 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 63 63 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 64 64 … … 71 71 : m_vm(*vm) 72 72 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 73 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))73 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 74 74 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 75 75 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 77 77 } 78 78 79 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \79 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 80 80 JSC::UnlinkedFunctionExecutable* name##Executable(); \ 81 81 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 92 92 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 93 93 94 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \94 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ 95 95 JSC::SourceCode m_##name##Source;\ 96 96 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 100 100 }; 101 101 102 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \102 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 103 103 inline JSC::UnlinkedFunctionExecutable* AnotherGuardedInternalBuiltinBuiltinsWrapper::name##Executable() \ 104 104 {\ 105 if (!m_##name##Executable)\ 106 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ 105 if (!m_##name##Executable) {\ 106 JSC::Identifier executableName = functionName##PublicName();\ 107 if (overriddenName)\ 108 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ 109 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ 110 }\ 107 111 return m_##name##Executable.get();\ 108 112 } … … 135 139 inline void AnotherGuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) 136 140 { 137 #define EXPORT_FUNCTION(codeName, functionName, length)\138 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create BuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));141 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ 142 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); 139 143 WEBCORE_FOREACH_ANOTHERGUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION) 140 144 #undef EXPORT_FUNCTION … … 191 195 #include "WebCoreJSClientData.h" 192 196 #include <heap/HeapInlines.h> 197 #include <runtime/IdentifierInlines.h> 193 198 #include <runtime/Intrinsic.h> 194 199 #include <runtime/JSCJSValueInlines.h> … … 211 216 212 217 213 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \218 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 214 219 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 215 220 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-ArbitraryConditionalGuard-Separate.js-result
r210149 r221327 56 56 57 57 #define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(macro) \ 58 macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, s _arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \58 macro(arbitraryConditionalGuardIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_arbitraryConditionalGuardIsReadableStreamLockedCodeLength) \ 59 59 60 60 #define WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(macro) \ 61 61 macro(isReadableStreamLocked) \ 62 62 63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 64 64 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 65 65 … … 72 72 : m_vm(*vm) 73 73 WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 75 75 WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 76 76 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 78 78 } 79 79 80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 81 81 JSC::UnlinkedFunctionExecutable* name##Executable(); \ 82 82 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 93 93 WEBCORE_FOREACH_ARBITRARYCONDITIONALGUARD_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 94 94 95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ 96 96 JSC::SourceCode m_##name##Source;\ 97 97 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 101 101 }; 102 102 103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 104 104 inline JSC::UnlinkedFunctionExecutable* ArbitraryConditionalGuardBuiltinsWrapper::name##Executable() \ 105 105 {\ 106 if (!m_##name##Executable)\ 107 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ 106 if (!m_##name##Executable) {\ 107 JSC::Identifier executableName = functionName##PublicName();\ 108 if (overriddenName)\ 109 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ 110 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ 111 }\ 108 112 return m_##name##Executable.get();\ 109 113 } … … 161 165 #include "WebCoreJSClientData.h" 162 166 #include <heap/HeapInlines.h> 167 #include <runtime/IdentifierInlines.h> 163 168 #include <runtime/Intrinsic.h> 164 169 #include <runtime/JSCJSValueInlines.h> … … 181 186 182 187 183 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \188 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 184 189 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 185 190 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedBuiltin-Separate.js-result
r210149 r221327 56 56 57 57 #define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(macro) \ 58 macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s _guardedBuiltinIsReadableStreamLockedCodeLength) \58 macro(guardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_guardedBuiltinIsReadableStreamLockedCodeLength) \ 59 59 60 60 #define WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ 61 61 macro(isReadableStreamLocked) \ 62 62 63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 64 64 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 65 65 … … 72 72 : m_vm(*vm) 73 73 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 75 75 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 76 76 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 78 78 } 79 79 80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 81 81 JSC::UnlinkedFunctionExecutable* name##Executable(); \ 82 82 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 93 93 WEBCORE_FOREACH_GUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 94 94 95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ 96 96 JSC::SourceCode m_##name##Source;\ 97 97 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 101 101 }; 102 102 103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 104 104 inline JSC::UnlinkedFunctionExecutable* GuardedBuiltinBuiltinsWrapper::name##Executable() \ 105 105 {\ 106 if (!m_##name##Executable)\ 107 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ 106 if (!m_##name##Executable) {\ 107 JSC::Identifier executableName = functionName##PublicName();\ 108 if (overriddenName)\ 109 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ 110 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ 111 }\ 108 112 return m_##name##Executable.get();\ 109 113 } … … 161 165 #include "WebCoreJSClientData.h" 162 166 #include <heap/HeapInlines.h> 167 #include <runtime/IdentifierInlines.h> 163 168 #include <runtime/Intrinsic.h> 164 169 #include <runtime/JSCJSValueInlines.h> … … 181 186 182 187 183 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \188 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 184 189 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 185 190 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-GuardedInternalBuiltin-Separate.js-result
r210149 r221327 56 56 57 57 #define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(macro) \ 58 macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s _guardedInternalBuiltinIsReadableStreamLockedCodeLength) \58 macro(guardedInternalBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_guardedInternalBuiltinIsReadableStreamLockedCodeLength) \ 59 59 60 60 #define WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ 61 61 macro(isReadableStreamLocked) \ 62 62 63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \63 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 64 64 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 65 65 … … 72 72 : m_vm(*vm) 73 73 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))74 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 75 75 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 76 76 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 78 78 } 79 79 80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \80 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 81 81 JSC::UnlinkedFunctionExecutable* name##Executable(); \ 82 82 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 93 93 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 94 94 95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \95 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ 96 96 JSC::SourceCode m_##name##Source;\ 97 97 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 101 101 }; 102 102 103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \103 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 104 104 inline JSC::UnlinkedFunctionExecutable* GuardedInternalBuiltinBuiltinsWrapper::name##Executable() \ 105 105 {\ 106 if (!m_##name##Executable)\ 107 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ 106 if (!m_##name##Executable) {\ 107 JSC::Identifier executableName = functionName##PublicName();\ 108 if (overriddenName)\ 109 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ 110 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ 111 }\ 108 112 return m_##name##Executable.get();\ 109 113 } … … 136 140 inline void GuardedInternalBuiltinBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) 137 141 { 138 #define EXPORT_FUNCTION(codeName, functionName, length)\139 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create BuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));142 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ 143 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); 140 144 WEBCORE_FOREACH_GUARDEDINTERNALBUILTIN_BUILTIN_CODE(EXPORT_FUNCTION) 141 145 #undef EXPORT_FUNCTION … … 193 197 #include "WebCoreJSClientData.h" 194 198 #include <heap/HeapInlines.h> 199 #include <runtime/IdentifierInlines.h> 195 200 #include <runtime/Intrinsic.h> 196 201 #include <runtime/JSCJSValueInlines.h> … … 213 218 214 219 215 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \220 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 216 221 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 217 222 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-UnguardedBuiltin-Separate.js-result
r210149 r221327 54 54 55 55 #define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(macro) \ 56 macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, s _unguardedBuiltinIsReadableStreamLockedCodeLength) \56 macro(unguardedBuiltinIsReadableStreamLockedCode, isReadableStreamLocked, static_cast<const char*>(nullptr), s_unguardedBuiltinIsReadableStreamLockedCodeLength) \ 57 57 58 58 #define WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(macro) \ 59 59 macro(isReadableStreamLocked) \ 60 60 61 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \61 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 62 62 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 63 63 … … 70 70 : m_vm(*vm) 71 71 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 72 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))72 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 73 73 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 74 74 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 76 76 } 77 77 78 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \78 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 79 79 JSC::UnlinkedFunctionExecutable* name##Executable(); \ 80 80 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 91 91 WEBCORE_FOREACH_UNGUARDEDBUILTIN_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 92 92 93 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \93 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ 94 94 JSC::SourceCode m_##name##Source;\ 95 95 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 99 99 }; 100 100 101 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \101 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 102 102 inline JSC::UnlinkedFunctionExecutable* UnguardedBuiltinBuiltinsWrapper::name##Executable() \ 103 103 {\ 104 if (!m_##name##Executable)\ 105 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ 104 if (!m_##name##Executable) {\ 105 JSC::Identifier executableName = functionName##PublicName();\ 106 if (overriddenName)\ 107 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ 108 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ 109 }\ 106 110 return m_##name##Executable.get();\ 107 111 } … … 155 159 #include "WebCoreJSClientData.h" 156 160 #include <heap/HeapInlines.h> 161 #include <runtime/IdentifierInlines.h> 157 162 #include <runtime/Intrinsic.h> 158 163 #include <runtime/JSCJSValueInlines.h> … … 175 180 176 181 177 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \182 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 178 183 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 179 184 {\ -
trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected/WebCore-xmlCasingTest-Separate.js-result
r210149 r221327 66 66 67 67 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(macro) \ 68 macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, s _xmlCasingTestXMLCasingTestCodeLength) \69 macro(xmlCasingTestCssCasingTestCode, cssCasingTest, s _xmlCasingTestCssCasingTestCodeLength) \70 macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, s _xmlCasingTestUrlCasingTestCodeLength) \68 macro(xmlCasingTestXMLCasingTestCode, xmlCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestXMLCasingTestCodeLength) \ 69 macro(xmlCasingTestCssCasingTestCode, cssCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestCssCasingTestCodeLength) \ 70 macro(xmlCasingTestUrlCasingTestCode, urlCasingTest, static_cast<const char*>(nullptr), s_xmlCasingTestUrlCasingTestCodeLength) \ 71 71 72 72 #define WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(macro) \ … … 75 75 macro(xmlCasingTest) \ 76 76 77 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \77 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 78 78 JSC::FunctionExecutable* codeName##Generator(JSC::VM&); 79 79 … … 86 86 : m_vm(*vm) 87 87 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) 88 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { }))88 #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) 89 89 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) 90 90 #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS … … 92 92 } 93 93 94 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \94 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 95 95 JSC::UnlinkedFunctionExecutable* name##Executable(); \ 96 96 const JSC::SourceCode& name##Source() const { return m_##name##Source; } … … 107 107 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) 108 108 109 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \109 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ 110 110 JSC::SourceCode m_##name##Source;\ 111 111 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; … … 115 115 }; 116 116 117 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \117 #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ 118 118 inline JSC::UnlinkedFunctionExecutable* xmlCasingTestBuiltinsWrapper::name##Executable() \ 119 119 {\ 120 if (!m_##name##Executable)\ 121 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\ 120 if (!m_##name##Executable) {\ 121 JSC::Identifier executableName = functionName##PublicName();\ 122 if (overriddenName)\ 123 executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ 124 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ 125 }\ 122 126 return m_##name##Executable.get();\ 123 127 } … … 150 154 inline void xmlCasingTestBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) 151 155 { 152 #define EXPORT_FUNCTION(codeName, functionName, length)\153 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create BuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));156 #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ 157 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); 154 158 WEBCORE_FOREACH_XMLCASINGTEST_BUILTIN_CODE(EXPORT_FUNCTION) 155 159 #undef EXPORT_FUNCTION … … 207 211 #include "WebCoreJSClientData.h" 208 212 #include <heap/HeapInlines.h> 213 #include <runtime/IdentifierInlines.h> 209 214 #include <runtime/Intrinsic.h> 210 215 #include <runtime/JSCJSValueInlines.h> … … 264 269 265 270 266 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \271 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ 267 272 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ 268 273 {\
Note:
See TracChangeset
for help on using the changeset viewer.