Changeset 165325 in webkit
- Timestamp:
- Mar 7, 2014, 10:26:16 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r165322 r165325 1 2014-03-07 Mark Lam <mark.lam@apple.com> 2 3 Fix bugs in 32-bit Structure implementation. 4 <https://webkit.org/b/129947> 5 6 Reviewed by Mark Hahnenberg. 7 8 Added the loading of the Structure (from the JSCell) before use that was 9 missing in a few places. Also added more test cases to equals-masquerader.js. 10 11 * dfg/DFGSpeculativeJIT32_64.cpp: 12 (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull): 13 (JSC::DFG::SpeculativeJIT::compile): 14 * dfg/DFGSpeculativeJIT64.cpp: 15 (JSC::DFG::SpeculativeJIT::compile): 16 * llint/LowLevelInterpreter32_64.asm: 17 * tests/stress/equals-masquerader.js: 18 (equalsNull): 19 (notEqualsNull): 20 (strictEqualsNull): 21 (strictNotEqualsNull): 22 (equalsUndefined): 23 (notEqualsUndefined): 24 (strictEqualsUndefined): 25 (strictNotEqualsUndefined): 26 (isFalsey): 27 (test): 28 1 29 2014-03-07 Andrew Trick <atrick@apple.com> 2 30 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r165208 r165325 260 260 GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); 261 261 m_jit.move(JITCompiler::TrustedImmPtr(m_jit.graph().globalObjectFor(m_currentNode->origin.semantic)), localGlobalObjectGPR); 262 m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureIDOffset()), resultPayloadGPR); 262 263 m_jit.loadPtr(JITCompiler::Address(resultPayloadGPR, Structure::globalObjectOffset()), remoteGlobalObjectGPR); 263 264 m_jit.compare32(invert ? JITCompiler::NotEqual : JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, resultPayloadGPR); … … 4104 4105 GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); 4105 4106 m_jit.move(TrustedImmPtr(m_jit.globalObjectFor(node->origin.semantic)), localGlobalObjectGPR); 4107 m_jit.loadPtr(JITCompiler::Address(value.payloadGPR(), JSCell::structureIDOffset()), result.gpr()); 4106 4108 m_jit.loadPtr(JITCompiler::Address(result.gpr(), Structure::globalObjectOffset()), remoteGlobalObjectGPR); 4107 4109 m_jit.compare32(JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, result.gpr()); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r165208 r165325 4391 4391 GPRTemporary localGlobalObject(this); 4392 4392 GPRTemporary remoteGlobalObject(this); 4393 GPRTemporary scratch(this); 4393 4394 4394 4395 JITCompiler::Jump isCell = m_jit.branchTest64(JITCompiler::Zero, value.gpr(), GPRInfo::tagMaskRegister); … … 4414 4415 GPRReg remoteGlobalObjectGPR = remoteGlobalObject.gpr(); 4415 4416 m_jit.move(TrustedImmPtr(m_jit.globalObjectFor(node->origin.semantic)), localGlobalObjectGPR); 4417 m_jit.emitLoadStructure(value.gpr(), result.gpr(), scratch.gpr()); 4416 4418 m_jit.loadPtr(JITCompiler::Address(result.gpr(), Structure::globalObjectOffset()), remoteGlobalObjectGPR); 4417 4419 m_jit.comparePtr(JITCompiler::Equal, localGlobalObjectGPR, remoteGlobalObjectGPR, result.gpr()); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r165135 r165325 879 879 jmp .opEqNullNotImmediate 880 880 .opEqNullMasqueradesAsUndefined: 881 loadp JSCell::m_structureID[t0], t1 881 882 loadp CodeBlock[cfr], t0 882 883 loadp CodeBlock::m_globalObject[t0], t0 … … 925 926 jmp .opNeqNullNotImmediate 926 927 .opNeqNullMasqueradesAsUndefined: 928 loadp JSCell::m_structureID[t0], t1 927 929 loadp CodeBlock[cfr], t0 928 930 loadp CodeBlock::m_globalObject[t0], t0 -
trunk/Source/JavaScriptCore/tests/stress/equals-masquerader.js
r165119 r165325 1 function foo(o) {1 function equalsNull(o) { 2 2 return o == null; 3 3 } 4 4 5 noInline( foo);5 noInline(equalsNull); 6 6 7 function test(object, outcome) { 8 var result = foo(object); 7 function notEqualsNull(o) { 8 return o != null; 9 } 10 11 noInline(notEqualsNull); 12 13 function strictEqualsNull(o) { 14 return o === null; 15 } 16 17 noInline(strictEqualsNull); 18 19 function strictNotEqualsNull(o) { 20 return o !== null; 21 } 22 23 noInline(strictNotEqualsNull); 24 25 function equalsUndefined(o) { 26 return o == void 0; 27 } 28 29 noInline(equalsUndefined); 30 31 function notEqualsUndefined(o) { 32 return o != void 0; 33 } 34 35 noInline(notEqualsUndefined); 36 37 function strictEqualsUndefined(o) { 38 return o === void 0; 39 } 40 41 noInline(strictEqualsUndefined); 42 43 function strictNotEqualsUndefined(o) { 44 return o !== void 0; 45 } 46 47 noInline(strictNotEqualsNull); 48 49 function isFalsey(o) { 50 return !o; 51 } 52 53 noInline(isFalsey); 54 55 function test(func, iteration, object, outcome) { 56 var result = func(object); 9 57 if (result != outcome) 10 throw new Error("Bad result: " + result );58 throw new Error("Bad result: " + result + " on iteration " + iteration); 11 59 } 12 60 13 61 for (var i = 0; i < 100000; ++i) { 14 test(null, true); 15 test({}, false); 16 test(makeMasquerader(), true); 62 test(equalsNull, i, null, true); 63 test(equalsNull, i, undefined, true); 64 test(equalsNull, i, void 0, true); 65 test(equalsNull, i, {}, false); 66 test(equalsNull, i, makeMasquerader(), true); 17 67 } 68 69 for (var i = 0; i < 100000; ++i) { 70 test(notEqualsNull, i, null, false); 71 test(notEqualsNull, i, undefined, false); 72 test(notEqualsNull, i, void 0, false); 73 test(notEqualsNull, i, {}, true); 74 test(notEqualsNull, i, makeMasquerader(), false); 75 } 76 77 for (var i = 0; i < 100000; ++i) { 78 test(strictEqualsNull, i, null, true); 79 test(strictEqualsNull, i, undefined, false); 80 test(strictEqualsNull, i, void 0, false); 81 test(strictEqualsNull, i, {}, false); 82 test(strictEqualsNull, i, makeMasquerader(), false); 83 } 84 85 for (var i = 0; i < 100000; ++i) { 86 test(strictNotEqualsNull, i, null, false); 87 test(strictNotEqualsNull, i, undefined, true); 88 test(strictNotEqualsNull, i, void 0, true); 89 test(strictNotEqualsNull, i, {}, true); 90 test(strictNotEqualsNull, i, makeMasquerader(), true); 91 } 92 93 for (var i = 0; i < 100000; ++i) { 94 test(equalsUndefined, i, null, true); 95 test(equalsUndefined, i, undefined, true); 96 test(equalsUndefined, i, void 0, true); 97 test(equalsUndefined, i, {}, false); 98 test(equalsUndefined, i, makeMasquerader(), true); 99 } 100 101 for (var i = 0; i < 100000; ++i) { 102 test(notEqualsUndefined, i, null, false); 103 test(notEqualsUndefined, i, undefined, false); 104 test(notEqualsUndefined, i, void 0, false); 105 test(notEqualsUndefined, i, {}, true); 106 test(notEqualsUndefined, i, makeMasquerader(), false); 107 } 108 109 for (var i = 0; i < 100000; ++i) { 110 test(strictEqualsUndefined, i, null, false); 111 test(strictEqualsUndefined, i, undefined, true); 112 test(strictEqualsUndefined, i, void 0, true); 113 test(strictEqualsUndefined, i, {}, false); 114 test(strictEqualsUndefined, i, makeMasquerader(), false); 115 } 116 117 for (var i = 0; i < 100000; ++i) { 118 test(strictNotEqualsUndefined, i, null, true); 119 test(strictNotEqualsUndefined, i, undefined, false); 120 test(strictNotEqualsUndefined, i, void 0, false); 121 test(strictNotEqualsUndefined, i, {}, true); 122 test(strictNotEqualsUndefined, i, makeMasquerader(), true); 123 } 124 125 for (var i = 0; i < 100000; ++i) { 126 test(isFalsey, i, null, true); 127 test(isFalsey, i, undefined, true); 128 test(isFalsey, i, void 0, true); 129 test(isFalsey, i, {}, false); 130 test(isFalsey, i, makeMasquerader(), true); 131 }
Note:
See TracChangeset
for help on using the changeset viewer.