Commit bf8d8f1d authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] use macro keyword for methods

This makes it obvious that methods are actually macros.
Also, in the future, we might allow methods that are actually builtins.

Bug: v8:7793
Change-Id: Ib641c4b5a222b27c67aa0c31fd3611ed4a11842c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1967330Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65455}
parent d2351143
...@@ -147,7 +147,7 @@ namespace array { ...@@ -147,7 +147,7 @@ namespace array {
// The buffer is maintained and updated by Buffer.constructor, Buffer.Add(), // The buffer is maintained and updated by Buffer.constructor, Buffer.Add(),
// Buffer.AddSeparators(). // Buffer.AddSeparators().
struct Buffer { struct Buffer {
Add(implicit context: Context)( macro Add(implicit context: Context)(
str: String, nofSeparators: intptr, separatorLength: intptr) { str: String, nofSeparators: intptr, separatorLength: intptr) {
// Add separators if necessary (at the beginning or more than one) // Add separators if necessary (at the beginning or more than one)
const writeSeparators: bool = this.index == 0 | nofSeparators > 1; const writeSeparators: bool = this.index == 0 | nofSeparators > 1;
...@@ -161,7 +161,7 @@ namespace array { ...@@ -161,7 +161,7 @@ namespace array {
IsOneByteStringInstanceType(str.instanceType) & this.isOneByte; IsOneByteStringInstanceType(str.instanceType) & this.isOneByte;
} }
AddSeparators(implicit context: Context)( macro AddSeparators(implicit context: Context)(
nofSeparators: intptr, separatorLength: intptr, write: bool) { nofSeparators: intptr, separatorLength: intptr, write: bool) {
if (nofSeparators == 0 || separatorLength == 0) return; if (nofSeparators == 0 || separatorLength == 0) return;
......
...@@ -91,11 +91,11 @@ namespace array { ...@@ -91,11 +91,11 @@ namespace array {
} }
struct Vector { struct Vector {
ReportSkippedElement() { macro ReportSkippedElement() {
this.skippedElements = true; this.skippedElements = true;
} }
CreateJSArray(implicit context: Context)(validLength: Smi): JSArray { macro CreateJSArray(implicit context: Context)(validLength: Smi): JSArray {
const length: Smi = this.fixedArray.length; const length: Smi = this.fixedArray.length;
assert(validLength <= length); assert(validLength <= length);
let kind: ElementsKind = PACKED_SMI_ELEMENTS; let kind: ElementsKind = PACKED_SMI_ELEMENTS;
...@@ -147,7 +147,7 @@ namespace array { ...@@ -147,7 +147,7 @@ namespace array {
return a; return a;
} }
StoreResult(implicit context: Context)(index: Smi, result: JSAny) { macro StoreResult(implicit context: Context)(index: Smi, result: JSAny) {
typeswitch (result) { typeswitch (result) {
case (s: Smi): { case (s: Smi): {
this.fixedArray.objects[index] = s; this.fixedArray.objects[index] = s;
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
namespace growable_fixed_array { namespace growable_fixed_array {
// TODO(pwong): Support FixedTypedArrays. // TODO(pwong): Support FixedTypedArrays.
struct GrowableFixedArray { struct GrowableFixedArray {
Push(obj: Object) { macro Push(obj: Object) {
this.EnsureCapacity(); this.EnsureCapacity();
this.array.objects[this.length++] = obj; this.array.objects[this.length++] = obj;
} }
ResizeFixedArray(newCapacity: intptr): FixedArray { macro ResizeFixedArray(newCapacity: intptr): FixedArray {
assert(this.length >= 0); assert(this.length >= 0);
assert(newCapacity >= 0); assert(newCapacity >= 0);
assert(newCapacity >= this.length); assert(newCapacity >= this.length);
...@@ -17,7 +17,7 @@ namespace growable_fixed_array { ...@@ -17,7 +17,7 @@ namespace growable_fixed_array {
return ExtractFixedArray( return ExtractFixedArray(
this.array, first, this.length, newCapacity, kFixedArrays); this.array, first, this.length, newCapacity, kFixedArrays);
} }
EnsureCapacity() { macro EnsureCapacity() {
assert(this.length <= this.capacity); assert(this.length <= this.capacity);
if (this.capacity == this.length) { if (this.capacity == this.length) {
// Growth rate is analog to JSObject::NewElementsCapacity: // Growth rate is analog to JSObject::NewElementsCapacity:
...@@ -26,7 +26,7 @@ namespace growable_fixed_array { ...@@ -26,7 +26,7 @@ namespace growable_fixed_array {
this.array = this.ResizeFixedArray(this.capacity); this.array = this.ResizeFixedArray(this.capacity);
} }
} }
ToJSArray(implicit context: Context)(): JSArray { macro ToJSArray(implicit context: Context)(): JSArray {
const nativeContext: NativeContext = LoadNativeContext(context); const nativeContext: NativeContext = LoadNativeContext(context);
const map: Map = LoadJSArrayElementsMap(PACKED_ELEMENTS, nativeContext); const map: Map = LoadJSArrayElementsMap(PACKED_ELEMENTS, nativeContext);
const fixedArray: FixedArray = this.ResizeFixedArray(this.length); const fixedArray: FixedArray = this.ResizeFixedArray(this.length);
......
...@@ -27,7 +27,7 @@ namespace torque_internal { ...@@ -27,7 +27,7 @@ namespace torque_internal {
} }
struct Slice<T: type> { struct Slice<T: type> {
TryAtIndex(index: intptr):&T labels OutOfBounds { macro TryAtIndex(index: intptr):&T labels OutOfBounds {
if (Convert<uintptr>(index) < Convert<uintptr>(this.length)) { if (Convert<uintptr>(index) < Convert<uintptr>(this.length)) {
return UnsafeNewReference<T>( return UnsafeNewReference<T>(
this.object, this.offset + index * %SizeOf<T>()); this.object, this.offset + index * %SizeOf<T>());
...@@ -36,25 +36,25 @@ namespace torque_internal { ...@@ -36,25 +36,25 @@ namespace torque_internal {
} }
} }
AtIndex(index: intptr):&T { macro AtIndex(index: intptr):&T {
return this.TryAtIndex(index) otherwise unreachable; return this.TryAtIndex(index) otherwise unreachable;
} }
AtIndex(index: uintptr):&T { macro AtIndex(index: uintptr):&T {
return this.TryAtIndex(Convert<intptr>(index)) otherwise unreachable; return this.TryAtIndex(Convert<intptr>(index)) otherwise unreachable;
} }
AtIndex(index: constexpr int31):&T { macro AtIndex(index: constexpr int31):&T {
const i: intptr = Convert<intptr>(index); const i: intptr = Convert<intptr>(index);
return this.TryAtIndex(i) otherwise unreachable; return this.TryAtIndex(i) otherwise unreachable;
} }
AtIndex(index: Smi):&T { macro AtIndex(index: Smi):&T {
const i: intptr = Convert<intptr>(index); const i: intptr = Convert<intptr>(index);
return this.TryAtIndex(i) otherwise unreachable; return this.TryAtIndex(i) otherwise unreachable;
} }
Iterator(): SliceIterator<T> { macro Iterator(): SliceIterator<T> {
const end = this.offset + this.length * %SizeOf<T>(); const end = this.offset + this.length * %SizeOf<T>();
return SliceIterator<T>{ return SliceIterator<T>{
object: this.object, object: this.object,
...@@ -81,11 +81,11 @@ namespace torque_internal { ...@@ -81,11 +81,11 @@ namespace torque_internal {
} }
struct SliceIterator<T: type> { struct SliceIterator<T: type> {
Empty(): bool { macro Empty(): bool {
return this.start == this.end; return this.start == this.end;
} }
Next():&T labels NoMore { macro Next():&T labels NoMore {
if (this.Empty()) { if (this.Empty()) {
goto NoMore; goto NoMore;
} else { } else {
......
...@@ -23,7 +23,7 @@ namespace typed_array { ...@@ -23,7 +23,7 @@ namespace typed_array {
@export @export
struct TypedArrayElementsInfo { struct TypedArrayElementsInfo {
// Calculates the number of bytes required for specified number of elements. // Calculates the number of bytes required for specified number of elements.
CalculateByteLength(length: uintptr): uintptr labels IfInvalid { macro CalculateByteLength(length: uintptr): uintptr labels IfInvalid {
if (length > kTypedArrayMaxLength) goto IfInvalid; if (length > kTypedArrayMaxLength) goto IfInvalid;
const maxArrayLength = kArrayBufferMaxByteLength >>> this.sizeLog2; const maxArrayLength = kArrayBufferMaxByteLength >>> this.sizeLog2;
if (length > maxArrayLength) goto IfInvalid; if (length > maxArrayLength) goto IfInvalid;
...@@ -33,7 +33,7 @@ namespace typed_array { ...@@ -33,7 +33,7 @@ namespace typed_array {
// Calculates the maximum number of elements supported by a specified number // Calculates the maximum number of elements supported by a specified number
// of bytes. // of bytes.
CalculateLength(byteLength: uintptr): uintptr labels IfInvalid { macro CalculateLength(byteLength: uintptr): uintptr labels IfInvalid {
const length = byteLength >>> this.sizeLog2; const length = byteLength >>> this.sizeLog2;
if (length > kTypedArrayMaxLength) goto IfInvalid; if (length > kTypedArrayMaxLength) goto IfInvalid;
return length; return length;
...@@ -41,7 +41,7 @@ namespace typed_array { ...@@ -41,7 +41,7 @@ namespace typed_array {
// Determines if `bytes` (byte offset or length) cannot be evenly divided by // Determines if `bytes` (byte offset or length) cannot be evenly divided by
// element size. // element size.
IsUnaligned(bytes: uintptr): bool { macro IsUnaligned(bytes: uintptr): bool {
// Exploits the fact the element size is a power of 2. Determining whether // Exploits the fact the element size is a power of 2. Determining whether
// there is remainder (not aligned) can be achieved efficiently with bit // there is remainder (not aligned) can be achieved efficiently with bit
// masking. Shift is safe as sizeLog2 can be 3 at most (see // masking. Shift is safe as sizeLog2 can be 3 at most (see
...@@ -90,20 +90,20 @@ namespace typed_array { ...@@ -90,20 +90,20 @@ namespace typed_array {
const kStoreFailureArrayDetached: Smi = 1; const kStoreFailureArrayDetached: Smi = 1;
struct TypedArrayAccessor { struct TypedArrayAccessor {
LoadNumeric( macro LoadNumeric(
context: Context, array: JSTypedArray, index: uintptr): Numeric { context: Context, array: JSTypedArray, index: uintptr): Numeric {
const loadfn: LoadNumericFn = this.loadNumericFn; const loadfn: LoadNumericFn = this.loadNumericFn;
return loadfn(context, array, index); return loadfn(context, array, index);
} }
StoreNumeric( macro StoreNumeric(
context: Context, array: JSTypedArray, index: uintptr, value: Numeric) { context: Context, array: JSTypedArray, index: uintptr, value: Numeric) {
const storefn: StoreNumericFn = this.storeNumericFn; const storefn: StoreNumericFn = this.storeNumericFn;
const result = storefn(context, array, index, value); const result = storefn(context, array, index, value);
assert(result == kStoreSucceded); assert(result == kStoreSucceded);
} }
StoreJSAny( macro StoreJSAny(
context: Context, array: JSTypedArray, index: uintptr, value: JSAny) context: Context, array: JSTypedArray, index: uintptr, value: JSAny)
labels IfDetached { labels IfDetached {
const storefn: StoreJSAnyFn = this.storeJSAnyFn; const storefn: StoreJSAnyFn = this.storeJSAnyFn;
...@@ -173,20 +173,20 @@ namespace typed_array { ...@@ -173,20 +173,20 @@ namespace typed_array {
} }
struct AttachedJSTypedArrayWitness { struct AttachedJSTypedArrayWitness {
Get(): AttachedJSTypedArray { macro Get(): AttachedJSTypedArray {
return this.unstable; return this.unstable;
} }
GetStable(): JSTypedArray { macro GetStable(): JSTypedArray {
return this.stable; return this.stable;
} }
Recheck() labels Detached { macro Recheck() labels Detached {
if (IsDetachedBuffer(this.stable.buffer)) goto Detached; if (IsDetachedBuffer(this.stable.buffer)) goto Detached;
this.unstable = %RawDownCast<AttachedJSTypedArray>(this.stable); this.unstable = %RawDownCast<AttachedJSTypedArray>(this.stable);
} }
Load(implicit context: Context)(k: uintptr): JSAny { macro Load(implicit context: Context)(k: uintptr): JSAny {
const lf: LoadNumericFn = this.loadfn; const lf: LoadNumericFn = this.loadfn;
return lf(context, this.unstable, k); return lf(context, this.unstable, k);
} }
......
...@@ -9,7 +9,7 @@ extern class JSArrayIterator extends JSObject { ...@@ -9,7 +9,7 @@ extern class JSArrayIterator extends JSObject {
} }
extern class JSArray extends JSObject { extern class JSArray extends JSObject {
IsEmpty(): bool { macro IsEmpty(): bool {
return this.length == 0; return this.length == 0;
} }
length: Number; length: Number;
...@@ -141,11 +141,11 @@ macro TorqueCopyElements( ...@@ -141,11 +141,11 @@ macro TorqueCopyElements(
extern builtin CloneFastJSArray(Context, FastJSArrayForCopy): JSArray; extern builtin CloneFastJSArray(Context, FastJSArrayForCopy): JSArray;
struct FastJSArrayWitness { struct FastJSArrayWitness {
Get(): FastJSArray { macro Get(): FastJSArray {
return this.unstable; return this.unstable;
} }
Recheck() labels CastError { macro Recheck() labels CastError {
if (this.stable.map != this.map) goto CastError; if (this.stable.map != this.map) goto CastError;
// We don't need to check elements kind or whether the prototype // We don't need to check elements kind or whether the prototype
// has changed away from the default JSArray prototype, because // has changed away from the default JSArray prototype, because
...@@ -157,7 +157,7 @@ struct FastJSArrayWitness { ...@@ -157,7 +157,7 @@ struct FastJSArrayWitness {
this.unstable = %RawDownCast<FastJSArray>(this.stable); this.unstable = %RawDownCast<FastJSArray>(this.stable);
} }
LoadElementNoHole(implicit context: Context)(k: Smi): JSAny macro LoadElementNoHole(implicit context: Context)(k: Smi): JSAny
labels FoundHole { labels FoundHole {
if (this.hasDoubles) { if (this.hasDoubles) {
return LoadElementNoHole<FixedDoubleArray>(this.unstable, k) return LoadElementNoHole<FixedDoubleArray>(this.unstable, k)
...@@ -168,7 +168,7 @@ struct FastJSArrayWitness { ...@@ -168,7 +168,7 @@ struct FastJSArrayWitness {
} }
} }
StoreHole(k: Smi) { macro StoreHole(k: Smi) {
if (this.hasDoubles) { if (this.hasDoubles) {
const elements = Cast<FixedDoubleArray>(this.unstable.elements) const elements = Cast<FixedDoubleArray>(this.unstable.elements)
otherwise unreachable; otherwise unreachable;
...@@ -180,7 +180,7 @@ struct FastJSArrayWitness { ...@@ -180,7 +180,7 @@ struct FastJSArrayWitness {
} }
} }
LoadElementOrUndefined(implicit context: Context)(k: Smi): JSAny { macro LoadElementOrUndefined(implicit context: Context)(k: Smi): JSAny {
try { try {
return this.LoadElementNoHole(k) otherwise FoundHole; return this.LoadElementNoHole(k) otherwise FoundHole;
} }
...@@ -189,18 +189,18 @@ struct FastJSArrayWitness { ...@@ -189,18 +189,18 @@ struct FastJSArrayWitness {
} }
} }
EnsureArrayPushable(implicit context: Context)() labels Failed { macro EnsureArrayPushable(implicit context: Context)() labels Failed {
EnsureArrayPushable(this.map) otherwise Failed; EnsureArrayPushable(this.map) otherwise Failed;
array::EnsureWriteableFastElements(this.unstable); array::EnsureWriteableFastElements(this.unstable);
this.arrayIsPushable = true; this.arrayIsPushable = true;
} }
ChangeLength(newLength: Smi) { macro ChangeLength(newLength: Smi) {
assert(this.arrayIsPushable); assert(this.arrayIsPushable);
this.unstable.length = newLength; this.unstable.length = newLength;
} }
Push(value: JSAny) labels Failed { macro Push(value: JSAny) labels Failed {
assert(this.arrayIsPushable); assert(this.arrayIsPushable);
if (this.hasDoubles) { if (this.hasDoubles) {
BuildAppendJSArray(HOLEY_DOUBLE_ELEMENTS, this.unstable, value) BuildAppendJSArray(HOLEY_DOUBLE_ELEMENTS, this.unstable, value)
...@@ -217,7 +217,7 @@ struct FastJSArrayWitness { ...@@ -217,7 +217,7 @@ struct FastJSArrayWitness {
} }
} }
MoveElements(dst: intptr, src: intptr, length: intptr) { macro MoveElements(dst: intptr, src: intptr, length: intptr) {
assert(this.arrayIsPushable); assert(this.arrayIsPushable);
if (this.hasDoubles) { if (this.hasDoubles) {
const elements: FixedDoubleArray = const elements: FixedDoubleArray =
...@@ -256,11 +256,11 @@ macro NewFastJSArrayWitness(array: FastJSArray): FastJSArrayWitness { ...@@ -256,11 +256,11 @@ macro NewFastJSArrayWitness(array: FastJSArray): FastJSArrayWitness {
} }
struct FastJSArrayForReadWitness { struct FastJSArrayForReadWitness {
Get(): FastJSArrayForRead { macro Get(): FastJSArrayForRead {
return this.unstable; return this.unstable;
} }
Recheck() labels CastError { macro Recheck() labels CastError {
if (this.stable.map != this.map) goto CastError; if (this.stable.map != this.map) goto CastError;
// We don't need to check elements kind or whether the prototype // We don't need to check elements kind or whether the prototype
// has changed away from the default JSArray prototype, because // has changed away from the default JSArray prototype, because
...@@ -272,7 +272,7 @@ struct FastJSArrayForReadWitness { ...@@ -272,7 +272,7 @@ struct FastJSArrayForReadWitness {
this.unstable = %RawDownCast<FastJSArrayForRead>(this.stable); this.unstable = %RawDownCast<FastJSArrayForRead>(this.stable);
} }
LoadElementNoHole(implicit context: Context)(k: Smi): JSAny macro LoadElementNoHole(implicit context: Context)(k: Smi): JSAny
labels FoundHole { labels FoundHole {
if (this.hasDoubles) { if (this.hasDoubles) {
return LoadElementNoHole<FixedDoubleArray>(this.unstable, k) return LoadElementNoHole<FixedDoubleArray>(this.unstable, k)
......
...@@ -12,13 +12,13 @@ const kJSPromiseHasHandlerMask: constexpr int31 ...@@ -12,13 +12,13 @@ const kJSPromiseHasHandlerMask: constexpr int31
@generateCppClass @generateCppClass
extern class JSPromise extends JSObject { extern class JSPromise extends JSObject {
Status(): PromiseState { macro Status(): PromiseState {
StaticAssert(kJSPromiseStatusShift == 0); StaticAssert(kJSPromiseStatusShift == 0);
const status: int32 = Convert<int32>(this.flags) & kJSPromiseStatusMask; const status: int32 = Convert<int32>(this.flags) & kJSPromiseStatusMask;
return Convert<PromiseState>(status); return Convert<PromiseState>(status);
} }
SetStatus(status: constexpr PromiseState): void { macro SetStatus(status: constexpr PromiseState): void {
assert(this.Status() == kPromisePending); assert(this.Status() == kPromisePending);
assert(status != kPromisePending); assert(status != kPromisePending);
...@@ -26,11 +26,11 @@ extern class JSPromise extends JSObject { ...@@ -26,11 +26,11 @@ extern class JSPromise extends JSObject {
this.flags = this.flags | mask; this.flags = this.flags | mask;
} }
HasHandler(): bool { macro HasHandler(): bool {
return (this.flags & kJSPromiseHasHandlerMask) != 0; return (this.flags & kJSPromiseHasHandlerMask) != 0;
} }
SetHasHandler(): void { macro SetHasHandler(): void {
this.flags |= kJSPromiseHasHandlerMask; this.flags |= kJSPromiseHasHandlerMask;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
extern class Map extends HeapObject { extern class Map extends HeapObject {
PrototypeInfo(): PrototypeInfo labels HasNoPrototypeInfo { macro PrototypeInfo(): PrototypeInfo labels HasNoPrototypeInfo {
typeswitch (this.transitions_or_prototype_info) { typeswitch (this.transitions_or_prototype_info) {
case (Weak<Map>): { case (Weak<Map>): {
goto HasNoPrototypeInfo; goto HasNoPrototypeInfo;
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
@hasSameInstanceTypeAsParent @hasSameInstanceTypeAsParent
extern class RegExpMatchInfo extends FixedArray { extern class RegExpMatchInfo extends FixedArray {
GetStartOfCapture(implicit context: Context)(captureIndex: constexpr int31): macro GetStartOfCapture(implicit context: Context)(captureIndex:
Smi { constexpr int31): Smi {
const index: constexpr int31 = GetStartOfCaptureIndex(captureIndex); const index: constexpr int31 = GetStartOfCaptureIndex(captureIndex);
return UnsafeCast<Smi>(this.objects[index]); return UnsafeCast<Smi>(this.objects[index]);
} }
GetEndOfCapture(implicit context: Context)(captureIndex: constexpr int31): macro GetEndOfCapture(implicit context: Context)(captureIndex:
Smi { constexpr int31): Smi {
const index: constexpr int31 = GetStartOfCaptureIndex(captureIndex) + 1; const index: constexpr int31 = GetStartOfCaptureIndex(captureIndex) + 1;
return UnsafeCast<Smi>(this.objects[index]); return UnsafeCast<Smi>(this.objects[index]);
} }
NumberOfCaptures(implicit context: Context)(): Smi { macro NumberOfCaptures(implicit context: Context)(): Smi {
return UnsafeCast<Smi>(this.objects[kRegExpMatchInfoNumberOfCapturesIndex]); return UnsafeCast<Smi>(this.objects[kRegExpMatchInfoNumberOfCapturesIndex]);
} }
} }
......
...@@ -2104,8 +2104,8 @@ struct TorqueGrammar : Grammar { ...@@ -2104,8 +2104,8 @@ struct TorqueGrammar : Grammar {
Symbol method = {Rule( Symbol method = {Rule(
{CheckIf(Token("transitioning")), {CheckIf(Token("transitioning")),
Optional<std::string>(Sequence({Token("operator"), &externalString})), Optional<std::string>(Sequence({Token("operator"), &externalString})),
&name, &parameterListNoVararg, &optionalReturnType, optionalLabelList, Token("macro"), &name, &parameterListNoVararg, &optionalReturnType,
&block}, optionalLabelList, &block},
MakeMethodDeclaration)}; MakeMethodDeclaration)};
// Result: base::Optional<ClassBody*> // Result: base::Optional<ClassBody*>
......
...@@ -727,10 +727,10 @@ namespace test { ...@@ -727,10 +727,10 @@ namespace test {
} }
struct TestInner { struct TestInner {
SetX(newValue: int32) { macro SetX(newValue: int32) {
this.x = newValue; this.x = newValue;
} }
GetX(): int32 { macro GetX(): int32 {
return this.x; return this.x;
} }
x: int32; x: int32;
...@@ -759,7 +759,7 @@ namespace test { ...@@ -759,7 +759,7 @@ namespace test {
} }
class InternalClass extends Struct { class InternalClass extends Struct {
Flip() labels NotASmi { macro Flip() labels NotASmi {
const tmp = Cast<Smi>(this.b) otherwise NotASmi; const tmp = Cast<Smi>(this.b) otherwise NotASmi;
this.b = this.a; this.b = this.a;
this.a = tmp; this.a = tmp;
...@@ -781,10 +781,10 @@ namespace test { ...@@ -781,10 +781,10 @@ namespace test {
} }
struct StructWithConst { struct StructWithConst {
TestMethod1(): int32 { macro TestMethod1(): int32 {
return this.b; return this.b;
} }
TestMethod2(): Object { macro TestMethod2(): Object {
return this.a; return this.a;
} }
a: Object; a: Object;
...@@ -803,7 +803,7 @@ namespace test { ...@@ -803,7 +803,7 @@ namespace test {
} }
struct TestIterator { struct TestIterator {
Next(): Object labels NoMore { macro Next(): Object labels NoMore {
if (this.count-- == 0) goto NoMore; if (this.count-- == 0) goto NoMore;
return TheHole; return TheHole;
} }
...@@ -817,7 +817,7 @@ namespace test { ...@@ -817,7 +817,7 @@ namespace test {
} }
class SmiPair extends Struct { class SmiPair extends Struct {
GetA():&Smi { macro GetA():&Smi {
return & this.a; return & this.a;
} }
a: Smi; a: Smi;
......
...@@ -501,7 +501,7 @@ TEST(Torque, SpecializationRequesters) { ...@@ -501,7 +501,7 @@ TEST(Torque, SpecializationRequesters) {
A<T>(); A<T>();
} }
struct C<T: type> { struct C<T: type> {
Method() { macro Method() {
B<T>(); B<T>();
} }
} }
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
namespace array { namespace array {
class SortState extends Struct { class SortState extends Struct {
Compare(implicit context: Context)(x: JSAny, y: JSAny): Number { macro Compare(implicit context: Context)(x: JSAny, y: JSAny): Number {
const sortCompare: CompareBuiltinFn = this.sortComparePtr; const sortCompare: CompareBuiltinFn = this.sortComparePtr;
return sortCompare(context, this.userCmpFn, x, y); return sortCompare(context, this.userCmpFn, x, y);
} }
CheckAccessor(implicit context: Context)() labels Bailout { macro CheckAccessor(implicit context: Context)() labels Bailout {
const canUseSameAccessorFn: CanUseSameAccessorFn = const canUseSameAccessorFn: CanUseSameAccessorFn =
this.canUseSameAccessorFn; this.canUseSameAccessorFn;
...@@ -31,7 +31,7 @@ namespace array { ...@@ -31,7 +31,7 @@ namespace array {
} }
} }
ResetToGenericAccessor() { macro ResetToGenericAccessor() {
this.loadFn = Load<GenericElementsAccessor>; this.loadFn = Load<GenericElementsAccessor>;
this.storeFn = Store<GenericElementsAccessor>; this.storeFn = Store<GenericElementsAccessor>;
this.deleteFn = Delete<GenericElementsAccessor>; this.deleteFn = Delete<GenericElementsAccessor>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment