- 11 Sep, 2018 1 commit
-
-
Simon Zünd authored
To make the changes in base.tq work, there were 2 changes needed on the C++ side: - calls to "FromConstexpr" are generated by the compiler for implicit conversions. - type switch is desugared and uses "Cast" R=jgruber@chromium.org, tebbi@chromium.org Change-Id: I085f1a393f93e501e6bbcaeacb0d6568259a4714 Reviewed-on: https://chromium-review.googlesource.com/1219629 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#55794}
-
- 10 Sep, 2018 1 commit
-
-
Tobias Tebbi authored
This CL makes sure, that logical operators (||, &&) always have return type never. Together with a check that never is never passed as a function argument, this prevents faulty evaluation as in !(x || y). Before, the logical operators had a behavior similar to (bool labels Taken, NotTaken), with a fast exit if the left-hand side allowed shor-circuit evaluation, but returning the right-hand side otherwise. Since we want to allow existing (a || b || c) patterns in the codebase, this requires weakening the restriction that the left- and right-hand side need to have the same type. Now the possibilites are: bool, never never, bool never, never bool, bool constexpr bool, constexpr bool Bug: v8:8137 Change-Id: I9576b337dc4008ac58b4625e77fef4e73bcdd6e3 Reviewed-on: https://chromium-review.googlesource.com/1215162Reviewed-by:
Daniel Clifford <danno@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#55750}
-
- 13 Aug, 2018 1 commit
-
-
Tobias Tebbi authored
drive-by change: fix wrong typing in CSA. Change-Id: I9234306e8568a64157b44a86a58f09e65116b298 Reviewed-on: https://chromium-review.googlesource.com/1172583 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#55093}
-
- 08 Aug, 2018 1 commit
-
-
Tobias Tebbi authored
This adds a typeswitch statement typeswitch (e) case (x1 : Type1) { ... } case (x2 : Type2) { } ... ... case (xn : TypeN) { ... } This checks to which of the given types the result of evaluating e can be cast, in the order in which they are listed. So if an earlier type matches, a value of this type won't reach a later case. The type-checks are performed by calling the cast<T>() macro. The type of the argument passed to the cast macro is dependent on the case and excludes all types checked earlier. For example, in const x : Object = ... typeswitch (x) case (x : Smi) { ... } case (x : HeapNumber) { ... } case (x : HeapObject) { ... } there will be calls to cast<Smi>(Object) and cast<HeapNumber>(HeapObject), because after the Smi check we know that x has to be a HeapObject. With the refactored base.tq definition of cast, this will generate efficient code and avoid repeating the Smi check in the second case. The type system ensures that all cases are reachable and that the type given to the last case is safe without a runtime check (in other words, the union of all checked types covers the type of e). The cases can also be written as case (Type) { ... } , in which case the switched value is not re-bound with the checked type. Bug: v8:7793 Change-Id: Iea4aed7465d62b445e3ae0d33f52921912e095e3 Reviewed-on: https://chromium-review.googlesource.com/1156506 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Daniel Clifford <danno@chromium.org> Cr-Commit-Position: refs/heads/master@{#54958}
-
- 07 Aug, 2018 1 commit
-
-
Tobias Tebbi authored
Previously, we requested instantiation of generics prior to selecting a template overload, which resulted in unused templates being instantiated, possibly triggering unnecessary compile errors. Bug: v8:7793 Change-Id: I45f4bdbf8aa93749ece416c6c7458d64e6e051f5 Reviewed-on: https://chromium-review.googlesource.com/1154977 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Daniel Clifford <danno@chromium.org> Cr-Commit-Position: refs/heads/master@{#54950}
-
- 03 Aug, 2018 1 commit
-
-
Tobias Tebbi authored
Bug: v8:8012 v8:7793 Change-Id: Idc5d685d021fd107974b4415f7b855397004cb53 Reviewed-on: https://chromium-review.googlesource.com/1160841Reviewed-by:
Camillo Bruni <cbruni@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54893}
-
- 31 Jul, 2018 1 commit
-
-
Tobias Tebbi authored
Change-Id: I4710d317cf9f5686551a3df6e98619bab79387fa Reviewed-on: https://chromium-review.googlesource.com/1156698 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Michael Stanton <mvstanton@chromium.org> Cr-Commit-Position: refs/heads/master@{#54827}
-
- 27 Jul, 2018 2 commits
-
-
Tobias Tebbi authored
We currently only expose this to desugarings and not in the grammar to keep 'const' and 'let' bindings consistent. A side-effect of this change is that it is now possible to use a shadowed name in the initializer of a const binding. Bug: v8:7793 Change-Id: Ic2ca6af0735acf0e748d394f9039fe6612bd4a06 Reviewed-on: https://chromium-review.googlesource.com/1150534 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Daniel Clifford <danno@chromium.org> Cr-Commit-Position: refs/heads/master@{#54755}
-
Simon Zünd authored
This CL changes the for-loop so all parts are optional, allowing loops like: for (;;) {} for (;; ++i) {} ... R=danno@chromium.org, tebbi@chromium.org Bug: v8:7793 Change-Id: I7bf9ef9e59d55eb9ae9f38904a1c1106ae50df5a Reviewed-on: https://chromium-review.googlesource.com/1152727 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Daniel Clifford <danno@chromium.org> Cr-Commit-Position: refs/heads/master@{#54752}
-
- 17 Jul, 2018 2 commits
-
-
Daniel Clifford authored
Struct are bundles of value types. They are essentially just shorthand for passing around a group of individually defined values. Struct types are declared like this: struct A { x: Smi; y: int32; } and can be constructed explicitly like this: A{0, 0} Structs can be used wherever other types are used (e.g. variables, parameters, return values) except for parameter/return types of builtins and runtime functions. Struct use field access notation to set/get their values like this: let a: A = A{0, 0}; let b: Smi = a.x; a.y = 0; Change-Id: I9fd36a6514c37882831256a49a50809c5db75b56 Reviewed-on: https://chromium-review.googlesource.com/1122133 Commit-Queue: Daniel Clifford <danno@chromium.org> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54501}
-
Simon Zünd authored
This CL adds local const bindings. This means that instead of generating TVARIABLEs for variables, we can generate simple TNodes. Example: macro FooBar(): { const kSomeSmi: Smi = 10; ... } This CL also enforces that variables with a constexpr type are bound using 'const' and not 'let'. R=tebbi@chromium.org Bug: v8:7793 Change-Id: Id20a18149df9fc374ce718bdb1478e3eabb6e6df Reviewed-on: https://chromium-review.googlesource.com/1138316 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54479}
-
- 13 Jul, 2018 1 commit
-
-
Simon Zünd authored
This CL adds constants that can be defined in the module scope: const kConstexprConst: constexpr int31 = 5; const kIntptrConst: intptr = 4; const kSmiConst: Smi = 3; They are implemented by generating "mini-macros" that return the expression on the right-hand side of the assignment. Bug: v8:7793 Change-Id: I0a476cb3111707fad56bf15e9547b377c7adab37 Reviewed-on: https://chromium-review.googlesource.com/1114745 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Daniel Clifford <danno@chromium.org> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54430}
-
- 03 Jul, 2018 1 commit
-
-
Tobias Tebbi authored
Variables/return values with constexpr type cannot have multiple assignments. We check this now. For conditionals, it is important to always infer a non-constexpr type. This CL adds the ability to map any type (including union types) to be mapped to their non-constexpr variant. Conditionals infer their type as the non-constexpr version of a combination of the two branch types. In addition, this improves subtyping for constexpr types: If A extends B, then constexpr A extends constexpr B. This makes it necessary to clean up "constexpr String", which has nothing to do with tagged values. Bug: v8:7793 Change-Id: Ia4d3cd5dc98f45b0ec89adf05c5c6111a0e51cc6 Reviewed-on: https://chromium-review.googlesource.com/1122864 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Daniel Clifford <danno@chromium.org> Cr-Commit-Position: refs/heads/master@{#54167}
-
- 28 Jun, 2018 1 commit
-
-
Théotime Grohens authored
This CL adds the newline character as a valid character in Torque strings. You can now write Print('Hello, World!\n') in Torque and it works! Change-Id: I2a1f87cfef492fedd3d24086e226d3ebaf882115 Reviewed-on: https://chromium-review.googlesource.com/1118229Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Théotime Grohens <theotime@google.com> Cr-Commit-Position: refs/heads/master@{#54089}
-
- 25 Jun, 2018 1 commit
-
-
Théotime Grohens authored
This CL adds a fast path for DataView getters and setters when the load or store to be performed is aligned and when the requested endianness matches the platform endianness. In that case, we can just emit the right load/store instruction instead of having to read and write data byte by byte. Change-Id: I10bd95a7fe8d23f695899eb8173bc654fb38fbb0 Reviewed-on: https://chromium-review.googlesource.com/1106168 Commit-Queue: Théotime Grohens <theotime@google.com> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54005}
-
- 13 Jun, 2018 1 commit
-
-
Simon Zünd authored
R=tebbi@chromium.org Bug: v8:7793 Change-Id: I691b3682aec3269350ee02c29b48ce1d46a1ffcb Reviewed-on: https://chromium-review.googlesource.com/1098656Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Simon Zünd <szuend@google.com> Cr-Commit-Position: refs/heads/master@{#53701}
-
- 12 Jun, 2018 1 commit
-
-
Daniel Clifford authored
In the process: - Add strict ordering of Types so that name mangling is consistent and build time. Previously, the UnionType stored the union's types in a std::set<const Type*>, which did not have a consistent ordering of the types in the set. - Add a int31 type to enable consistency and correctness of handling of 'constexpr int31' values on the C++ side. - By removing the "implicit" keyword for operators, there is now one less difference between operators and calls, another incremental step in unifying operators and calls. - Enable external (i.e. C++-defined) generic specializations - Add CSA support for checking double ElementsKinds, including tests. - Clean up some constexpr/non-constexpr handling of ElementsKinds. Bug: v8:7793 Change-Id: I27699aba70b98ebf5466e5b62b045d7b1dad62c8 Reviewed-on: https://chromium-review.googlesource.com/1091155 Commit-Queue: Daniel Clifford <danno@chromium.org> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53664}
-
- 05 Jun, 2018 2 commits
-
-
Simon Zünd authored
This CL changes the behaviour of number literals. Large integer literals (bigger than Smi, but fit into int32) should have type "constexpr int32" instead of "constexpr float64". R=tebbi@chromium.org Change-Id: I3a83c617c7d257451d299670c891fac5b21d045c Reviewed-on: https://chromium-review.googlesource.com/1084991 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53522}
-
Tobias Tebbi authored
Bug: v8:7793 Change-Id: I69e27cb1e8477ca0d64ad7a96ab256cae96339f4 Reviewed-on: https://chromium-review.googlesource.com/1086801Reviewed-by:
Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53521}
-
- 29 May, 2018 1 commit
-
-
Simon Zünd authored
This CL is a proposal to add "checked" casts (CAST in CSA) to the Torque language. The CL adds the "unsafe_cast<>" operator that emits a "CAST". Example: let n: Number = ...; ... if (TaggedIsSmi(n)) { let m: Smi = unsafe_cast<Smi>(n); ... } The cast wont incur a runtime overhead now. R=tebbi@chromium.org Change-Id: I9fca90d1d11e61617ba0270e5022fd66200e2195 Reviewed-on: https://chromium-review.googlesource.com/1070151 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53416}
-
- 24 May, 2018 1 commit
-
-
Tobias Tebbi authored
Change-Id: Ie8bdbcdea8006d3105c419113f9adb2c1d6f162c Reviewed-on: https://chromium-review.googlesource.com/1070203 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Sigurd Schneider <sigurds@chromium.org> Cr-Commit-Position: refs/heads/master@{#53341}
-
- 22 May, 2018 2 commits
-
-
Tobias Tebbi authored
Change-Id: I80dd313ac3a5809d363adff9cf11ac31b04648dd Reviewed-on: https://chromium-review.googlesource.com/1068876 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Sigurd Schneider <sigurds@chromium.org> Cr-Commit-Position: refs/heads/master@{#53292}
-
Simon Zünd authored
This CL adds grammar support for function pointers to generic builtins. It also instantiates generic specializations when they are only used in an assignment to a function pointer. Example: builtin GenericBuiltinTest<T: type>(c: Context, param: T): Object { return Null; } let fnptr: builtin(Context, Smi) => Object = GenericBuiltinTest<Smi>; Change-Id: Ib7e5f47ffc05f14eb5d0b789936587263dfb961d Reviewed-on: https://chromium-review.googlesource.com/1068731 Commit-Queue: Simon Zünd <szuend@google.com> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53284}
-
- 18 May, 2018 1 commit
-
-
Théotime Grohens authored
Change-Id: I79e4ad1cf41ea8888bf6288690203d746a7b7864 Reviewed-on: https://chromium-review.googlesource.com/1065811Reviewed-by:
Daniel Clifford <danno@chromium.org> Commit-Queue: Théotime Grohens <theotime@google.com> Cr-Commit-Position: refs/heads/master@{#53245}
-
- 16 May, 2018 2 commits
-
-
Tobias Tebbi authored
This CL adds the new type expression builtin(Context, ArgType1, ...) => ReturnType and allows to use Torque-defined builtins as values of this type, as well as calling values of this type. The new function pointer types are subtypes of Code. Change-Id: Ib7ba3ce6ef7a8591a4c79230dd189fd25698d5b9 Reviewed-on: https://chromium-review.googlesource.com/1060056 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Daniel Clifford <danno@chromium.org> Cr-Commit-Position: refs/heads/master@{#53217}
-
Daniel Clifford authored
Including specialization, e.g.: // Declare parameterized generic macro GenericMacroTest<T: type>(param: T): Object { return Undefined; } // Declare specialization of generic GenericMacroTest<Object>(param: Object): Object { return param; } ... assert(GenericMacroTest<Smi>(0) == Undefined); assert(GenericMacroTest<Smi>(1) == Undefined); assert(GenericMacroTest<Object>(Null) == Null); assert(GenericMacroTest<Object>(False) == False); ... Known issue: specialization doesn't rigorously checked to verify that specialization signature precisely matches generic declaration. Change-Id: I9d9d96da4c5c8c9a76550844680e9e133a5edaed Reviewed-on: https://chromium-review.googlesource.com/1043986 Commit-Queue: Daniel Clifford <danno@chromium.org> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53203}
-
- 15 May, 2018 1 commit
-
-
Simon Zünd authored
This CL changes the generated C++ code for LabeledStatementBlocks to only emit labels if they are used. Prior to this CL, when a label was only used on one path of an if constexpr expression, and not at all anywhere else, the try/label construct would BIND a label that was not used, causing a CSA verification error. R=tebbi@chromium.org Change-Id: Ia81a0cd081b84528c95bbdbdb98b9ab51928e13f Reviewed-on: https://chromium-review.googlesource.com/1057247Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Reviewed-by:
Daniel Clifford <danno@chromium.org> Commit-Queue: Simon Zünd <szuend@google.com> Cr-Commit-Position: refs/heads/master@{#53173}
-
- 13 May, 2018 2 commits
-
-
peterwmwong authored
Change-Id: I37ed9115c099f3d17f23a26348a1bbf5f773ee32 Reviewed-on: https://chromium-review.googlesource.com/1056668Reviewed-by:
Daniel Clifford <danno@chromium.org> Commit-Queue: Peter Wong <peter.wm.wong@gmail.com> Cr-Commit-Position: refs/heads/master@{#53136}
-
Daniel Clifford authored
In the process, add a few simple tests for "constexpr" expressions, which identified a few bugs that are also fixed in this CL. Change-Id: I97486c781572642d2b574b92133b1f9cda3db592 Reviewed-on: https://chromium-review.googlesource.com/1055493 Commit-Queue: Daniel Clifford <danno@chromium.org> Reviewed-by:
Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#53135}
-