Skip to content

Commit 296b8d6

Browse files
committed
WebAssembly: We should have Origins
https://bugs.webkit.org/show_bug.cgi?id=170217 Reviewed by Mark Lam. This patch adds wasm origins for B3::Values, called OpcodeOrigin. Currently, OpcodeOrigin just tracks the original opcode and the location of that opcode. Here's a sample: BB#0: ; frequency = 1.000000 Int64 @4 = Patchpoint(generator = 0x10f487fa8, earlyClobbered = [], lateClobbered = [], usedRegisters = [], resultConstraint = SomeRegister) Int64 @5 = FramePointer() Void @8 = Store(@4, @5, offset = 24, ControlDependent|Writes:Top) Int64 @10 = Const64(0) Void @12 = Store($0(@10), @5, offset = 16, ControlDependent|Writes:Top) Int64 @13 = Patchpoint(generator = 0x10f4be7f0, earlyClobbered = [], lateClobbered = [], usedRegisters = [], resultConstraint = SomeRegister, ExitsSideways|ControlDependent|WritesPinned|ReadsPinned|Fence|Writes:Top|Reads:Top) Int64 @16 = ArgumentReg(%rdi) Int64 @18 = ArgumentReg(%rsi) Int32 @22 = Trunc(@18, Wasm: {opcode: I64Rotl, location: 5}) Int64 @23 = RotL(@16, @22, Wasm: {opcode: I64Rotl, location: 5}) Void @27 = Return(@23, Terminal, Wasm: {opcode: End, location: 6}) * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3Value.cpp: (JSC::B3::Value::deepDump): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::setParser): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer): (JSC::Wasm::B3IRGenerator::emitLoadOp): (JSC::Wasm::B3IRGenerator::emitStoreOp): (JSC::Wasm::B3IRGenerator::addConstant): (JSC::Wasm::B3IRGenerator::addLoop): (JSC::Wasm::B3IRGenerator::unify): (JSC::Wasm::parseAndCompile): (JSC::Wasm::B3IRGenerator::emitChecksForModOrDiv): (JSC::Wasm::getMemoryBaseAndSize): Deleted. * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser::currentOpcode): (JSC::Wasm::FunctionParser::currentOpcodeStartingOffset): (JSC::Wasm::FunctionParser<Context>::FunctionParser): * wasm/WasmOpcodeOrigin.cpp: Added. (JSC::Wasm::OpcodeOrigin::dump): * wasm/WasmOpcodeOrigin.h: Added. (JSC::Wasm::OpcodeOrigin::OpcodeOrigin): * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::setParser): * wasm/generateWasmB3IRGeneratorInlinesHeader.py: (CodeGenerator.generate): (generateB3OpCode): (generateConstCode): Canonical link: https://commits.webkit.org/187143@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent e986354 commit 296b8d6

11 files changed

Lines changed: 412 additions & 239 deletions

‎Source/JavaScriptCore/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ set(JavaScriptCore_SOURCES
943943
wasm/WasmModuleParser.cpp
944944
wasm/WasmPageCount.cpp
945945
wasm/WasmPlan.cpp
946+
wasm/WasmOpcodeOrigin.cpp
946947
wasm/WasmSignature.cpp
947948
wasm/WasmValidate.cpp
948949
wasm/WasmWorklist.cpp

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1+
2017-03-28 Keith Miller <keith_miller@apple.com>
2+
3+
WebAssembly: We should have Origins
4+
https://bugs.webkit.org/show_bug.cgi?id=170217
5+
6+
Reviewed by Mark Lam.
7+
8+
This patch adds wasm origins for B3::Values, called OpcodeOrigin. Currently,
9+
OpcodeOrigin just tracks the original opcode and the location of that opcode.
10+
11+
Here's a sample:
12+
13+
BB#0: ; frequency = 1.000000
14+
Int64 @4 = Patchpoint(generator = 0x10f487fa8, earlyClobbered = [], lateClobbered = [], usedRegisters = [], resultConstraint = SomeRegister)
15+
Int64 @5 = FramePointer()
16+
Void @8 = Store(@4, @5, offset = 24, ControlDependent|Writes:Top)
17+
Int64 @10 = Const64(0)
18+
Void @12 = Store($0(@10), @5, offset = 16, ControlDependent|Writes:Top)
19+
Int64 @13 = Patchpoint(generator = 0x10f4be7f0, earlyClobbered = [], lateClobbered = [], usedRegisters = [], resultConstraint = SomeRegister, ExitsSideways|ControlDependent|WritesPinned|ReadsPinned|Fence|Writes:Top|Reads:Top)
20+
Int64 @16 = ArgumentReg(%rdi)
21+
Int64 @18 = ArgumentReg(%rsi)
22+
Int32 @22 = Trunc(@18, Wasm: {opcode: I64Rotl, location: 5})
23+
Int64 @23 = RotL(@16, @22, Wasm: {opcode: I64Rotl, location: 5})
24+
Void @27 = Return(@23, Terminal, Wasm: {opcode: End, location: 6})
25+
26+
* JavaScriptCore.xcodeproj/project.pbxproj:
27+
* b3/B3Value.cpp:
28+
(JSC::B3::Value::deepDump):
29+
* wasm/WasmB3IRGenerator.cpp:
30+
(JSC::Wasm::B3IRGenerator::setParser):
31+
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
32+
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
33+
(JSC::Wasm::B3IRGenerator::emitLoadOp):
34+
(JSC::Wasm::B3IRGenerator::emitStoreOp):
35+
(JSC::Wasm::B3IRGenerator::addConstant):
36+
(JSC::Wasm::B3IRGenerator::addLoop):
37+
(JSC::Wasm::B3IRGenerator::unify):
38+
(JSC::Wasm::parseAndCompile):
39+
(JSC::Wasm::B3IRGenerator::emitChecksForModOrDiv):
40+
(JSC::Wasm::getMemoryBaseAndSize): Deleted.
41+
* wasm/WasmFunctionParser.h:
42+
(JSC::Wasm::FunctionParser::currentOpcode):
43+
(JSC::Wasm::FunctionParser::currentOpcodeStartingOffset):
44+
(JSC::Wasm::FunctionParser<Context>::FunctionParser):
45+
* wasm/WasmOpcodeOrigin.cpp: Added.
46+
(JSC::Wasm::OpcodeOrigin::dump):
47+
* wasm/WasmOpcodeOrigin.h: Added.
48+
(JSC::Wasm::OpcodeOrigin::OpcodeOrigin):
49+
* wasm/WasmValidate.cpp:
50+
(JSC::Wasm::Validate::setParser):
51+
* wasm/generateWasmB3IRGeneratorInlinesHeader.py:
52+
(CodeGenerator.generate):
53+
(generateB3OpCode):
54+
(generateConstCode):
55+
156
2017-03-28 JF Bastien <jfbastien@apple.com>
257

358
WebAssembly: option to crash if no fast memory is available

‎Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,8 @@
13551355
53B0BE341E561AC900A8FC29 /* GetterSetterAccessCase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53B0BE331E561AC900A8FC29 /* GetterSetterAccessCase.cpp */; };
13561356
53B0BE361E561B0900A8FC29 /* ProxyableAccessCase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53B0BE351E561B0900A8FC29 /* ProxyableAccessCase.cpp */; };
13571357
53B0BE381E561B2400A8FC29 /* IntrinsicGetterAccessCase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53B0BE371E561B2400A8FC29 /* IntrinsicGetterAccessCase.cpp */; };
1358+
53C6FEEF1E8ADFA900B18425 /* WasmOpcodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C6FEEE1E8ADFA900B18425 /* WasmOpcodeOrigin.h */; };
1359+
53C6FEF11E8AFE0C00B18425 /* WasmOpcodeOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53C6FEF01E8AFE0C00B18425 /* WasmOpcodeOrigin.cpp */; };
13581360
53D444DC1DAF08AB00B92784 /* B3WasmAddressValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 53D444DB1DAF08AB00B92784 /* B3WasmAddressValue.h */; };
13591361
53D444DE1DAF09A000B92784 /* B3WasmAddressValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53D444DD1DAF09A000B92784 /* B3WasmAddressValue.cpp */; };
13601362
53F40E851D58F9770099A1B6 /* WasmSections.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E841D58F9770099A1B6 /* WasmSections.h */; };
@@ -3854,6 +3856,8 @@
38543856
53B0BE331E561AC900A8FC29 /* GetterSetterAccessCase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetterSetterAccessCase.cpp; sourceTree = "<group>"; };
38553857
53B0BE351E561B0900A8FC29 /* ProxyableAccessCase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyableAccessCase.cpp; sourceTree = "<group>"; };
38563858
53B0BE371E561B2400A8FC29 /* IntrinsicGetterAccessCase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntrinsicGetterAccessCase.cpp; sourceTree = "<group>"; };
3859+
53C6FEEE1E8ADFA900B18425 /* WasmOpcodeOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmOpcodeOrigin.h; sourceTree = "<group>"; };
3860+
53C6FEF01E8AFE0C00B18425 /* WasmOpcodeOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmOpcodeOrigin.cpp; sourceTree = "<group>"; };
38573861
53D444DB1DAF08AB00B92784 /* B3WasmAddressValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3WasmAddressValue.h; path = b3/B3WasmAddressValue.h; sourceTree = "<group>"; };
38583862
53D444DD1DAF09A000B92784 /* B3WasmAddressValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3WasmAddressValue.cpp; path = b3/B3WasmAddressValue.cpp; sourceTree = "<group>"; };
38593863
53F256E11B87E28000B4B768 /* JSTypedArrayViewPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTypedArrayViewPrototype.cpp; sourceTree = "<group>"; };
@@ -6292,6 +6296,8 @@
62926296
ADB6F67C1E15D7500082F384 /* WasmPageCount.cpp */,
62936297
5381B9361E60E9660090F794 /* WasmFaultSignalHandler.cpp */,
62946298
5381B9381E60E97D0090F794 /* WasmFaultSignalHandler.h */,
6299+
53C6FEF01E8AFE0C00B18425 /* WasmOpcodeOrigin.cpp */,
6300+
53C6FEEE1E8ADFA900B18425 /* WasmOpcodeOrigin.h */,
62956301
79B759731DFA4C600052174C /* WasmPageCount.h */,
62966302
53F40E8C1D5901F20099A1B6 /* WasmParser.h */,
62976303
531374BE1D5CE95000AF7A0B /* WasmPlan.cpp */,
@@ -8643,6 +8649,7 @@
86438649
0FDB2CCA173DA523007B3C1B /* FTLValueFromBlock.h in Headers */,
86448650
0F5A6284188C98D40072C9DF /* FTLValueRange.h in Headers */,
86458651
0F0332C618B53FA9005F979A /* FTLWeight.h in Headers */,
8652+
53C6FEEF1E8ADFA900B18425 /* WasmOpcodeOrigin.h in Headers */,
86468653
0F0332C818B546EC005F979A /* FTLWeightedTarget.h in Headers */,
86478654
0F666EC1183566F900D017F1 /* FullBytecodeLiveness.h in Headers */,
86488655
2A83638A18D7D0FE0000EBCC /* FullGCActivityCallback.h in Headers */,
@@ -9931,6 +9938,7 @@
99319938
0FEC85751BDACDC70080FF74 /* AirCode.cpp in Sources */,
99329939
0F61832B1C45BF070072450B /* AirCustom.cpp in Sources */,
99339940
0F4570381BE44C910062A629 /* AirEliminateDeadCode.cpp in Sources */,
9941+
53C6FEF11E8AFE0C00B18425 /* WasmOpcodeOrigin.cpp in Sources */,
99349942
0F61832C1C45BF070072450B /* AirEmitShuffle.cpp in Sources */,
99359943
0F4DE1CE1C4C1B54004D6C11 /* AirFixObviousSpills.cpp in Sources */,
99369944
262D85B61C0D650F006ACB61 /* AirFixPartialRegisterStalls.cpp in Sources */,

‎Source/JavaScriptCore/b3/B3Value.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ void Value::deepDump(const Procedure* proc, PrintStream& out) const
222222
CommaPrinter comma;
223223
dumpChildren(comma, out);
224224

225-
if (m_origin)
226-
out.print(comma, OriginDump(proc, m_origin));
227-
228225
dumpMeta(comma, out);
229226

230227
{
@@ -233,6 +230,9 @@ void Value::deepDump(const Procedure* proc, PrintStream& out) const
233230
out.print(comma, string);
234231
}
235232

233+
if (m_origin)
234+
out.print(comma, OriginDump(proc, m_origin));
235+
236236
out.print(")");
237237
}
238238

0 commit comments

Comments
 (0)