Changeset 202737 in webkit
- Timestamp:
- Jul 1, 2016, 9:38:11 AM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/API/tests/testapi.c ¶
r198559 r202737 43 43 #include "CustomGlobalObjectClassTest.h" 44 44 #include "ExecutionTimeLimitTest.h" 45 #include "FunctionOverridesTest.h" 45 46 #include "GlobalContextWithFinalizerTest.h" 46 47 #include "PingPongStackOverflowTest.h" … … 1886 1887 failed = testTypedArrayCAPI() || failed; 1887 1888 failed = testExecutionTimeLimit() || failed; 1889 failed = testFunctionOverrides() || failed; 1888 1890 failed = testGlobalContextWithFinalizer() || failed; 1889 1891 failed = testPingPongStackOverflow() || failed; -
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r202734 r202737 1 2016-07-01 Mark Lam <mark.lam@apple.com> 2 3 Update JSC_functionOverrides to handle the new SourceCode strings that have params. 4 https://bugs.webkit.org/show_bug.cgi?id=159321 5 6 Reviewed by Geoffrey Garen. 7 8 And add tests so that this won't fail silently and bit rot anymore. 9 10 * API/tests/FunctionOverridesTest.cpp: Added. 11 (testFunctionOverrides): 12 * API/tests/FunctionOverridesTest.h: Added. 13 * API/tests/testapi-function-overrides.js: Added. 14 * API/tests/testapi.c: 15 (main): 16 * JavaScriptCore.xcodeproj/project.pbxproj: 17 * bytecode/UnlinkedFunctionExecutable.cpp: 18 (JSC::UnlinkedFunctionExecutable::link): 19 * shell/PlatformWin.cmake: 20 * tools/FunctionOverrides.cpp: 21 (JSC::FunctionOverrides::FunctionOverrides): 22 (JSC::FunctionOverrides::reinstallOverrides): 23 (JSC::initializeOverrideInfo): 24 (JSC::FunctionOverrides::initializeOverrideFor): 25 * tools/FunctionOverrides.h: 26 (JSC::FunctionOverrides::clear): 27 1 28 2016-07-01 Caio Lima <ticaiolima@gmail.com> 2 29 -
TabularUnified trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj ¶
r202717 r202737 2109 2109 FEB58C14187B8B160098EF0B /* ErrorHandlingScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB58C12187B8B160098EF0B /* ErrorHandlingScope.cpp */; }; 2110 2110 FEB58C15187B8B160098EF0B /* ErrorHandlingScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FEB58C13187B8B160098EF0B /* ErrorHandlingScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2111 FECB8B271D25BB85006F2463 /* FunctionOverridesTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FECB8B251D25BB6E006F2463 /* FunctionOverridesTest.cpp */; }; 2112 FECB8B2A1D25CB5A006F2463 /* testapi-function-overrides.js in Copy Support Script */ = {isa = PBXBuildFile; fileRef = FECB8B291D25CABB006F2463 /* testapi-function-overrides.js */; }; 2111 2113 FED287B215EC9A5700DA8161 /* LLIntOpcode.h in Headers */ = {isa = PBXBuildFile; fileRef = FED287B115EC9A5700DA8161 /* LLIntOpcode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2112 2114 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */; }; … … 2237 2239 dstSubfolderSpec = 16; 2238 2240 files = ( 2241 FECB8B2A1D25CB5A006F2463 /* testapi-function-overrides.js in Copy Support Script */, 2239 2242 5DBB151B131D0B310056AD36 /* testapi.js in Copy Support Script */, 2240 2243 ); … … 4373 4376 FEB58C12187B8B160098EF0B /* ErrorHandlingScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorHandlingScope.cpp; sourceTree = "<group>"; }; 4374 4377 FEB58C13187B8B160098EF0B /* ErrorHandlingScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorHandlingScope.h; sourceTree = "<group>"; }; 4378 FECB8B251D25BB6E006F2463 /* FunctionOverridesTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FunctionOverridesTest.cpp; path = API/tests/FunctionOverridesTest.cpp; sourceTree = "<group>"; }; 4379 FECB8B261D25BB6E006F2463 /* FunctionOverridesTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FunctionOverridesTest.h; path = API/tests/FunctionOverridesTest.h; sourceTree = "<group>"; }; 4380 FECB8B291D25CABB006F2463 /* testapi-function-overrides.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = "testapi-function-overrides.js"; path = "API/tests/testapi-function-overrides.js"; sourceTree = "<group>"; }; 4375 4381 FED287B115EC9A5700DA8161 /* LLIntOpcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntOpcode.h; path = llint/LLIntOpcode.h; sourceTree = "<group>"; }; 4376 4382 FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Watchdog.cpp; sourceTree = "<group>"; }; … … 4958 4964 FE0D4A041AB8DD0A002F54BF /* ExecutionTimeLimitTest.cpp */, 4959 4965 FE0D4A051AB8DD0A002F54BF /* ExecutionTimeLimitTest.h */, 4966 FECB8B251D25BB6E006F2463 /* FunctionOverridesTest.cpp */, 4967 FECB8B261D25BB6E006F2463 /* FunctionOverridesTest.h */, 4960 4968 FE0D4A071ABA2437002F54BF /* GlobalContextWithFinalizerTest.cpp */, 4961 4969 FE0D4A081ABA2437002F54BF /* GlobalContextWithFinalizerTest.h */, … … 4971 4979 14BD5A2D0A3E91F600BAF59C /* testapi.c */, 4972 4980 14D857740A4696C80032146C /* testapi.js */, 4981 FECB8B291D25CABB006F2463 /* testapi-function-overrides.js */, 4973 4982 86D22219167EF9440024C804 /* testapi.mm */, 4974 4983 651122E5140469BA002B101D /* testRegExp.cpp */, … … 8625 8634 files = ( 8626 8635 FEF040511AAE662D00BD28B0 /* CompareAndSwapTest.cpp in Sources */, 8636 FECB8B271D25BB85006F2463 /* FunctionOverridesTest.cpp in Sources */, 8627 8637 C29ECB031804D0ED00D2CBB4 /* CurrentThisInsideBlockGetterTest.mm in Sources */, 8628 8638 C20328201981979D0088B499 /* CustomGlobalObjectClassTest.c in Sources */, -
TabularUnified trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp ¶
r201542 r202737 146 146 if (UNLIKELY(Options::functionOverrides())) { 147 147 hasFunctionOverride = FunctionOverrides::initializeOverrideFor(code, overrideInfo); 148 if ( hasFunctionOverride) {148 if (UNLIKELY(hasFunctionOverride)) { 149 149 firstLine = overrideInfo.firstLine; 150 150 lineCount = overrideInfo.lineCount; -
TabularUnified trunk/Source/JavaScriptCore/shell/PlatformWin.cmake ¶
r201912 r202737 30 30 ../API/tests/CustomGlobalObjectClassTest.c 31 31 ../API/tests/ExecutionTimeLimitTest.cpp 32 ../API/tests/FunctionOverridesTest.cpp 32 33 ../API/tests/GlobalContextWithFinalizerTest.cpp 33 34 ../API/tests/PingPongStackOverflowTest.cpp … … 48 49 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 49 50 ) 51 file(COPY 52 "${JAVASCRIPTCORE_DIR}/API/tests/testapi-function-overrides.js" 53 DESTINATION 54 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 55 ) -
TabularUnified trunk/Source/JavaScriptCore/tools/FunctionOverrides.cpp ¶
r202242 r202737 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 105 105 } 106 106 107 void FunctionOverrides::reinstallOverrides() 108 { 109 FunctionOverrides& overrides = FunctionOverrides::overrides(); 110 const char* overridesFileName = Options::functionOverrides(); 111 overrides.clear(); 112 overrides.parseOverridesInFile(overridesFileName); 113 } 114 107 115 static void initializeOverrideInfo(const SourceCode& origCode, const String& newBody, FunctionOverrides::OverrideInfo& info) 108 116 { 109 117 String origProviderStr = origCode.provider()->source().toString(); 110 unsigned origBraceStart = origCode.startOffset(); 111 unsigned origFunctionStart = origProviderStr.reverseFind("function", origBraceStart); 118 unsigned origStart = origCode.startOffset(); 119 unsigned origFunctionStart = origProviderStr.reverseFind("function", origStart); 120 unsigned origBraceStart = origProviderStr.find("{", origStart); 112 121 unsigned headerLength = origBraceStart - origFunctionStart; 113 122 String origHeader = origProviderStr.substring(origFunctionStart, headerLength); … … 128 137 129 138 info.sourceCode = 130 SourceCode(WTFMove(newProvider), info. typeProfilingStartOffset, info.typeProfilingEndOffset + 1, 1, 1);139 SourceCode(WTFMove(newProvider), info.parametersStartOffset, info.typeProfilingEndOffset + 1, 1, 1); 131 140 } 132 141 … … 136 145 FunctionOverrides& overrides = FunctionOverrides::overrides(); 137 146 138 auto it = overrides.m_entries.find(origCode.view().toString()); 147 String sourceString = origCode.view().toString(); 148 size_t sourceBodyStart = sourceString.find('{'); 149 if (sourceBodyStart == notFound) 150 return false; 151 String sourceBodyString = sourceString.substring(sourceBodyStart); 152 153 auto it = overrides.m_entries.find(sourceBodyString); 139 154 if (it == overrides.m_entries.end()) 140 155 return false; -
TabularUnified trunk/Source/JavaScriptCore/tools/FunctionOverrides.h ¶
r182903 r202737 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 54 54 static bool initializeOverrideFor(const SourceCode& origCode, OverrideInfo& result); 55 55 56 JS_EXPORT_PRIVATE static void reinstallOverrides(); 57 56 58 private: 57 59 void parseOverridesInFile(const char* fileName); 60 void clear() { m_entries.clear(); } 58 61 59 62 HashMap<String, String> m_entries;
Note:
See TracChangeset
for help on using the changeset viewer.