Skip to content

Commit

Permalink
add more timers on object functions (#1775)
Browse files Browse the repository at this point in the history
```
+------------------------------------------------+-----------+-----------------+----------+------------+
| Item                                           | Self time | % of total time | Time     | Item count |
+------------------------------------------------+-----------+-----------------+----------+------------+
| run                                            | 14.27ms   | 15.545          | 161.26ms | 56         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__get_own_property__                   | 9.28ms    | 10.115          | 12.67ms  | 5412       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| LexicalEnvironment::get_binding_value          | 9.10ms    | 9.918           | 22.00ms  | 1066       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::validate_and_apply_property_descriptor | 6.12ms    | 6.669           | 6.12ms   | 677        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::ordinary_set                           | 4.07ms    | 4.434           | 39.14ms  | 818        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::ordinary_get_own_property              | 3.60ms    | 3.922           | 3.60ms   | 5720       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__call__                               | 3.22ms    | 3.505           | 103.95ms | 410        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::ordinary_define_own_property           | 3.10ms    | 3.379           | 10.90ms  | 677        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::ordinary_has_property                  | 2.95ms    | 3.209           | 7.17ms   | 1772       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__has_property__                       | 2.85ms    | 3.107           | 10.02ms  | 1772       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::ordinary_get                           | 2.85ms    | 3.104           | 8.14ms   | 1632       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__get__                                | 2.81ms    | 3.063           | 10.95ms  | 1632       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - GetName                                 | 2.56ms    | 2.789           | 24.56ms  | 1066       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__define_own_property__                | 2.48ms    | 2.704           | 13.58ms  | 521        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - SetName                                 | 1.81ms    | 1.972           | 9.52ms   | 202        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Call                                    | 1.35ms    | 1.473           | 103.28ms | 356        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__set__                                | 1.29ms    | 1.401           | 40.43ms  | 818        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - GetPropertyByName                       | 1.24ms    | 1.354           | 4.95ms   | 355        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Date                                           | 1.07ms    | 1.171           | 1.08ms   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__get_prototype_of__                   | 1.06ms    | 1.151           | 1.21ms   | 621        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - GetPropertyByValue                      | 1.05ms    | 1.143           | 1.91ms   | 154        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| create_intrinsics                              | 871.52µs  | 0.949           | 7.92ms   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Array                                          | 761.02µs  | 0.829           | 763.84µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Opcode retrieval                               | 756.35µs  | 0.824           | 756.35µs | 4941       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Math                                           | 750.16µs  | 0.817           | 753.72µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object                                         | 618.59µs  | 0.674           | 620.77µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| String                                         | 611.83µs  | 0.667           | 614.46µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| RegExp                                         | 419.63µs  | 0.457           | 421.09µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| next()                                         | 339.03µs  | 0.369           | 849.73µs | 96         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| console                                        | 332.59µs  | 0.362           | 334.02µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Identifier                                     | 318.53µs  | 0.347           | 337.39µs | 30         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - DefInitArg                              | 305.43µs  | 0.333           | 305.43µs | 54         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Reflect                                        | 265.70µs  | 0.289           | 267.45µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Dup                                     | 260.49µs  | 0.284           | 260.49µs | 555        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Number                                         | 225.72µs  | 0.246           | 305.09µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BigInt64Array                                  | 220.31µs  | 0.240           | 220.54µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Map                                            | 208.40µs  | 0.227           | 209.97µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PushInt8                                | 201.64µs  | 0.220           | 201.64µs | 402        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Set                                            | 196.16µs  | 0.214           | 197.64µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Pop                                     | 191.73µs  | 0.209           | 191.73µs | 455        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Symbol                                         | 186.95µs  | 0.204           | 188.13µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__is_extensible__                      | 159.01µs  | 0.173           | 159.01µs | 677        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - LessThan                                | 152.95µs  | 0.167           | 152.95µs | 202        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::ordinary_get_prototype_of              | 152.01µs  | 0.166           | 152.01µs | 621        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Main                                           | 150.58µs  | 0.164           | 82.11ms  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Inc                                     | 134.81µs  | 0.147           | 134.81µs | 200        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| AssignmentExpression                           | 113.77µs  | 0.124           | 4.08ms   | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - JumpIfFalse                             | 103.93µs  | 0.113           | 103.93µs | 202        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| function                                       | 103.75µs  | 0.113           | 104.33µs | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| MemberExpression                               | 97.28µs   | 0.106           | 2.30ms   | 26         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| make_builtin_fn: next                          | 94.48µs   | 0.103           | 100.99µs | 6          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| From<JsObject>                                 | 83.55µs   | 0.091           | 83.55µs  | 2582       |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Jump                                    | 83.45µs   | 0.091           | 83.45µs  | 202        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ArrayBuffer                                    | 82.91µs   | 0.090           | 84.38µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Realm::create                                  | 82.24µs   | 0.090           | 93.74µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BigInt                                         | 79.60µs   | 0.087           | 81.04µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| LeftHandSIdeExpression                         | 76.08µs   | 0.083           | 3.04ms   | 25         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| NumberLiteral                                  | 70.64µs   | 0.077           | 99.63µs  | 7          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| MultiplicativeExpression                       | 68.45µs   | 0.075           | 3.38ms   | 24         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Mul                                     | 66.50µs   | 0.072           | 66.50µs  | 100        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| StatementList                                  | 66.01µs   | 0.072           | 3.70ms   | 3          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - GreaterThan                             | 61.54µs   | 0.067           | 61.54µs  | 100        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - GetFunction                             | 52.91µs   | 0.058           | 175.00µs | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Float32Array                                   | 52.62µs   | 0.057           | 52.82µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| From<String>                                   | 50.52µs   | 0.055           | 50.52µs  | 431        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ExponentiationExpression                       | 48.15µs   | 0.052           | 3.31ms   | 25         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| PrimaryExpression                              | 47.01µs   | 0.051           | 1.82ms   | 25         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - LogicalAnd                              | 46.79µs   | 0.051           | 46.79µs  | 100        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Boolean                                        | 42.78µs   | 0.047           | 43.08µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Int8Array                                      | 41.96µs   | 0.046           | 42.18µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Float64Array                                   | 41.36µs   | 0.045           | 41.57µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BigUint64Array                                 | 41.12µs   | 0.045           | 41.34µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Uint16Array                                    | 40.82µs   | 0.044           | 41.03µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Uint8Array                                     | 40.68µs   | 0.044           | 40.89µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Uint32Array                                    | 40.61µs   | 0.044           | 40.81µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| JSON                                           | 40.59µs   | 0.044           | 41.73µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Int32Array                                     | 40.57µs   | 0.044           | 40.79µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Uint8ClampedArray                              | 40.47µs   | 0.044           | 40.69µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Int16Array                                     | 40.37µs   | 0.044           | 40.57µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BitwiseANDExpression                           | 39.90µs   | 0.043           | 3.56ms   | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Error                                          | 39.58µs   | 0.043           | 40.62µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| UpdateExpression                               | 39.50µs   | 0.043           | 3.08ms   | 25         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - RestParameterPop                        | 39.29µs   | 0.043           | 39.29µs  | 55         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Arguments                                      | 37.25µs   | 0.041           | 689.94µs | 7          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Relation Expression                            | 36.74µs   | 0.040           | 3.49ms   | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| AdditiveExpression                             | 36.23µs   | 0.039           | 3.42ms   | 24         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| SyntaxError                                    | 34.38µs   | 0.037           | 35.85µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ShiftExpression                                | 34.17µs   | 0.037           | 3.45ms   | 24         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ReferenceError                                 | 33.10µs   | 0.036           | 34.17µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| TypeError                                      | 32.79µs   | 0.036           | 33.79µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| EvalError                                      | 32.17µs   | 0.035           | 33.43µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| URIError                                       | 32.05µs   | 0.035           | 33.35µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ShortCircuitExpression                         | 32.02µs   | 0.035           | 3.65ms   | 20         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BitwiseORExpression                            | 30.85µs   | 0.034           | 3.62ms   | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| EqualityExpression                             | 30.82µs   | 0.034           | 3.52ms   | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BitwiseXORExpression                           | 30.80µs   | 0.034           | 3.59ms   | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ConditionalExpression                          | 29.84µs   | 0.033           | 3.68ms   | 20         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Operator                                       | 28.55µs   | 0.031           | 30.56µs  | 13         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ForStatement                                   | 28.09µs   | 0.031           | 1.18ms   | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Proxy                                          | 28.02µs   | 0.031           | 28.19µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::next_char()                            | 27.88µs   | 0.030           | 27.88µs  | 147        |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::next_is_ascii_pred()                   | 26.11µs   | 0.028           | 27.33µs  | 21         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| VariableStatement                              | 25.01µs   | 0.027           | 224.24µs | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Intl                                           | 23.92µs   | 0.026           | 24.90µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Statement                                      | 23.60µs   | 0.026           | 4.26ms   | 9          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| RangeError                                     | 23.47µs   | 0.026           | 24.56µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - DefInitVar                              | 20.60µs   | 0.022           | 49.41µs  | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Return                                  | 20.47µs   | 0.022           | 20.47µs  | 55         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Expression                                     | 20.13µs   | 0.022           | 3.27ms   | 13         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| CallExpression                                 | 19.32µs   | 0.021           | 714.52µs | 6          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| make_builtin_fn: parseInt                      | 19.31µs   | 0.021           | 20.46µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Iterator Prototype                             | 18.91µs   | 0.021           | 18.99µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| String Iterator                                | 18.66µs   | 0.020           | 37.92µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| make_builtin_fn: isNaN                         | 18.43µs   | 0.020           | 19.50µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| make_builtin_fn: parseFloat                    | 18.37µs   | 0.020           | 19.41µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| make_builtin_fn: isFinite                      | 18.11µs   | 0.020           | 19.13µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ArrowFunction                                  | 16.54µs   | 0.018           | 80.56µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::next_is()                              | 16.24µs   | 0.018           | 16.40µs  | 5          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PushZero                                | 15.39µs   | 0.017           | 15.39µs  | 56         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PushUndefined                           | 13.76µs   | 0.015           | 13.76µs  | 55         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| UnaryExpression                                | 11.52µs   | 0.013           | 3.75ms   | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| LexicalEnvironment::new                        | 11.15µs   | 0.012           | 11.20µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::peek_char()                            | 10.27µs   | 0.011           | 10.27µs  | 78         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| LexicalEnvironment::has_binding                | 10.22µs   | 0.011           | 28.81µs  | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ArrayIterator                                  | 10.09µs   | 0.011           | 28.84µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| StatementListItem                              | 9.83µs    | 0.011           | 3.57ms   | 7          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::__construct__                          | 9.80µs    | 0.011           | 31.22µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PushDeclarativeEnvironment              | 9.31µs    | 0.010           | 9.71µs   | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PushNewArray                            | 9.19µs    | 0.010           | 24.97µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ExpressionStatement                            | 9.06µs    | 0.010           | 2.80ms   | 5          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ForInIterator                                  | 8.71µs    | 0.009           | 26.32µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| SetIterator                                    | 8.67µs    | 0.009           | 26.13µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| RegExp String Iterator                         | 8.47µs    | 0.009           | 25.15µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| MapIterator                                    | 8.47µs    | 0.009           | 25.54µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| FunctionExpression                             | 7.08µs    | 0.008           | 1.77ms   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| SpreadLiteral                                  | 6.89µs    | 0.008           | 23.29µs  | 5          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| new_declarative_environment                    | 6.76µs    | 0.007           | 6.76µs   | 59         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| FunctionStatementList                          | 5.80µs    | 0.006           | 1.82ms   | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - New                                     | 5.65µs    | 0.006           | 36.90µs  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::peek()                                 | 4.65µs    | 0.005           | 4.65µs   | 59         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| FormalParameters                               | 4.54µs    | 0.005           | 6.33µs   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - This                                    | 3.50µs    | 0.004           | 3.53µs   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Object::get_prototype_from_constructor         | 3.42µs    | 0.004           | 9.07µs   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::set_goal()                             | 3.33µs    | 0.004           | 3.33µs   | 99         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Initializer                                    | 3.29µs    | 0.004           | 161.59µs | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| BindingIdentifier                              | 3.27µs    | 0.004           | 3.27µs   | 3          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| ArrayLiteral                                   | 2.42µs    | 0.003           | 3.98µs   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| globalThis                                     | 1.35µs    | 0.001           | 1.38µs   | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PopEnvironment                          | 1.23µs    | 0.001           | 1.23µs   | 2          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| cursor::next_byte()                            | 943.00ns  | 0.001           | 943.00ns | 11         |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - Swap                                    | 841.00ns  | 0.001           | 841.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - LogicalNot                              | 661.00ns  | 0.001           | 661.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PopOnReturnAdd                          | 351.00ns  | 0.000           | 351.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| INST - PopOnReturnSub                          | 211.00ns  | 0.000           | 211.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Infinity                                       | 160.00ns  | 0.000           | 160.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| undefined                                      | 140.00ns  | 0.000           | 140.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| NaN                                            | 130.00ns  | 0.000           | 130.00ns | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Execute                                        | 70.00ns   | 0.000           | 70.00ns  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
| Compilation                                    | 40.00ns   | 0.000           | 40.00ns  | 1          |
+------------------------------------------------+-----------+-----------------+----------+------------+
Total cpu time: 91.797457ms
+------+---------------+
| Item | Artifact Size |
+------+---------------+
```
  • Loading branch information
jasonwilliams committed Jan 11, 2022
1 parent 7fba7c0 commit 2300d87
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
7 changes: 7 additions & 0 deletions boa/src/environment/lexical_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,17 @@ impl Context {
}

pub(crate) fn initialize_binding(&mut self, name: &str, value: JsValue) -> JsResult<()> {
let _timer =
BoaProfiler::global().start_event("LexicalEnvironment::initialize_binding", "env");
self.get_current_environment()
.recursive_initialize_binding(name, value, self)
}

/// When neededing to clone an environment (linking it with another environnment)
/// cloning is more suited. The GC will remove the env once nothing is linking to it anymore
pub(crate) fn get_current_environment(&mut self) -> Environment {
let _timer =
BoaProfiler::global().start_event("LexicalEnvironment::get_current_environment", "env");
self.realm
.environment
.environment_stack
Expand All @@ -145,11 +149,14 @@ impl Context {
}

pub(crate) fn has_binding(&mut self, name: &str) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("LexicalEnvironment::has_binding", "env");
self.get_current_environment()
.recursive_has_binding(name, self)
}

pub(crate) fn get_binding_value(&mut self, name: &str) -> JsResult<JsValue> {
let _timer =
BoaProfiler::global().start_event("LexicalEnvironment::get_binding_value", "env");
self.get_current_environment()
.recursive_get_binding_value(name, self)
}
Expand Down
33 changes: 31 additions & 2 deletions boa/src/object/internal_methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl JsObject {
#[inline]
#[track_caller]
pub(crate) fn __get_prototype_of__(&self, context: &mut Context) -> JsResult<JsPrototype> {
let _timer = BoaProfiler::global().start_event("Object::__get_prototype_of__", "object");
let func = self.borrow().data.internal_methods.__get_prototype_of__;
func(self, context)
}
Expand All @@ -53,6 +54,7 @@ impl JsObject {
val: JsPrototype,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::__set_prototype_of__", "object");
let func = self.borrow().data.internal_methods.__set_prototype_of__;
func(self, val, context)
}
Expand All @@ -67,6 +69,7 @@ impl JsObject {
/// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-isextensible
#[inline]
pub(crate) fn __is_extensible__(&self, context: &mut Context) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::__is_extensible__", "object");
let func = self.borrow().data.internal_methods.__is_extensible__;
func(self, context)
}
Expand All @@ -81,6 +84,7 @@ impl JsObject {
/// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-preventextensions
#[inline]
pub(crate) fn __prevent_extensions__(&self, context: &mut Context) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::__prevent_extensions__", "object");
let func = self.borrow().data.internal_methods.__prevent_extensions__;
func(self, context)
}
Expand All @@ -99,7 +103,7 @@ impl JsObject {
key: &PropertyKey,
context: &mut Context,
) -> JsResult<Option<PropertyDescriptor>> {
let _timer = BoaProfiler::global().start_event("Object::get_own_property", "object");
let _timer = BoaProfiler::global().start_event("Object::__get_own_property__", "object");
let func = self.borrow().data.internal_methods.__get_own_property__;
func(self, key, context)
}
Expand All @@ -119,6 +123,7 @@ impl JsObject {
desc: PropertyDescriptor,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::__define_own_property__", "object");
let func = self.borrow().data.internal_methods.__define_own_property__;
func(self, key, desc, context)
}
Expand All @@ -137,6 +142,7 @@ impl JsObject {
key: &PropertyKey,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::__has_property__", "object");
let func = self.borrow().data.internal_methods.__has_property__;
func(self, key, context)
}
Expand All @@ -156,6 +162,7 @@ impl JsObject {
receiver: JsValue,
context: &mut Context,
) -> JsResult<JsValue> {
let _timer = BoaProfiler::global().start_event("Object::__get__", "object");
let func = self.borrow().data.internal_methods.__get__;
func(self, key, receiver, context)
}
Expand All @@ -176,7 +183,7 @@ impl JsObject {
receiver: JsValue,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::set", "object");
let _timer = BoaProfiler::global().start_event("Object::__set__", "object");
let func = self.borrow().data.internal_methods.__set__;
func(self, key, value, receiver, context)
}
Expand All @@ -191,6 +198,7 @@ impl JsObject {
/// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-delete-p
#[inline]
pub(crate) fn __delete__(&self, key: &PropertyKey, context: &mut Context) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::__delete__", "object");
let func = self.borrow().data.internal_methods.__delete__;
func(self, key, context)
}
Expand All @@ -209,6 +217,7 @@ impl JsObject {
&self,
context: &mut Context,
) -> JsResult<Vec<PropertyKey>> {
let _timer = BoaProfiler::global().start_event("Object::__own_property_keys__", "object");
let func = self.borrow().data.internal_methods.__own_property_keys__;
func(self, context)
}
Expand All @@ -229,6 +238,7 @@ impl JsObject {
args: &[JsValue],
context: &mut Context,
) -> JsResult<JsValue> {
let _timer = BoaProfiler::global().start_event("Object::__call__", "object");
let func = self.borrow().data.internal_methods.__call__;
func.expect("called `[[Call]]` for object without a `[[Call]]` internal method")(
self, this, args, context,
Expand All @@ -251,6 +261,7 @@ impl JsObject {
new_target: &JsValue,
context: &mut Context,
) -> JsResult<JsValue> {
let _timer = BoaProfiler::global().start_event("Object::__construct__", "object");
let func = self.borrow().data.internal_methods.__construct__;
func.expect("called `[[Construct]]` for object without a `[[Construct]]` internal method")(
self, args, new_target, context,
Expand Down Expand Up @@ -326,6 +337,8 @@ pub(crate) fn ordinary_get_prototype_of(
obj: &JsObject,
_context: &mut Context,
) -> JsResult<JsPrototype> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_get_prototype_of", "object");

// 1. Return O.[[Prototype]].
Ok(obj.prototype().as_ref().cloned())
}
Expand Down Expand Up @@ -433,6 +446,7 @@ pub(crate) fn ordinary_get_own_property(
key: &PropertyKey,
_context: &mut Context,
) -> JsResult<Option<PropertyDescriptor>> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_get_own_property", "object");
// 1. Assert: IsPropertyKey(P) is true.
// 2. If O does not have an own property with key P, return undefined.
// 3. Let D be a newly created Property Descriptor with no fields.
Expand Down Expand Up @@ -463,6 +477,8 @@ pub(crate) fn ordinary_define_own_property(
desc: PropertyDescriptor,
context: &mut Context,
) -> JsResult<bool> {
let _timer =
BoaProfiler::global().start_event("Object::ordinary_define_own_property", "object");
// 1. Let current be ? O.[[GetOwnProperty]](P).
let current = obj.__get_own_property__(&key, context)?;

Expand Down Expand Up @@ -490,6 +506,7 @@ pub(crate) fn ordinary_has_property(
key: &PropertyKey,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_has_property", "object");
// 1. Assert: IsPropertyKey(P) is true.
// 2. Let hasOwn be ? O.[[GetOwnProperty]](P).
// 3. If hasOwn is not undefined, return true.
Expand Down Expand Up @@ -521,6 +538,7 @@ pub(crate) fn ordinary_get(
receiver: JsValue,
context: &mut Context,
) -> JsResult<JsValue> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_get", "object");
// 1. Assert: IsPropertyKey(P) is true.
// 2. Let desc be ? O.[[GetOwnProperty]](P).
match obj.__get_own_property__(key, context)? {
Expand Down Expand Up @@ -567,6 +585,8 @@ pub(crate) fn ordinary_set(
receiver: JsValue,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_set", "object");

// 1. Assert: IsPropertyKey(P) is true.
// 2. Let ownDesc be ? O.[[GetOwnProperty]](P).
// 3. Return OrdinarySetWithOwnDescriptor(O, P, V, Receiver, ownDesc).
Expand Down Expand Up @@ -668,6 +688,7 @@ pub(crate) fn ordinary_delete(
key: &PropertyKey,
context: &mut Context,
) -> JsResult<bool> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_delete", "object");
// 1. Assert: IsPropertyKey(P) is true.
Ok(
// 2. Let desc be ? O.[[GetOwnProperty]](P).
Expand Down Expand Up @@ -698,6 +719,7 @@ pub(crate) fn ordinary_own_property_keys(
obj: &JsObject,
_context: &mut Context,
) -> JsResult<Vec<PropertyKey>> {
let _timer = BoaProfiler::global().start_event("Object::ordinary_own_property_keys", "object");
// 1. Let keys be a new empty List.
let mut keys = Vec::new();

Expand Down Expand Up @@ -752,6 +774,9 @@ pub(crate) fn is_compatible_property_descriptor(
desc: PropertyDescriptor,
current: Option<PropertyDescriptor>,
) -> bool {
let _timer =
BoaProfiler::global().start_event("Object::is_compatible_property_descriptor", "object");

// 1. Return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current).
validate_and_apply_property_descriptor(None, extensible, desc, current)
}
Expand All @@ -769,6 +794,8 @@ pub(crate) fn validate_and_apply_property_descriptor(
desc: PropertyDescriptor,
current: Option<PropertyDescriptor>,
) -> bool {
let _timer = BoaProfiler::global()
.start_event("Object::validate_and_apply_property_descriptor", "object");
// 1. Assert: If O is not undefined, then IsPropertyKey(P) is true.

let mut current = if let Some(own) = current {
Expand Down Expand Up @@ -925,6 +952,8 @@ pub(crate) fn get_prototype_from_constructor<F>(
where
F: FnOnce(&StandardObjects) -> &StandardConstructor,
{
let _timer =
BoaProfiler::global().start_event("Object::get_prototype_from_constructor", "object");
// 1. Assert: intrinsicDefaultProto is this specification's name of an intrinsic
// object.
// The corresponding object must be an intrinsic that is intended to be used
Expand Down

0 comments on commit 2300d87

Please sign in to comment.