Commit Graph

22 Commits

Author SHA1 Message Date
Ryan Macnak e1ffe76a36 [vm] Replace StubEntry with Code handles.
StubEntry was holding raw pointers across safepoints in several places in the compiler.

Bug: https://github.com/dart-lang/sdk/issues/34934
Change-Id: Id17cb7651f4d3508915c8cb90f5cb2353df6dac0
Reviewed-on: https://dart-review.googlesource.com/c/85040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-21 17:45:11 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Florian Schneider bac82e2592 VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=koda@google.com, rmacnak@google.com

Committed: https://github.com/dart-lang/sdk/commit/1d343e5a7b75168fb6c9f86b64c55173cdbdc9b2

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-19 13:21:09 +02:00
Florian Schneider 7af7a2db87 Revert "VM: New calling convention for generated code."
This reverts commit 1d343e5a7b.

Because of Windows test failures.

BUG=
TBR=whesse@google.com

Review URL: https://codereview.chromium.org//1343373003 .
2015-09-16 13:46:05 +02:00
Florian Schneider 1d343e5a7b VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-16 13:05:58 +02:00
Florian Schneider 63a8e5227d VM: More abstract interface for generating stub calls.
This makes the code in the code generator independent from how stubs
are actually called (i.e. directly embedding the target address, or
indirectly by loading the target address from the code object).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1270803003 .
2015-08-05 10:18:35 +02:00
Regis Crelier cd00cf3f8e Simplify constant pool usage in x64 code generator (by removing extra argument
to all code emitting routines that may access the pool).

R=zra@google.com

Review URL: https://codereview.chromium.org//1268783003 .
2015-07-31 12:38:33 -07:00
Florian Schneider 8d38a58c18 Make array allocation stub shared between isolates.
This allows to make the last explicitly named stubs shared between isolates.

When sharing code stubs, we can't do patching at their entry anymore.
Therefore, I had to remove patching support of the array allocation stub.
Is this a functionality we want to keep?

The change is mostly performance-neutral because optimized code has an inlined fast
path for array allocation and only uses the stub for the slow-case.

The only isolate-specific stubs left are object allocation stubs which are
associated with their Class are per-isolate.

Since this CL removes any isolate-specific stubs from StubCode, it becomes AllStatic.

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1247783002 .
2015-07-23 12:56:16 +02:00
fschneider@google.com 340299bc13 VM: Emit compacter code for x64 branches to external labels.
Use jmp [PP + 0xiiii] instead of

movq TMP, [PP + 0xiiii]
jmp TMP

Also, remove some unused code from x64 assembler.

R=zra@google.com

Review URL: https://codereview.chromium.org//869533003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43094 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 10:28:23 +00:00
koda@google.com a3b31e3364 Make AllocateArray stub patchable, like instance allocation stubs.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//600243002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40699 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-25 23:31:08 +00:00
asiva@google.com f85f986bda Make isolate specific stub code accessors instance methods instead
of static. This allows use of isolate without having to call
Isolate::Current() when using these accessors.

R=johnmccutchan@google.com, srdjan@google.com, zra@google.com

Review URL: https://codereview.chromium.org//365983002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38040 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 21:25:00 +00:00
fschneider@google.com 9ed4cf1cb6 Simplify and improve handling of IC and megamorphic cache miss handling.
Instead of going back and forth from stub code to C++, perform
only the lookup in C++ and call target functions only from
stub code.

noSuchMethod and implicit closure invocations are now also work with
the megamorphic cache. Before they would go slow-case in the megamorphic case.

This CL eliminates the InstanceFunctionLookup stub that was previously
used to handle noSuchMethod and implicit closure invocations.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//221173011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34774 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 09:27:43 +00:00
fschneider@google.com d6178535b2 Landing: Write protect executable pages in the VM.
Change executable pages to be read/execute but not writable by default.

All pages are made temporarily writable just before a full GC, because both
the mark and sweep phases write to the pages. When allocating in a page and
when patching code, the pages are made temporarily writable.

The order of allocation of Code and Instructions objects is changed so that
a GC will not occur after Instructions is allocated. (A full GC would
render the Instructions unwritable.) A scoped object is used to make memory
protection simpler.

Original CL: https://codereview.chromium.org/106593002/

I added a cc test that is expected to crash.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//136563002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32493 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-10 12:18:06 +00:00
asiva@google.com eaebf15f43 Fix for issue 14790 - Crash when using dartium devtools
The stack frame iteration during GC was missing one slot in stub frames that
did not save the pool pointer.

- This change makes all stub frames uniform, i.e they always save/restore the pool pointer. This ensures that we will traverse all slots on the stack.

- A new constant called kFirstObjectSlotFromFp has been added which is used as the slot to start stack traversal.

(The ARM and MIPs changes will be in a different CL)

R=iposva@google.com, regis@google.com, zra@google.com

Review URL: https://codereview.chromium.org//63093003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30088 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-08 00:25:40 +00:00
zra@google.com df2054dae7 Sets a register aside on x64 for use as a pool-pointer. It is loaded and restored from the code object on Frame entry and exit. All LoadObject calls that can, and many calls and jumps through ExternalLabels now use the pool-pointer. The --compiler-stats flag when running dart2js indicates that code size is reduced ~13%, and more is probably possible.
R=fschneider@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//22825023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27295 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 15:39:26 +00:00
regis@google.com 8c44be4313 Add support for object pool that will be used on ARM and MIPS architectures.
Modify code patching infrastructure to accept code object, which is necessary to
get to the object pool containing patchable target addresses.
Modify assembler test infrastructure to provide associated code object.
Review URL: https://codereview.chromium.org//12260026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18604 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 23:55:31 +00:00
asiva@google.com 00dd8aa761 Remove functions_cache_ and it's references as it is not being used anymore.
Review URL: https://chromiumcodereview.appspot.com//10824266

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10542 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 23:33:37 +00:00
srdjan@google.com d55a9bc973 First steps toward a two stages new compiler.
Review URL: https://chromiumcodereview.appspot.com//10356051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7420 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-08 16:03:15 +00:00
srdjan@google.com a343a49338 Do not count invocations but usage of a function, i.e., increment a function's counter at IC calls and at return operations in unoptimized code. (TODO: increment count at static calls as well). There is no checking at method entry any more. The function counter reporting is not measuring the invocation count but much more how much time we spend in a method. Removed counter at backward branches.
Renamed flags to:
--optimization_counter_threshold (default 2000)
--report_usage_count
Review URL: https://chromiumcodereview.appspot.com//9460015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4583 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-25 00:33:25 +00:00
kmillikin@google.com 552825c221 Required rename on x64 platform.
Due to a name clash, rename class Instruction => InstructionPattern.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9429055

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4466 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 16:38:56 +00:00
regis@google.com 9aa346b921 Port jump and call instruction decoding and patching for x64.
Review URL: http://codereview.chromium.org//8896017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2327 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 22:46:44 +00:00