Skip to content

Instantly share code, notes, and snippets.

@abiduzz420
Created September 10, 2019 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abiduzz420/36771faa48ba5e030aae28ee520876f5 to your computer and use it in GitHub Desktop.
Save abiduzz420/36771faa48ba5e030aae28ee520876f5 to your computer and use it in GitHub Desktop.
$ out/x64.debug/d8 --print-bytecode --allow-natives-syntax super-funny.js > super-funny-debug
[generated bytecode for function: ]
Parameter count 1
Register count 10
Frame size 80
0x3d2217c9fae6 @ 0 : 12 00 LdaConstant [0]
0x3d2217c9fae8 @ 2 : 26 f8 Star r3
0x3d2217c9faea @ 4 : 61 34 01 f8 01 CallRuntime [NewScriptContext], r3-r3
0x3d2217c9faef @ 9 : 16 f8 PushContext r3
0x3d2217c9faf1 @ 11 : 0f LdaTheHole
0x3d2217c9faf2 @ 12 : 1d 04 StaCurrentContextSlot [4]
0x3d2217c9faf4 @ 14 : 0f LdaTheHole
0x3d2217c9faf5 @ 15 : 1d 05 StaCurrentContextSlot [5]
0x3d2217c9faf7 @ 17 : 0f LdaTheHole
0x3d2217c9faf8 @ 18 : 1d 06 StaCurrentContextSlot [6]
0 E> 0x3d2217c9fafa @ 20 : a5 StackCheck
0x3d2217c9fafb @ 21 : 82 01 CreateBlockContext [1]
0x3d2217c9fafd @ 23 : 16 f7 PushContext r4
0x3d2217c9faff @ 25 : 0f LdaTheHole
0x3d2217c9fb00 @ 26 : 26 f3 Star r8
0x3d2217c9fb02 @ 28 : 81 03 00 00 CreateClosure [3], [0], #0
0x3d2217c9fb06 @ 32 : 26 f6 Star r5
0x3d2217c9fb08 @ 34 : 12 02 LdaConstant [2]
0x3d2217c9fb0a @ 36 : 26 f5 Star r6
0x3d2217c9fb0c @ 38 : 81 04 01 00 CreateClosure [4], [1], #0
0x3d2217c9fb10 @ 42 : 26 f2 Star r9
0x3d2217c9fb12 @ 44 : 27 f6 f4 Mov r5, r7
0x3d2217c9fb15 @ 47 : 61 22 00 f5 04 CallRuntime [DefineClass], r6-r9
0x3d2217c9fb1a @ 52 : 26 f5 Star r6
0x3d2217c9fb1c @ 54 : 27 f4 f9 Mov r7, r2
0x3d2217c9fb1f @ 57 : 17 f7 PopContext r4
0x3d2217c9fb21 @ 59 : 25 f9 Ldar r2
0 E> 0x3d2217c9fb23 @ 61 : 1d 04 StaCurrentContextSlot [4]
0x3d2217c9fb25 @ 63 : 82 05 CreateBlockContext [5]
0x3d2217c9fb27 @ 65 : 16 f7 PushContext r4
0x3d2217c9fb29 @ 67 : 18 f7 04 00 LdaContextSlot r4, [4], [0]
0x3d2217c9fb2d @ 71 : 26 f3 Star r8
166 E> 0x3d2217c9fb2f @ 73 : 81 07 02 00 CreateClosure [7], [2], #0
0x3d2217c9fb33 @ 77 : 26 f6 Star r5
0x3d2217c9fb35 @ 79 : 12 06 LdaConstant [6]
0x3d2217c9fb37 @ 81 : 26 f5 Star r6
0x3d2217c9fb39 @ 83 : 81 08 03 00 CreateClosure [8], [3], #0
0x3d2217c9fb3d @ 87 : 26 f2 Star r9
0x3d2217c9fb3f @ 89 : 27 f6 f4 Mov r5, r7
0x3d2217c9fb42 @ 92 : 61 22 00 f5 04 CallRuntime [DefineClass], r6-r9
0x3d2217c9fb47 @ 97 : 26 f5 Star r6
0x3d2217c9fb49 @ 99 : 27 f4 fa Mov r7, r1
0x3d2217c9fb4c @ 102 : 17 f7 PopContext r4
0x3d2217c9fb4e @ 104 : 25 fa Ldar r1
141 E> 0x3d2217c9fb50 @ 106 : 1d 05 StaCurrentContextSlot [5]
310 S> 0x3d2217c9fb52 @ 108 : 1a 05 LdaCurrentContextSlot [5]
0x3d2217c9fb54 @ 110 : 26 f7 Star r4
0x3d2217c9fb56 @ 112 : 0c 19 LdaSmi [25]
0x3d2217c9fb58 @ 114 : 26 f6 Star r5
0x3d2217c9fb5a @ 116 : 0c 08 LdaSmi [8]
0x3d2217c9fb5c @ 118 : 26 f5 Star r6
0x3d2217c9fb5e @ 120 : 12 09 LdaConstant [9]
0x3d2217c9fb60 @ 122 : 26 f4 Star r7
0x3d2217c9fb62 @ 124 : 25 f7 Ldar r4
310 E> 0x3d2217c9fb64 @ 126 : 65 f7 f6 03 00 Construct r4, r5-r7, [0]
310 E> 0x3d2217c9fb69 @ 131 : 1d 06 StaCurrentContextSlot [6]
362 S> 0x3d2217c9fb6b @ 133 : 1a 06 LdaCurrentContextSlot [6]
0x3d2217c9fb6d @ 135 : 26 f6 Star r5
365 E> 0x3d2217c9fb6f @ 137 : 29 f6 0a LdaNamedPropertyNoFeedback r5, [10]
0x3d2217c9fb72 @ 140 : 26 f7 Star r4
365 E> 0x3d2217c9fb74 @ 142 : 5f f7 f6 01 CallNoFeedback r4, r5-r5
415 S> 0x3d2217c9fb78 @ 146 : 1a 06 LdaCurrentContextSlot [6]
0x3d2217c9fb7a @ 148 : 26 f7 Star r4
430 E> 0x3d2217c9fb7c @ 150 : 29 f7 0a LdaNamedPropertyNoFeedback r4, [10]
0x3d2217c9fb7f @ 153 : 26 f7 Star r4
0x3d2217c9fb81 @ 155 : 61 65 01 f7 01 CallRuntime [DebugPrint], r4-r4
450 S> 0x3d2217c9fb86 @ 160 : 1a 06 LdaCurrentContextSlot [6]
0x3d2217c9fb88 @ 162 : 26 f6 Star r5
453 E> 0x3d2217c9fb8a @ 164 : 29 f6 0a LdaNamedPropertyNoFeedback r5, [10]
0x3d2217c9fb8d @ 167 : 26 f7 Star r4
453 E> 0x3d2217c9fb8f @ 169 : 5f f7 f6 01 CallNoFeedback r4, r5-r5
0x3d2217c9fb93 @ 173 : 26 fb Star r0
473 S> 0x3d2217c9fb95 @ 175 : a9 Return
Constant pool (size = 11)
0x3d2217c9fa49: [FixedArray] in OldSpace
- map: 0x32e5d12c0789 <Map>
- length: 11
0: 0x3d2217c9f791 <ScopeInfo SCRIPT_SCOPE [13]>
1: 0x3d2217c9f839 <ScopeInfo CLASS_SCOPE [4]>
2: 0x3beabb40b549 <FixedArray[7]>
3: 0x3d2217c9f8a9 <SharedFunctionInfo Point>
4: 0x3d2217c9f901 <SharedFunctionInfo toString>
5: 0x3d2217c9f809 <ScopeInfo CLASS_SCOPE [4]>
6: 0x3beabb40b681 <FixedArray[7]>
7: 0x3d2217c9f959 <SharedFunctionInfo ColorPoint>
8: 0x3d2217c9f9b1 <SharedFunctionInfo superPropertyCall>
9: 0x3d2217c9f759 <String[#5]: green>
10: 0x3d2217c9f719 <String[#17]: superPropertyCall>
Handler Table (size = 0)
[generated bytecode for function: ColorPoint]
Parameter count 4
Register count 7
Frame size 56
0x3d2217c9fda6 @ 0 : 27 fe fa Mov <closure>, r1
187 E> 0x3d2217c9fda9 @ 3 : a5 StackCheck
207 S> 0x3d2217c9fdaa @ 4 : 25 fa Ldar r1
0x3d2217c9fdac @ 6 : 55 f8 GetSuperConstructor r3
0x3d2217c9fdae @ 8 : 25 fb Ldar r0
0x3d2217c9fdb0 @ 10 : 27 04 f7 Mov a0, r4
0x3d2217c9fdb3 @ 13 : 27 03 f6 Mov a1, r5
207 E> 0x3d2217c9fdb6 @ 16 : 65 f8 f7 02 00 Construct r3, r4-r5, [0]
0x3d2217c9fdbb @ 21 : 26 f5 Star r6
0x3d2217c9fdbd @ 23 : 25 05 Ldar <this>
0x3d2217c9fdbf @ 25 : ac ThrowSuperAlreadyCalledIfNotHole
0x3d2217c9fdc0 @ 26 : 27 f5 05 Mov r6, <this>
224 S> 0x3d2217c9fdc3 @ 29 : 25 05 Ldar <this>
0x3d2217c9fdc5 @ 31 : ab ThrowSuperNotCalledIfHole
0x3d2217c9fdc6 @ 32 : 25 02 Ldar a2
235 E> 0x3d2217c9fdc8 @ 34 : 2d 05 00 02 StaNamedProperty <this>, [0], [2]
0x3d2217c9fdcc @ 38 : 25 05 Ldar <this>
0x3d2217c9fdce @ 40 : ab ThrowSuperNotCalledIfHole
246 S> 0x3d2217c9fdcf @ 41 : a9 Return
Constant pool (size = 1)
0x3d2217c9fd59: [FixedArray] in OldSpace
- map: 0x32e5d12c0789 <Map>
- length: 1
0: 0x32e5d12fb999 <String[#5]: color>
Handler Table (size = 0)
[generated bytecode for function: Point]
Parameter count 3
Register count 0
Frame size 0
27 E> 0x3d2217c9fece @ 0 : a5 StackCheck
40 S> 0x3d2217c9fecf @ 1 : 25 03 Ldar a0
47 E> 0x3d2217c9fed1 @ 3 : 2d 04 00 00 StaNamedProperty <this>, [0], [0]
56 S> 0x3d2217c9fed5 @ 7 : 25 02 Ldar a1
63 E> 0x3d2217c9fed7 @ 9 : 2d 04 01 02 StaNamedProperty <this>, [1], [2]
0x3d2217c9fedb @ 13 : 0d LdaUndefined
70 S> 0x3d2217c9fedc @ 14 : a9 Return
Constant pool (size = 2)
0x3d2217c9fe79: [FixedArray] in OldSpace
- map: 0x32e5d12c0789 <Map>
- length: 2
0: 0x3d2217c9f6c9 <String[#1]: x>
1: 0x3d2217c9f6e1 <String[#1]: y>
Handler Table (size = 0)
[generated bytecode for function: superPropertyCall]
Parameter count 1
Register count 6
Frame size 48
0x3d2217ca00ee @ 0 : 27 fe fb Mov <closure>, r0
267 E> 0x3d2217ca00f1 @ 3 : a5 StackCheck
276 S> 0x3d2217ca00f2 @ 4 : 12 00 LdaConstant [0]
276 E> 0x3d2217ca00f4 @ 6 : 2a fe 00 LdaKeyedProperty <closure>, [0]
0x3d2217ca00f7 @ 9 : 26 f7 Star r4
0x3d2217ca00f9 @ 11 : 12 01 LdaConstant [1]
0x3d2217ca00fb @ 13 : 26 f6 Star r5
0x3d2217ca00fd @ 15 : 27 02 f8 Mov <this>, r3
282 E> 0x3d2217ca0100 @ 18 : 61 24 00 f8 03 CallRuntime [LoadFromSuper], r3-r5
0x3d2217ca0105 @ 23 : 26 fa Star r1
282 E> 0x3d2217ca0107 @ 25 : 56 fa 02 01 02 CallAnyReceiver r1, <this>-<this>, [2]
0x3d2217ca010c @ 30 : 0d LdaUndefined
296 S> 0x3d2217ca010d @ 31 : a9 Return
Constant pool (size = 2)
0x3d2217ca0099: [FixedArray] in OldSpace
- map: 0x32e5d12c0789 <Map>
- length: 2
0: 0x32e5d12c4991 <Symbol: (home_object_symbol)>
1: 0x32e5d12c4669 <String[#8]: toString>
Handler Table (size = 0)
[generated bytecode for function: toString]
Parameter count 1
Register count 1
Frame size 8
82 E> 0x3d2217ca026e @ 0 : a5 StackCheck
91 S> 0x3d2217ca026f @ 1 : 12 00 LdaConstant [0]
0x3d2217ca0271 @ 3 : 26 fb Star r0
109 E> 0x3d2217ca0273 @ 5 : 28 02 01 00 LdaNamedProperty <this>, [1], [0]
102 E> 0x3d2217ca0277 @ 9 : 34 fb 02 Add r0, [2]
0x3d2217ca027a @ 12 : 26 fb Star r0
0x3d2217ca027c @ 14 : 12 02 LdaConstant [2]
111 E> 0x3d2217ca027e @ 16 : 34 fb 03 Add r0, [3]
0x3d2217ca0281 @ 19 : 26 fb Star r0
125 E> 0x3d2217ca0283 @ 21 : 28 02 03 04 LdaNamedProperty <this>, [3], [4]
118 E> 0x3d2217ca0287 @ 25 : 34 fb 06 Add r0, [6]
0x3d2217ca028a @ 28 : 26 fb Star r0
0x3d2217ca028c @ 30 : 12 04 LdaConstant [4]
127 E> 0x3d2217ca028e @ 32 : 34 fb 07 Add r0, [7]
133 S> 0x3d2217ca0291 @ 35 : a9 Return
Constant pool (size = 5)
0x3d2217ca0201: [FixedArray] in OldSpace
- map: 0x32e5d12c0789 <Map>
- length: 5
0: 0x3d2217ca0149 <String[#1]: (>
1: 0x3d2217c9f6c9 <String[#1]: x>
2: 0x3d2217ca0161 <String[#2]: , >
3: 0x3d2217c9f6e1 <String[#1]: y>
4: 0x3d2217ca0179 <String[#1]: )>
Handler Table (size = 0)
DebugPrint: 0x3beabb40b981: [Function]
- map: 0x05170d7446c1 <Map(HOLEY_ELEMENTS)> [FastProperties]
- prototype: 0x3d2217c82091 <JSFunction (sfi = 0x195b0108081)>
- elements: 0x32e5d12c0bf9 <FixedArray[0]> [HOLEY_ELEMENTS]
- function prototype: <no-prototype-slot>
- shared_info: 0x3d2217c9f9b1 <SharedFunctionInfo superPropertyCall>
- name: 0x3d2217c9f719 <String[#17]: superPropertyCall>
- formal_parameter_count: 0
- safe_to_skip_arguments_adaptor
- kind: ConciseMethod
- context: 0x3beabb40b911 <BlockContext[4]>
- code: 0x00bf6e5043a1 <Code BUILTIN InterpreterEntryTrampoline>
- interpreted
- bytecode: 0x3d2217ca00b9 <BytecodeArray[32]>
- source code: () {
super.toString();
}
- properties: 0x32e5d12c0bf9 <FixedArray[0]> {
#length: 0x0195b0100491 <AccessorInfo> (const accessor descriptor)
#name: 0x0195b0100421 <AccessorInfo> (const accessor descriptor)
0x32e5d12c4991 <Symbol: (home_object_symbol)>: 0x3beabb40b9c1 <ColorPoint map = 0x5170d74a841> (data field 0)
}
- feedback vector: not available
0x5170d7446c1: [Map]
- type: JS_FUNCTION_TYPE
- instance size: 64
- inobject properties: 1
- elements kind: HOLEY_ELEMENTS
- unused property fields: 0
- enum length: invalid
- callable
- back pointer: 0x32e5d12c04a9 <undefined>
- prototype_validity cell: 0x0195b01005e1 <Cell value= 1>
- instance descriptors (own) #3: 0x3d2217c9a6a1 <DescriptorArray[3]>
- layout descriptor: (nil)
- prototype: 0x3d2217c82091 <JSFunction (sfi = 0x195b0108081)>
- constructor: 0x32e5d12c01b1 <null>
- dependent code: 0x32e5d12c0299 <Other heap object (WEAK_FIXED_ARRAY_TYPE)>
- construction counter: 0
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toString() {
return "(" + this.x + ", " + this.y + ")";
}
}
class ColorPoint extends Point {
constructor(x, y, color) {
super(x, y);
this.color = color;
}
superPropertyCall() {
super.toString();
}
}
let cp = new ColorPoint(25, 8, "green"); // (25, 8) in green
cp.superPropertyCall(); // Collecting the feedback ?
%DebugPrint(cp.superPropertyCall);
cp.superPropertyCall();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment