summaryrefslogtreecommitdiff
path: root/deps/v8/test/torque
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2019-05-28 08:46:21 -0400
committerRefael Ackermann <refack@gmail.com>2019-06-01 09:55:12 -0400
commited74896b1fae1c163b3906163f3bf46326618ddb (patch)
tree7fb05c5a19808e0c5cd95837528e9005999cf540 /deps/v8/test/torque
parent2a850cd0664a4eee51f44d0bb8c2f7a3fe444154 (diff)
downloadandroid-node-v8-ed74896b1fae1c163b3906163f3bf46326618ddb.tar.gz
android-node-v8-ed74896b1fae1c163b3906163f3bf46326618ddb.tar.bz2
android-node-v8-ed74896b1fae1c163b3906163f3bf46326618ddb.zip
deps: update V8 to 7.5.288.22
PR-URL: https://github.com/nodejs/node/pull/27375 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/v8/test/torque')
-rw-r--r--deps/v8/test/torque/test-torque.tq78
1 files changed, 70 insertions, 8 deletions
diff --git a/deps/v8/test/torque/test-torque.tq b/deps/v8/test/torque/test-torque.tq
index f81552292a..8221f72d86 100644
--- a/deps/v8/test/torque/test-torque.tq
+++ b/deps/v8/test/torque/test-torque.tq
@@ -278,22 +278,29 @@ namespace test {
}
macro TestStruct2(implicit context: Context)(): TestStructA {
- return TestStructA{UnsafeCast<FixedArray>(kEmptyFixedArray), 27, 31};
+ return TestStructA{
+ indexes: UnsafeCast<FixedArray>(kEmptyFixedArray),
+ i: 27,
+ k: 31
+ };
}
macro TestStruct3(implicit context: Context)(): TestStructA {
let a: TestStructA =
- TestStructA{UnsafeCast<FixedArray>(kEmptyFixedArray), 13, 5};
+ TestStructA{indexes: UnsafeCast<FixedArray>(kEmptyFixedArray), i: 13, k: 5};
let b: TestStructA = a;
let c: TestStructA = TestStruct2();
a.i = TestStruct1(c);
a.k = a.i;
let d: TestStructB;
d.x = a;
- d = TestStructB{a, 7};
+ d = TestStructB{x: a, y: 7};
let e: TestStructA = d.x;
- let f: Smi =
- TestStructA{UnsafeCast<FixedArray>(kEmptyFixedArray), 27, 31}.i;
+ let f: Smi = TestStructA{
+ indexes: UnsafeCast<FixedArray>(kEmptyFixedArray),
+ i: 27,
+ k: 31
+ }.i;
f = TestStruct2().i;
return a;
}
@@ -304,7 +311,7 @@ namespace test {
}
macro TestStruct4(implicit context: Context)(): TestStructC {
- return TestStructC{TestStruct2(), TestStruct2()};
+ return TestStructC{x: TestStruct2(), y: TestStruct2()};
}
macro TestStructInLabel(implicit context: Context)(): never
@@ -751,7 +758,7 @@ namespace test {
macro TestStructConstructor(implicit context: Context)() {
// Test default constructor
- let a: TestOuter = TestOuter{5, TestInner{6, 7}, 8};
+ let a: TestOuter = TestOuter{a: 5, b: TestInner{x: 6, y: 7}, c: 8};
assert(a.a == 5);
assert(a.b.x == 6);
assert(a.b.y == 7);
@@ -811,7 +818,7 @@ namespace test {
}
macro NewInternalClass(x: Smi): InternalClass {
- return new InternalClass{x, x + 1};
+ return new InternalClass{a: x, b: x + 1};
}
macro TestInternalClass(implicit context: Context)() {
@@ -820,4 +827,59 @@ namespace test {
check(o.a == 6);
check(o.b == 5);
}
+
+ struct StructWithConst {
+ TestMethod1(): int32 {
+ return this.b;
+ }
+ TestMethod2(): Object {
+ return this.a;
+ }
+ a: Object;
+ const b: int32;
+ }
+
+ macro TestConstInStructs() {
+ const x = StructWithConst{a: Null, b: 1};
+ let y = StructWithConst{a: Null, b: 1};
+ y.a = Undefined;
+ const copy = x;
+ }
+
+ struct TestIterator {
+ Next(): Object labels NoMore {
+ if (this.count-- == 0) goto NoMore;
+ return Hole;
+ }
+ count: Smi;
+ }
+
+ macro TestNewFixedArrayFromSpread(implicit context: Context)(): Object {
+ const i = TestIterator{count: 5};
+ return new FixedArray{map: kFixedArrayMap, length: 5, objects: ...i};
+ }
+
+ class SmiPair {
+ GetA():&Smi {
+ return & this.a;
+ }
+ a: Smi;
+ b: Smi;
+ }
+
+ macro Swap<T: type>(a:&T, b:&T) {
+ const tmp = * a;
+ * a = * b;
+ * b = tmp;
+ }
+
+ macro TestReferences() {
+ const array = new SmiPair{a: 7, b: 2};
+ const ref:&Smi = & array.a;
+ * ref = 3 + * ref;
+ -- * ref;
+ Swap(& array.b, array.GetA());
+ check(array.a == 2);
+ check(array.b == 9);
+ }
}