v8/test
Sathya Gunasekaran 4ca9d843f8 [class] Store class fields initializer on the constructor
Previously, the class fields initializer function was stored on a
synthetic context allocated variable. This approach had sevaral
problems:

- We didn't know that class literal had fields until after we had
completely parsed the class literal. This meant that we had to go back
and fix up the scope of the constructor to have this synthetic
variable. This resulted in mismatch between parser and preparsed scope
data.

- This synthetic variable could potentially resolve to an initializer
of an outer class.

For ex:
class X extends Object {
  c = 1;
  constructor() {
    var t = () => {
      class P extends Object {
        constructor() {
          var t = () => { super(); };
          t();
        }
      }
      super();
    }
    t();
  }
}

In this the inner class P could access the outer class X's initiliazer
function. We would have to maintain extra metadata to make sure this
doesn't happen.

Instead this new approach uses a private symbol to store the
initializer function on the class constructor itself.

For the base constructor case, we can simply check for a bit on the
constructor function literal to see if we need to emit code that loads
and calls this initializer function. Therefore, we don't pay the cost
of loading this function in case there are no class fields.

For the derived constructor case, there are two possiblities:
(a) We are in a super() call directly in the derived constructor:

In this case we can do a check similar to the base constructor check,
we can check for a bit on the derived constructor and emit code for
loading and calling the initializer function.

This is usually the common case and we don't pay any cost for not using
class fields.

(b) We are in a super() call inside an arrow function in the derived
constructor:

In this case, we /always/ emit code to load and call the initializer
function. If the function doesn't exist then we have undefined and we
don't call anything. Otherwise we call the function.

super() can't be called twice so even if we emit code to load and call
the initializer function multiple times, it doesn't matter because it
would have already been an error.

Bug: v8:5367
Change-Id: I7f77cd6493ff84cf0e430a8c1039bc9ac6941a88
Reviewed-on: https://chromium-review.googlesource.com/781660
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49628}
2017-11-27 10:35:11 +00:00
..
benchmarks [test] Extract expected outcomes. Simpler FAIL_* handling. 2017-11-24 09:23:03 +00:00
cctest [class] Store class fields initializer on the constructor 2017-11-27 10:35:11 +00:00
common [wasm] Use activations of the interpreter in the fuzzers 2017-11-21 14:49:55 +00:00
debugger Remove env field from testcase. 2017-11-16 15:26:06 +00:00
fuzzer Remove always-on flags for RegExp dotAll and lookbehind 2017-11-17 16:47:19 +00:00
inspector [inspector] introduce way to get full stored async stack 2017-11-23 00:22:40 +00:00
intl Remove env field from testcase. 2017-11-16 15:26:06 +00:00
js-perf-test [js-perf-test] Add Collection constructor and double type microbenchmarks 2017-11-16 07:21:05 +00:00
memory [snapshot] add tracking for builtin snapshot size. 2017-08-31 07:29:31 +00:00
message [builtins]: Simple port of %TypedArray%.prototype.set() to CSA TFJ. 2017-11-23 15:40:41 +00:00
mjsunit [class] Store class fields initializer on the constructor 2017-11-27 10:35:11 +00:00
mkgrokdump Remove shell info from testcase. 2017-11-16 15:42:26 +00:00
mozilla [test] Common statusfile flag format for mozilla and test262. 2017-11-20 14:20:24 +00:00
preparser Remove shell info from testcase. 2017-11-16 15:42:26 +00:00
promises-aplus Remove env field from testcase. 2017-11-16 15:26:06 +00:00
test262 [test] Extract expected outcomes. Simpler FAIL_* handling. 2017-11-24 09:23:03 +00:00
unittests Fix VirtualMemory::Free in presence of lsan 2017-11-23 17:29:53 +00:00
wasm-spec-tests [wasm] Update spec tests 2017-11-22 10:39:01 +00:00
webkit Remove env field from testcase. 2017-11-16 15:26:06 +00:00
bot_default.gyp [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
bot_default.isolate [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
BUILD.gn [wasm] Remove the wasm-asmjs fuzzer 2017-06-21 10:59:35 +00:00
default.gyp [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
default.isolate [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
optimize_for_size.gyp
optimize_for_size.isolate
perf.gyp [gn] Move build to gypfiles 2016-04-29 10:11:11 +00:00
perf.isolate Remove SIMD.js from V8. 2017-02-14 06:57:25 +00:00