-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Invoke
op to optimize method calls; require explicit this
- Loading branch information
1 parent
5b91e5d
commit 5190099
Showing
8 changed files
with
165 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// out: not a method | ||
|
||
// Makes sure we haven't broken this case with the | ||
// INVOKE opcode. | ||
|
||
class Oops { | ||
def init(this) { | ||
def f() { | ||
print("not a method") | ||
} | ||
|
||
this.field = f | ||
} | ||
} | ||
|
||
let oops = Oops() | ||
oops.field() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// out: OK | ||
|
||
class Foo { | ||
def init(this) { | ||
.name = "foo" | ||
} | ||
def bar(this) => .name + "hello" | ||
} | ||
|
||
let foo = Foo() | ||
|
||
let start = clock() | ||
|
||
for let i = 0; i < 10; i = i + 1 { | ||
for let i = 0; i < 10000; i = i + 1 { | ||
foo.bar() | ||
} | ||
} | ||
|
||
let end = clock() | ||
print("Took", end-start, "seconds") | ||
print("OK") |