SlideShare a Scribd company logo
1 of 49
Download to read offline
Implementing one feature set
in two JavaScript engines
Caio Lima & Joyee Cheung
Igalia & Bloomberg
1
Overview of the class features
ES6
- Public class methods (instance & static)
3 follow-up proposals
- Class instance fields: https://tc39.es/proposal-class-fields/
- Public fields
- Private fields
- Private methods & accessors: https://tc39.es/proposal-private-methods/
- Static class features: https://tc39.es/proposal-static-class-features/
- Static public fields
- Static private fields
- Static private methods & accessors
2
Overview of the class features
- The class features entered Stage 3 in July 2017
- Stage 3 is when
- TC39 settles down the design of language features
- JavaScript engines start implementing language features, giving feedback to
TC39, and shipping the implementation
- https://tc39.es/process-document/
- Thanks Bloomberg for sponsoring Igalia’s work!
- Implementing the 3 proposals in JavaScriptCore
- Implementing private methods (instance and static) as well as improving other
class features in V8
3
Public fields
let i = 0;
function count() {
return i++;
}
class C {
field = count();
}
(new C).field; // returns 0
(new C).field; //returns 1
- Instance fields are defined during object construction.
- The initializer is executed every time a new object is
instantiated.
4
Private fields
class C {
#field = 1;
access() {
return this.#field;
}
}
(new C).access(); // returns 1
(new C).access.call({}); // TypeError
- Private fields are not common JS properties.
- When a private field is not present, we throw
an TypeError.
- They don’t have a property descriptor.
- They are only visible inside the scope of a class.
5
Private fields
class C {
#field = 1;
access() {
return this.#field;
}
}
(new C).access(); // returns 1
(new C).access.call({}); // TypeError
class D {
#field = 1;
// ...
}
- Private fields are not common JS properties.
- When a private field is not present, we throw
an TypeError.
- They don’t have a property descriptor.
- They are only visible inside the scope of a class.
- Every new evaluation of a class creates a new
private name.
6
Private methods & static fields
class C {
#method() {
return “I am instance”
};
static #staticMethod() {
return “I am Static”;
}
}
class C {
static field = 1;
static #field;
}
C.field; // returns 1
7
What to change in the engines
Parser
Scope
Analysis
Bytecode
generator
Interpreter
JIT
Compiler
Runtime
Source Text
Variables,
scopes
AST
Analyzed
variables
and scopes
Bytecode
Compiled
code
8
What to change in the engines
Parser
Scope
Analysis
Bytecode
generator
Interpreter
JIT
Compiler
Runtime
Source Text
Variables,
scopes
AST
Analyzed
variables
and scopes
Bytecode
Compiled
code
9
What to change in the engines: parser
- Support new production “#identifier”
- Easy: both JSC and V8 use recursive descent parsers
- Add new AST nodes for the bytecode generator to visit later
10
What to change in the engines
Parser
Scope
Analysis
Bytecode
generator
Interpreter
JIT
Compiler
Runtime
Source Text
Variables,
scopes
AST
Analyzed
variables
and scopes
Bytecode
Compiled
code
11
What to change in the engines: scope analysis
- Specialize the resolution of private names to identify usage of undeclared
fields whenever we finish parsing a class literal
- Add additional fields to the variables to carry information about the kind of
property access
- In V8: rewrote the scope analysis of class scopes
class C {
#field = 1;
method() { this.#filed = 2; } // typo: SyntaxError
}
class C {
#duplicateField = 1;
#duplicateField = 2; // SyntaxError
} 12
What to change in the engines: scope analysis
- With lazy parsing, errors are identified and the variables are serialized in the
pre-parsing.
- Deserialize variables when generating the bytecode
class C {
#field = 1; // Serialized
getField() { this.#field; /* Deserialized */ }
}
(new C).getField(); // Triggers bytecode generation of getField
13
What to change in the engines
Parser
Scope
Analysis
Bytecode
generator
Interpreter
JIT
Compiler
Runtime
Source Text
Variables,
scopes
AST
Analyzed
variables
and scopes
Bytecode
Compiled
code
14
What to change in the engines: bytecode generator
- Generate bytecode for these new features
- Change the bytecode emitted for
- Class evaluation
- Class constructors
- Property access
15
What to change in the engines
Parser
Scope
Analysis
Bytecode
generator
Interpreter
JIT
Compiler
Runtime
Source Text
Variables,
scopes
AST
Analyzed
variables
and scopes
Bytecode
Compiled
code
16
What to change in the engines: interpreter
- Add new handlers for new operations added for the features, if any.
- JSC added a new `get_by_val_direct` instruction.
17
What to change in the engines
Parser
Scope
Analysis
Bytecode
generator
Interpreter
JIT
Compiler
Runtime
Source Text
Variables,
scopes
AST
Analyzed
variables
and scopes
Bytecode
Compiled
code
18
What to change in the engines: runtime
- Runtime: property lookup is desugared to static lexical lookups
- Special path to lookup private symbols (different semantics)
- Methods and accessors need to validate if receiver has the correct brand
- Static: validate the receivers and change where things are installed
19
Bytecode generated for instance private fields
During class evaluation
V8
CallRuntime [CreatePrivateNameSymbol] // #instanceField
StaCurrentContextSlot [4] // known index to a fixed array
...
CreateClosure // instance_members_initializer
// Store instance_members_initializer in the class
StaNamedProperty <class_constructor> ...
class C {
#instanceField = 1;
}
20
Bytecode generated for instance private fields
During class evaluation
JSC
create_lexical_environment loc4, ...
...
call loc12, “@createPrivateSymbol”
put_to_scope loc4, “#instanceField”, loc12
new_fuc_exp loc13, ...
put_by_id <C>, “@instanceFieldInitializer”, loc13
...
class C {
#instanceField = 1;
}
21
Bytecode generated for instance private fields
In the constructor
V8
// In the class C constructor
LdaNamedProperty // load instance_members_initializer
CallProperty0 // run instance_members_initializer
// In instance_members_initializer
LdaCurrentContextSlot [4] // Load the #instanceField symbol from the context
Star r1
LdaSmi [1]
Star r2
Mov <this>, r0
CallRuntime [AddPrivateField], r0-r2 // Define this.#instanceField as 1
class C {
#instanceField = 1;
}
22
Bytecode generated for instance private fields
In the constructor
JSC
// In the C constructor
get_by_id_direct loc7, callee, “@instanceFieldInitializer”
mov loc8, this
call loc9, loc7, 1
ret this
//In the “@instanceFieldInitializer”
mov loc6, Int32: 1
resolve_scope loc7, loc4, “#inscanteField”
get_from_scope loc8, loc7, “#inscanteField”
put_by_val_direct this, loc8, loc6, PrivateName|ThrowIfExists
ret Undefined(const1)
class C {
#instanceField = 1;
}
23
Bytecode generated for instance private fields
When evaluating getInstanceField()
V8
LdaCurrentContextSlot [4] // Load the private symbol
LdaKeyedProperty <this>, [0] // Error in the IC if the field does not exist
class C {
#instanceField = 1;
getInstanceField() { return this.#instanceField; }
}
24
Bytecode generated for instance private fields
When evaluating getInstanceField()
JSC
resolve_scope loc7, loc4, “#instanceField”
get_from_scope loc8, loc7, “#instanceField” // get PrivateSymbol
get_by_val_direct loc6, this, loc8
ret loc6
class C {
#instanceField = 1;
getInstanceField() { return this.#instanceField; }
}
25
Other class features
- Private methods are shared among the instances, the validation of the receiver
is guarded by a per-class special symbol property (the “brand”).
- Static features are implemented similarly to instance features, but handled
during class evaluation time.
26
Implementation status
- Class Fields
- Chrome: Shipped full implementation in 74 (23 April 2019).
- WebKit: In progress (link).
- Private Methods & accessors
- Chrome: Fully implemented behind --harmony-private-methods on master (link).
- WebKit: In progress (methods and accessors).
- Static features
- Chrome: Static class fields shipped in 74, static private methods are fully
implemented behind --harmony-private-methods on master (link).
- WebKit: In progress (link).
27
Implementation status
Spec issues discovered during implementation
- https://github.com/tc39/proposal-class-fields/issues/263
- https://github.com/tc39/proposal-private-methods/issues/69
28
Test262 status
- Already complete (last PR from 30 August 2019).
- Total of 6325 new tests.
29
Questions?
30
Desugaring public fields (incorrect, just conceptual)
class C {
field = 1;
}
class C {
constructor() {
Object.defineProperty(this, ‘field’, {value: 1});
}
}
31
Desugaring private fields (incorrect, just conceptual)
class C {
#field = 1;
getField() { return this.#field; }
}
class C {
// Imagine it's possible to declare a fieldSymbol here.
constructor() {
Object.defineProperty(this, fieldSymbol, {value: 1});
}
getField() { return this[fieldSymbol]; }
}
32
Desugaring private methods (incorrect, just conceptual)
class C {
#method() { }
runMethod() { this.#method(); }
}
class C {
// Imagine it's possible to declare a brandSymbol and a <method>() here.
constructor() { Object.defineProperty(this, brandSymbol, {value: /*?*/}); }
runMethod() {
if (!(brandSymbol in this)) { throw TypeError('...'); }
<method>.call(this);
}
}
33
Desugaring static methods and fields (incorrect)
class C {
static #method() { }
static #field = 1;
static runMethod() { this.#method(); }
}
// Imagine it's possible to declare a brandSymbol and a <method>() here.
Object.defineProperty(C, brandSymbol, {value: /*?*/});
Object.defineProperty(C, fieldSymbol, {value: 1});
C.runMethod = function() {
if (!(brandSymbol in this)) { throw TypeError('...'); }
<method>.call(this);
}
34
Bytecode generated for instance private methods
During class evaluation
V8
CallRuntime [CreatePrivateNameSymbol] // brand symbol
StaCurrentContextSlot [5]
......
...
// Create the private method
CreateClosure
StaCurrentContextSlot [4]
class C {
#instanceMethod() {}
}
35
Bytecode generated for instance private methods
During class evaluation
JSC
create_lexical_environment loc9, loc4
...
call loc13, “@createPrivateSymbol”
put_to_scope loc4, “@privateBrand”, loc13
new_func_exp loc12, loc4, ...
put_by_id loc12, “@homeObject”, loc11
put_to_scope loc4, “#inscanceMethod”, loc12
class C {
#instanceMethod() {}
}
36
Bytecode generated for instance private methods
In the constructor
V8
LdaCurrentContextSlot [5] // brand symbol
Star r1
Mov <this>, r0
CallRuntime [AddPrivateBrand], r0-r1
class C {
#instanceMethod() {}
}
37
Bytecode generated for instance private methods
In the constructor
JSC
resolve_scope loc7, loc4, “@privateBrand”
get_from_scope loc8, loc7, “@privateBrand”
put_by_val_direct this, loc8, loc8, PrivateName|ThrowIfExists
ret this
class C {
#instanceMethod() {}
}
38
Bytecode generated for instance private methods
When evaluating runInstanceMethod()
V8
LdaCurrentContextSlot [5] // Load the brand symbol
LdaKeyedProperty <this>, [0] // brand check - errors if it does not exist
LdaCurrentContextSlot [4] // Load the method
Star r0
CallAnyReceiver r0, <this>-<this>, [2]
class C {
#instanceMethod() {};
runInstanceMethod() { this.#instanceMethod(); }
}
39
Bytecode generated for instance private methods
When evaluating runInstanceMethod()
JSC
mov loc8, this
resolve_scope loc9, loc4, “#instanceMethod”
get_from_scope loc10, loc9, “@privateBrand”
get_by_val_direct loc10, loc8, loc10 // Brand Check
get_from_scope loc6, loc9, “#instanceMethod”
call loc6, loc6, 1
...
class C {
#instanceMethod() {};
runInstanceMethod() { this.#instanceMethod(); }
}
40
Brand checking saves memory
class C {
constructor() { Object.defineProperty(this, brandSymbol, {value: /*?*/}); }
runMethod() {
if (!(brandSymbol in this)) { throw TypeError('...'); }
<methodA>.call(this);
<methodB>.call(this);
}
}
41
Brand checking saves memory
class C {
constructor() {
Object.defineProperty(this, methodASymbol, {value: <methodA>, ...});
Object.defineProperty(this, methodBSymbol, {value: <methodB>, ...});
// More symbols and references in proportion to the number of private methods
}
runMethod() {
this[methodASymbol]();
this[methodBSymbol]();
}
}
42
Bytecode generated for static private methods
During class evaluation
V8
// During class evaluation
CreateClosure
StaCurrentContextSlot [4]
class C {
static #staticMethod() {}
static runStaticMethod() { this.#staticMethod(); }
}
43
Bytecode generated for static private methods
When evaluating runStaticMethod()
V8
LdaCurrentContextSlot [5] // Load the class that declares the static method
TestReferenceEqual <this> // Make sure the receiver is the class
Mov <this>, r1
JumpIfTrue
LdaSmi.Wide
Star r2
LdaConstant [0]
Star r3
CallRuntime [NewTypeError], r2-r3
Throw
LdaCurrentContextSlot [4] // Where JumpIfTrue jumps to: load the static method
Star r0
CallAnyReceiver r0, r1-r1, [0]
class C {
static #staticMethod() {}
static runStaticMethod() { this.#staticMethod(); }
}
44
Bytecode generated for static private methods
JSC
create_lexical_environment loc9, loc4
call loc13, “@createPrivateSymbol”
put_to_scope loc4, “@privateStaticBrand”, loc13
new_func_exp loc12, loc4, 1
put_by_id loc12, “@homeObject”, loc11,
put_to_scope loc4, “#staticMethod”, loc12
...
resolve_scope loc7, loc4, “@privateStaticBrand”
get_from_scope loc8, loc7, “@privateStaticBrand”
put_by_val_direct <C>, loc8, loc8, PrivateName|ThrowIfExists
class C {
static #staticMethod() {}
static runStaticMethod() { this.#staticMethod(); }
}
45
Bytecode generated for private accessors
- Similar to private methods, guarded by brand checks
- Complementary accessors are stored in AccessorPairs in V8, but
separately in JSC
- Generate TypeError statically for incorrect usage to read-only or
write-only private accessors
class C {
get #value() { }
set #value(val) { }
inc() { return this.#value++; }
}
46
Bytecode generated for static public fields
- Defined in static field initializers in V8 and accessed as usual
- Inlined in the class evaluation in JSC
class C {
static publicField = 1;
static publicMethod() { return this.publicField; }
}
C.publicMethod();
47
Bytecode generated for static private fields
V8
// During class evaluation
// Create the #staticField symbol
CallRuntime [CreatePrivateNameSymbol]
StaCurrentContextSlot [4]
...
CreateClosure // static_fields_initializer
CallProperty0 // calls static_fields_initializer on the class
// In the static_fields_initializer
LdaCurrentContextSlot [4] // Load the #staticField symbol
Star r1
LdaSmi [1]
Star r2
Mov <this>, r0
CallRuntime [AddPrivateField], r0-r2 // Define C.#staticField as 1
class C {
static #staticField = 1;
static getStaticField() { return this.#staticField; }
}
48
Bytecode generated for static private fields
JSC
create_lexical_environment loc4, ...
...
call loc12, “@createPrivateSymbol”
put_to_scope loc4, “#instanceField”, loc12
...
mov loc6, Int32: 1
resolve_scope loc7, loc4, “#inscanteField”
get_from_scope loc8, loc7, “#inscanteField”
put_by_val_direct <C>, loc8, loc6, ...
class C {
static #staticField = 1;
static getStaticField() { return
this.#staticField; }
}
49

More Related Content

What's hot

JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJavaDayUA
 
(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_ii(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_iiNico Ludwig
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to ScalaRiccardo Cardin
 
Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)MoonSheikh1
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvmTao He
 
Java moderno java para Jedis episodio I
Java moderno  java para  Jedis  episodio IJava moderno  java para  Jedis  episodio I
Java moderno java para Jedis episodio IRoan Brasil Monteiro
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationWei-Ren Chen
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklChristoph Pickl
 
Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)Mohamed Saleh
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructorsVineeta Garg
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924yohanbeschi
 
Lambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian GoetzLambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian GoetzJAX London
 
Better Code: Concurrency
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: ConcurrencyPlatonov Sergey
 
Unit 5 quesn b ans5
Unit 5 quesn b ans5Unit 5 quesn b ans5
Unit 5 quesn b ans5Sowri Rajan
 
CORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialCORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialRemedy IT
 
Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Remedy IT
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For SyntaxPravinYalameli
 

What's hot (20)

Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java Platform
 
(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_ii(7) cpp abstractions inheritance_part_ii
(7) cpp abstractions inheritance_part_ii
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to Scala
 
Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvm
 
Java moderno java para Jedis episodio I
Java moderno  java para  Jedis  episodio IJava moderno  java para  Jedis  episodio I
Java moderno java para Jedis episodio I
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph Pickl
 
Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)Module 2: C# 3.0 Language Enhancements (Material)
Module 2: C# 3.0 Language Enhancements (Material)
 
Spring IO 2015 Spock Workshop
Spring IO 2015 Spock WorkshopSpring IO 2015 Spock Workshop
Spring IO 2015 Spock Workshop
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
Lambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian GoetzLambda: A Peek Under The Hood - Brian Goetz
Lambda: A Peek Under The Hood - Brian Goetz
 
Better Code: Concurrency
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: Concurrency
 
Unit 5 quesn b ans5
Unit 5 quesn b ans5Unit 5 quesn b ans5
Unit 5 quesn b ans5
 
CORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialCORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorial
 
Java SE 8 library design
Java SE 8 library designJava SE 8 library design
Java SE 8 library design
 
Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
 

Similar to Implementing one feature set in two JavaScript engines (Web Engines Hackfest 2019)

Csharp4 objects and_types
Csharp4 objects and_typesCsharp4 objects and_types
Csharp4 objects and_typesAbed Bukhari
 
How Does Kubernetes Build OpenAPI Specifications?
How Does Kubernetes Build OpenAPI Specifications?How Does Kubernetes Build OpenAPI Specifications?
How Does Kubernetes Build OpenAPI Specifications?reallavalamp
 
EA User Group London 2018 - Extending EA with custom scripts to cater for spe...
EA User Group London 2018 - Extending EA with custom scripts to cater for spe...EA User Group London 2018 - Extending EA with custom scripts to cater for spe...
EA User Group London 2018 - Extending EA with custom scripts to cater for spe...Guillaume Finance
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UITech OneStop
 
Java programming concept
Java programming conceptJava programming concept
Java programming conceptSanjay Gunjal
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile DevelopmentJan Rybák Benetka
 
Daggerate your code - Write your own annotation processor
Daggerate your code - Write your own annotation processorDaggerate your code - Write your own annotation processor
Daggerate your code - Write your own annotation processorBartosz Kosarzycki
 
Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder paramisoft
 
Discover Tasty Query: The library for Scala program analysis
Discover Tasty Query: The library for Scala program analysisDiscover Tasty Query: The library for Scala program analysis
Discover Tasty Query: The library for Scala program analysisJames Thompson
 
Java căn bản - Chapter4
Java căn bản - Chapter4Java căn bản - Chapter4
Java căn bản - Chapter4Vince Vo
 
Chapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part IChapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part IEduardo Bergavera
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsakreyi
 
Yaml as Pipeline GSoC 218 Phase 2 evaluation
Yaml as Pipeline GSoC 218 Phase 2 evaluationYaml as Pipeline GSoC 218 Phase 2 evaluation
Yaml as Pipeline GSoC 218 Phase 2 evaluationAbhishek Gautam
 
Learning C++ - Class 4
Learning C++ - Class 4Learning C++ - Class 4
Learning C++ - Class 4Ali Aminian
 
Context and Dependency Injection
Context and Dependency InjectionContext and Dependency Injection
Context and Dependency InjectionWerner Keil
 
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019Paulo Clavijo
 
Writing code that writes code - Nguyen Luong
Writing code that writes code - Nguyen LuongWriting code that writes code - Nguyen Luong
Writing code that writes code - Nguyen LuongVu Huy
 
TechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
TechkTalk #12 Grokking: Writing code that writes code – Nguyen LuongTechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
TechkTalk #12 Grokking: Writing code that writes code – Nguyen LuongGrokking VN
 

Similar to Implementing one feature set in two JavaScript engines (Web Engines Hackfest 2019) (20)

Csharp4 objects and_types
Csharp4 objects and_typesCsharp4 objects and_types
Csharp4 objects and_types
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
How Does Kubernetes Build OpenAPI Specifications?
How Does Kubernetes Build OpenAPI Specifications?How Does Kubernetes Build OpenAPI Specifications?
How Does Kubernetes Build OpenAPI Specifications?
 
EA User Group London 2018 - Extending EA with custom scripts to cater for spe...
EA User Group London 2018 - Extending EA with custom scripts to cater for spe...EA User Group London 2018 - Extending EA with custom scripts to cater for spe...
EA User Group London 2018 - Extending EA with custom scripts to cater for spe...
 
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
 
Daggerate your code - Write your own annotation processor
Daggerate your code - Write your own annotation processorDaggerate your code - Write your own annotation processor
Daggerate your code - Write your own annotation processor
 
Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder
 
Discover Tasty Query: The library for Scala program analysis
Discover Tasty Query: The library for Scala program analysisDiscover Tasty Query: The library for Scala program analysis
Discover Tasty Query: The library for Scala program analysis
 
Java căn bản - Chapter4
Java căn bản - Chapter4Java căn bản - Chapter4
Java căn bản - Chapter4
 
Chapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part IChapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part I
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
Yaml as Pipeline GSoC 218 Phase 2 evaluation
Yaml as Pipeline GSoC 218 Phase 2 evaluationYaml as Pipeline GSoC 218 Phase 2 evaluation
Yaml as Pipeline GSoC 218 Phase 2 evaluation
 
Learning C++ - Class 4
Learning C++ - Class 4Learning C++ - Class 4
Learning C++ - Class 4
 
Context and Dependency Injection
Context and Dependency InjectionContext and Dependency Injection
Context and Dependency Injection
 
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
 
Writing code that writes code - Nguyen Luong
Writing code that writes code - Nguyen LuongWriting code that writes code - Nguyen Luong
Writing code that writes code - Nguyen Luong
 
TechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
TechkTalk #12 Grokking: Writing code that writes code – Nguyen LuongTechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
TechkTalk #12 Grokking: Writing code that writes code – Nguyen Luong
 

More from Igalia

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEIgalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesIgalia
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceIgalia
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfIgalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!Igalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 

More from Igalia (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 

Recently uploaded

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Implementing one feature set in two JavaScript engines (Web Engines Hackfest 2019)

  • 1. Implementing one feature set in two JavaScript engines Caio Lima & Joyee Cheung Igalia & Bloomberg 1
  • 2. Overview of the class features ES6 - Public class methods (instance & static) 3 follow-up proposals - Class instance fields: https://tc39.es/proposal-class-fields/ - Public fields - Private fields - Private methods & accessors: https://tc39.es/proposal-private-methods/ - Static class features: https://tc39.es/proposal-static-class-features/ - Static public fields - Static private fields - Static private methods & accessors 2
  • 3. Overview of the class features - The class features entered Stage 3 in July 2017 - Stage 3 is when - TC39 settles down the design of language features - JavaScript engines start implementing language features, giving feedback to TC39, and shipping the implementation - https://tc39.es/process-document/ - Thanks Bloomberg for sponsoring Igalia’s work! - Implementing the 3 proposals in JavaScriptCore - Implementing private methods (instance and static) as well as improving other class features in V8 3
  • 4. Public fields let i = 0; function count() { return i++; } class C { field = count(); } (new C).field; // returns 0 (new C).field; //returns 1 - Instance fields are defined during object construction. - The initializer is executed every time a new object is instantiated. 4
  • 5. Private fields class C { #field = 1; access() { return this.#field; } } (new C).access(); // returns 1 (new C).access.call({}); // TypeError - Private fields are not common JS properties. - When a private field is not present, we throw an TypeError. - They don’t have a property descriptor. - They are only visible inside the scope of a class. 5
  • 6. Private fields class C { #field = 1; access() { return this.#field; } } (new C).access(); // returns 1 (new C).access.call({}); // TypeError class D { #field = 1; // ... } - Private fields are not common JS properties. - When a private field is not present, we throw an TypeError. - They don’t have a property descriptor. - They are only visible inside the scope of a class. - Every new evaluation of a class creates a new private name. 6
  • 7. Private methods & static fields class C { #method() { return “I am instance” }; static #staticMethod() { return “I am Static”; } } class C { static field = 1; static #field; } C.field; // returns 1 7
  • 8. What to change in the engines Parser Scope Analysis Bytecode generator Interpreter JIT Compiler Runtime Source Text Variables, scopes AST Analyzed variables and scopes Bytecode Compiled code 8
  • 9. What to change in the engines Parser Scope Analysis Bytecode generator Interpreter JIT Compiler Runtime Source Text Variables, scopes AST Analyzed variables and scopes Bytecode Compiled code 9
  • 10. What to change in the engines: parser - Support new production “#identifier” - Easy: both JSC and V8 use recursive descent parsers - Add new AST nodes for the bytecode generator to visit later 10
  • 11. What to change in the engines Parser Scope Analysis Bytecode generator Interpreter JIT Compiler Runtime Source Text Variables, scopes AST Analyzed variables and scopes Bytecode Compiled code 11
  • 12. What to change in the engines: scope analysis - Specialize the resolution of private names to identify usage of undeclared fields whenever we finish parsing a class literal - Add additional fields to the variables to carry information about the kind of property access - In V8: rewrote the scope analysis of class scopes class C { #field = 1; method() { this.#filed = 2; } // typo: SyntaxError } class C { #duplicateField = 1; #duplicateField = 2; // SyntaxError } 12
  • 13. What to change in the engines: scope analysis - With lazy parsing, errors are identified and the variables are serialized in the pre-parsing. - Deserialize variables when generating the bytecode class C { #field = 1; // Serialized getField() { this.#field; /* Deserialized */ } } (new C).getField(); // Triggers bytecode generation of getField 13
  • 14. What to change in the engines Parser Scope Analysis Bytecode generator Interpreter JIT Compiler Runtime Source Text Variables, scopes AST Analyzed variables and scopes Bytecode Compiled code 14
  • 15. What to change in the engines: bytecode generator - Generate bytecode for these new features - Change the bytecode emitted for - Class evaluation - Class constructors - Property access 15
  • 16. What to change in the engines Parser Scope Analysis Bytecode generator Interpreter JIT Compiler Runtime Source Text Variables, scopes AST Analyzed variables and scopes Bytecode Compiled code 16
  • 17. What to change in the engines: interpreter - Add new handlers for new operations added for the features, if any. - JSC added a new `get_by_val_direct` instruction. 17
  • 18. What to change in the engines Parser Scope Analysis Bytecode generator Interpreter JIT Compiler Runtime Source Text Variables, scopes AST Analyzed variables and scopes Bytecode Compiled code 18
  • 19. What to change in the engines: runtime - Runtime: property lookup is desugared to static lexical lookups - Special path to lookup private symbols (different semantics) - Methods and accessors need to validate if receiver has the correct brand - Static: validate the receivers and change where things are installed 19
  • 20. Bytecode generated for instance private fields During class evaluation V8 CallRuntime [CreatePrivateNameSymbol] // #instanceField StaCurrentContextSlot [4] // known index to a fixed array ... CreateClosure // instance_members_initializer // Store instance_members_initializer in the class StaNamedProperty <class_constructor> ... class C { #instanceField = 1; } 20
  • 21. Bytecode generated for instance private fields During class evaluation JSC create_lexical_environment loc4, ... ... call loc12, “@createPrivateSymbol” put_to_scope loc4, “#instanceField”, loc12 new_fuc_exp loc13, ... put_by_id <C>, “@instanceFieldInitializer”, loc13 ... class C { #instanceField = 1; } 21
  • 22. Bytecode generated for instance private fields In the constructor V8 // In the class C constructor LdaNamedProperty // load instance_members_initializer CallProperty0 // run instance_members_initializer // In instance_members_initializer LdaCurrentContextSlot [4] // Load the #instanceField symbol from the context Star r1 LdaSmi [1] Star r2 Mov <this>, r0 CallRuntime [AddPrivateField], r0-r2 // Define this.#instanceField as 1 class C { #instanceField = 1; } 22
  • 23. Bytecode generated for instance private fields In the constructor JSC // In the C constructor get_by_id_direct loc7, callee, “@instanceFieldInitializer” mov loc8, this call loc9, loc7, 1 ret this //In the “@instanceFieldInitializer” mov loc6, Int32: 1 resolve_scope loc7, loc4, “#inscanteField” get_from_scope loc8, loc7, “#inscanteField” put_by_val_direct this, loc8, loc6, PrivateName|ThrowIfExists ret Undefined(const1) class C { #instanceField = 1; } 23
  • 24. Bytecode generated for instance private fields When evaluating getInstanceField() V8 LdaCurrentContextSlot [4] // Load the private symbol LdaKeyedProperty <this>, [0] // Error in the IC if the field does not exist class C { #instanceField = 1; getInstanceField() { return this.#instanceField; } } 24
  • 25. Bytecode generated for instance private fields When evaluating getInstanceField() JSC resolve_scope loc7, loc4, “#instanceField” get_from_scope loc8, loc7, “#instanceField” // get PrivateSymbol get_by_val_direct loc6, this, loc8 ret loc6 class C { #instanceField = 1; getInstanceField() { return this.#instanceField; } } 25
  • 26. Other class features - Private methods are shared among the instances, the validation of the receiver is guarded by a per-class special symbol property (the “brand”). - Static features are implemented similarly to instance features, but handled during class evaluation time. 26
  • 27. Implementation status - Class Fields - Chrome: Shipped full implementation in 74 (23 April 2019). - WebKit: In progress (link). - Private Methods & accessors - Chrome: Fully implemented behind --harmony-private-methods on master (link). - WebKit: In progress (methods and accessors). - Static features - Chrome: Static class fields shipped in 74, static private methods are fully implemented behind --harmony-private-methods on master (link). - WebKit: In progress (link). 27
  • 28. Implementation status Spec issues discovered during implementation - https://github.com/tc39/proposal-class-fields/issues/263 - https://github.com/tc39/proposal-private-methods/issues/69 28
  • 29. Test262 status - Already complete (last PR from 30 August 2019). - Total of 6325 new tests. 29
  • 31. Desugaring public fields (incorrect, just conceptual) class C { field = 1; } class C { constructor() { Object.defineProperty(this, ‘field’, {value: 1}); } } 31
  • 32. Desugaring private fields (incorrect, just conceptual) class C { #field = 1; getField() { return this.#field; } } class C { // Imagine it's possible to declare a fieldSymbol here. constructor() { Object.defineProperty(this, fieldSymbol, {value: 1}); } getField() { return this[fieldSymbol]; } } 32
  • 33. Desugaring private methods (incorrect, just conceptual) class C { #method() { } runMethod() { this.#method(); } } class C { // Imagine it's possible to declare a brandSymbol and a <method>() here. constructor() { Object.defineProperty(this, brandSymbol, {value: /*?*/}); } runMethod() { if (!(brandSymbol in this)) { throw TypeError('...'); } <method>.call(this); } } 33
  • 34. Desugaring static methods and fields (incorrect) class C { static #method() { } static #field = 1; static runMethod() { this.#method(); } } // Imagine it's possible to declare a brandSymbol and a <method>() here. Object.defineProperty(C, brandSymbol, {value: /*?*/}); Object.defineProperty(C, fieldSymbol, {value: 1}); C.runMethod = function() { if (!(brandSymbol in this)) { throw TypeError('...'); } <method>.call(this); } 34
  • 35. Bytecode generated for instance private methods During class evaluation V8 CallRuntime [CreatePrivateNameSymbol] // brand symbol StaCurrentContextSlot [5] ...... ... // Create the private method CreateClosure StaCurrentContextSlot [4] class C { #instanceMethod() {} } 35
  • 36. Bytecode generated for instance private methods During class evaluation JSC create_lexical_environment loc9, loc4 ... call loc13, “@createPrivateSymbol” put_to_scope loc4, “@privateBrand”, loc13 new_func_exp loc12, loc4, ... put_by_id loc12, “@homeObject”, loc11 put_to_scope loc4, “#inscanceMethod”, loc12 class C { #instanceMethod() {} } 36
  • 37. Bytecode generated for instance private methods In the constructor V8 LdaCurrentContextSlot [5] // brand symbol Star r1 Mov <this>, r0 CallRuntime [AddPrivateBrand], r0-r1 class C { #instanceMethod() {} } 37
  • 38. Bytecode generated for instance private methods In the constructor JSC resolve_scope loc7, loc4, “@privateBrand” get_from_scope loc8, loc7, “@privateBrand” put_by_val_direct this, loc8, loc8, PrivateName|ThrowIfExists ret this class C { #instanceMethod() {} } 38
  • 39. Bytecode generated for instance private methods When evaluating runInstanceMethod() V8 LdaCurrentContextSlot [5] // Load the brand symbol LdaKeyedProperty <this>, [0] // brand check - errors if it does not exist LdaCurrentContextSlot [4] // Load the method Star r0 CallAnyReceiver r0, <this>-<this>, [2] class C { #instanceMethod() {}; runInstanceMethod() { this.#instanceMethod(); } } 39
  • 40. Bytecode generated for instance private methods When evaluating runInstanceMethod() JSC mov loc8, this resolve_scope loc9, loc4, “#instanceMethod” get_from_scope loc10, loc9, “@privateBrand” get_by_val_direct loc10, loc8, loc10 // Brand Check get_from_scope loc6, loc9, “#instanceMethod” call loc6, loc6, 1 ... class C { #instanceMethod() {}; runInstanceMethod() { this.#instanceMethod(); } } 40
  • 41. Brand checking saves memory class C { constructor() { Object.defineProperty(this, brandSymbol, {value: /*?*/}); } runMethod() { if (!(brandSymbol in this)) { throw TypeError('...'); } <methodA>.call(this); <methodB>.call(this); } } 41
  • 42. Brand checking saves memory class C { constructor() { Object.defineProperty(this, methodASymbol, {value: <methodA>, ...}); Object.defineProperty(this, methodBSymbol, {value: <methodB>, ...}); // More symbols and references in proportion to the number of private methods } runMethod() { this[methodASymbol](); this[methodBSymbol](); } } 42
  • 43. Bytecode generated for static private methods During class evaluation V8 // During class evaluation CreateClosure StaCurrentContextSlot [4] class C { static #staticMethod() {} static runStaticMethod() { this.#staticMethod(); } } 43
  • 44. Bytecode generated for static private methods When evaluating runStaticMethod() V8 LdaCurrentContextSlot [5] // Load the class that declares the static method TestReferenceEqual <this> // Make sure the receiver is the class Mov <this>, r1 JumpIfTrue LdaSmi.Wide Star r2 LdaConstant [0] Star r3 CallRuntime [NewTypeError], r2-r3 Throw LdaCurrentContextSlot [4] // Where JumpIfTrue jumps to: load the static method Star r0 CallAnyReceiver r0, r1-r1, [0] class C { static #staticMethod() {} static runStaticMethod() { this.#staticMethod(); } } 44
  • 45. Bytecode generated for static private methods JSC create_lexical_environment loc9, loc4 call loc13, “@createPrivateSymbol” put_to_scope loc4, “@privateStaticBrand”, loc13 new_func_exp loc12, loc4, 1 put_by_id loc12, “@homeObject”, loc11, put_to_scope loc4, “#staticMethod”, loc12 ... resolve_scope loc7, loc4, “@privateStaticBrand” get_from_scope loc8, loc7, “@privateStaticBrand” put_by_val_direct <C>, loc8, loc8, PrivateName|ThrowIfExists class C { static #staticMethod() {} static runStaticMethod() { this.#staticMethod(); } } 45
  • 46. Bytecode generated for private accessors - Similar to private methods, guarded by brand checks - Complementary accessors are stored in AccessorPairs in V8, but separately in JSC - Generate TypeError statically for incorrect usage to read-only or write-only private accessors class C { get #value() { } set #value(val) { } inc() { return this.#value++; } } 46
  • 47. Bytecode generated for static public fields - Defined in static field initializers in V8 and accessed as usual - Inlined in the class evaluation in JSC class C { static publicField = 1; static publicMethod() { return this.publicField; } } C.publicMethod(); 47
  • 48. Bytecode generated for static private fields V8 // During class evaluation // Create the #staticField symbol CallRuntime [CreatePrivateNameSymbol] StaCurrentContextSlot [4] ... CreateClosure // static_fields_initializer CallProperty0 // calls static_fields_initializer on the class // In the static_fields_initializer LdaCurrentContextSlot [4] // Load the #staticField symbol Star r1 LdaSmi [1] Star r2 Mov <this>, r0 CallRuntime [AddPrivateField], r0-r2 // Define C.#staticField as 1 class C { static #staticField = 1; static getStaticField() { return this.#staticField; } } 48
  • 49. Bytecode generated for static private fields JSC create_lexical_environment loc4, ... ... call loc12, “@createPrivateSymbol” put_to_scope loc4, “#instanceField”, loc12 ... mov loc6, Int32: 1 resolve_scope loc7, loc4, “#inscanteField” get_from_scope loc8, loc7, “#inscanteField” put_by_val_direct <C>, loc8, loc6, ... class C { static #staticField = 1; static getStaticField() { return this.#staticField; } } 49