Commit Graph

188 Commits

Author SHA1 Message Date
John McCutchan ceb12c4f69 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

R=asiva@google.com, iposva@google.com

Review URL: https://codereview.chromium.org/1423473004 .
2015-11-04 07:59:16 -08:00
William Hesse cc4a5d2e7c Revert "Switch profiler from isolates to threads"
Reverts commit 6365c27f81 and
commit 8b9ed6cfb3.

They are causing flaky timeouts (hangs) on all vm cc tests on all Windows vm bots.

R=mit@google.com

Review URL: https://codereview.chromium.org/1425093006 .
2015-11-03 10:42:55 +01:00
John McCutchan 6365c27f81 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

R=asiva@google.com, iposva@google.com

Review URL: https://codereview.chromium.org/1412733008 .
2015-11-02 12:47:52 -08: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
Ryan Macnak 998f19dfbb More precompiled snapshotting.
- Load precompiled stub code from the snapshot.
- Mark isolates reading from precompiled snapshots as not allowed to compile.
- Reset static field values during precompilation.
- Don't run the program after generating a precompiled snapshot.

Fails sooner in loading precompiled snapshots due to null Instructions.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1311403009 .
2015-09-15 16:53:44 -07: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
Ryan Macnak a3bc55f52f Generate array allocation stub before ic call stubs to fix --lazy-dispatchers=false.
Add initial --precompile flag.

R=fschneider@google.com

Review URL: https://codereview.chromium.org//1252733005 .
2015-07-24 09:47:37 -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
Florian Schneider 11733fb5b6 VM: Fix more places with isolate embedded into unoptimized code.
Sharing unoptimized code between isolates requires removing all isolate-specific
immediates embedded into code and loading the isolate from the Thread object.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1248113003 .
2015-07-23 12:34:57 +02:00
Florian Schneider 0cf617ef13 VM: Refactor allocation stats code and remove duplicate code.
Make context allocation stub shared between isolates.

The fast-path used in optimized code still has isolate-specific
addresses inlined for performance reasons.

Common functions are moved into class_table.h/.cc.

This is a preparation for adding an isolate-independent version of the
allocation code and allocation tracking code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1241863002 .
2015-07-17 15:15:33 +02:00
Florian Schneider 141d6bdcd2 Make subtype test cache stub shared between isolates.
Also remove an the unused pp paramters from LoadIsolate on ARM64.

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1235843003 .
2015-07-13 15:42:16 +02:00
Florian Schneider 81deeaeedc VM: Share some stub code between isolates.
This CL also lifts the restriction that the object pool can't be used
in VM isolate code on x64 and arm64.

Stubs that perform allocation can't be shared yet, because the inline allocation
code is not yet isolate-independent. This will be added in a separate CL.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1229283002 .
2015-07-13 10:00:51 +02:00
Florian Schneider 3b8cbf8bfa Remove fixed contant pool entries by caching some global constants in Thread
They can be loaded via the THR register.

In particular, do this for null, true, false, and the entry point of the UpdateStoreBufferStub.

This will help supporting precompilation and reduce memory usage from constant pools (assuming there are more constant pools than threads).

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1225933002.
2015-07-08 13:37:47 +02:00
Florian Schneider 957af25419 Use object pool for runtime calls.
Also, set up a stub frame with object pool loaded in all stubs on those
platforms.  This is a preparation step to making code relocatable.

ia32 is not affected because there is no object pool.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1189573004.
2015-06-17 10:37:52 +02:00
Srdjan Mitrovic e68d22ce1e Do not emit debug check in optimized IC stubs
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1145063003
2015-05-28 09:32:12 -07:00
Florian Schneider e0621416f8 Remove unused pc descriptor types.
kClosureCall and kOptStaticCall are not needed anymore.
Closure calls are implemented as instance calls - the ClosureCall instruction
 only occurs in the synthetic FunctionImpl.call dispatcher - and does not correspond
to a source location where breakpoints can be set.

kOptStaticCall is not needed because breakpoints can only be set in unoptimized
code. kOther is used instead.

This also removes an unused PC descriptor at closure calls from unoptimized
code.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org//1160063002
2015-05-28 14:27:37 +02:00
Srdjan Mitrovic 91651f8805 Remove value check from ICData checks/house-keeping
BUG=
R=johnmccutchan@google.com, vegorov@google.com

Review URL: https://codereview.chromium.org//1153963002
2015-05-27 13:17:28 -07:00
srdjan@google.com ce1e6777b1 Move megamorphic lookup code to stub instead of inlining. Preformance loss < 5%, instruction size reduced by 30% (when using always-megamorphic).
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45525 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-05 14:07:48 +00:00
vegorov@google.com aa48bd4759 Range feedback for arithmetic operations.
In addition to tracking input and output ranges in the IC-stubs with a Smi fastpath (SmiAdd and SmiSub, currently) this CL also introduces two IC stubs that have no fast-path by still track ranges and update the range feedback.

We are able to distinguish between the following ranges (encoding of the lattice is shown in the parens):

- u-smi  (0000)
- smi    (0001)
- uint31 (0010)
- int32  (0011)
- uint32 (0100)
- int64  (1xxx) and (x1x1)

BUG=
R=fschneider@google.com, srdjan@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42370 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-15 18:48:15 +00:00
fschneider@google.com 1dc4e979d9 Remove isolate pointer from context objects.
By moving all stubs that do runtime calls into the isolate
we don't need to cache the current isolate in each context
object.

This saves space on each context at the cost of duplicating stubs
in each isolate. Most stubs are already isolate-specific and the total number
 of stubs is small enough for this to be a good trade-off.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41279 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 12:19:20 +00:00
fschneider@google.com 855541d88e Make subtype test stubs isolate-specific.
This avoids loading the current isolate from the context
register and makes those stubs not depend on having the context
stored in the CTX register.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40714 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-26 16:06:30 +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
srdjan@google.com 30e77079e9 Fix x64 patching of asllocation stub: the pool pointer must be set-up before patching jump is executed.
R=koda@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40358 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-16 23:14:54 +00:00
srdjan@google.com dd9c0ef25e Allow invalidation and recompilation of instance allocation stubs. Requested in order to implement better pretenuring strategy.
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40168 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-11 17:56:42 +00:00
fschneider@google.com 0469c12072 VM: Remove unused IsClosureCall bit from IC data.
Since closure calls are now implemented in terms of instance calls
 (via .call and a dispatcher method), there is no need for a bit in
  the IC data tracking if a IC call may be a closure call.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39979 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-08 17:10:59 +00:00
fschneider@google.com e2443c0ef2 VM: Clean up generated code for NoSuchMethod invocation of closures.
Remove unnecessary ic-data argument from the runtime function that
invokes noSuchMethod for closures.  This reduces the size of generated
code for closures.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39804 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 12:51:28 +00:00
srdjan@google.com 85af0719ef Faster IC stubs by specializing them for two-argument Smi operations (implemented only a few for now)
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39471 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-21 20:08:40 +00:00
fschneider@google.com 937726a0aa Improve polymorphic inlining of int/int double/double operations.
I added inlining of the native Double methods _add, _sub, _mul and _div and fromInteger
and unified the method recognition of the MethodRecognizer and the Intrinsifier classes.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39446 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-21 11:13:44 +00:00
johnmccutchan@google.com e7ddd5d047 Move some isolate state setup from C++ code to JumpToExceptionHandler stub (take 3).
- CL is the same as take 2, but, I now prohibit the profiler from walking the call stack when the isolate is executing the jump to exception handler.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38300 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-16 18:03:17 +00:00
rmacnak@google.com fbe77f8ab4 Specialize breakpoint stubs by set of live registers of the stubs they are intercepting.
Trades space in the constant pool for space at call sites.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38205 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 19:38:11 +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
johnmccutchan@google.com ef2adfc5c6 Allow StackFrameIterator to be used on a different thread than the isolate whose stack frames are being iterated over.
This is necessary to be able to use this in the profiler.

BUG=
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37886 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 17:38:13 +00:00
iposva@google.com d36cd610cb - Use isolate where it is appropriate.
- Do not emit an name for ExternalLabel.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36662 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 10:15:50 +00:00
srdjan@google.com f81724a750 Improve performance of stubcode based array allocation by moving stub to isolate specific area (quicker access to isolate fields). Remove _List. intrinsic. Performance fix in MIPS
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36229 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-15 16:57:56 +00:00
srdjan@google.com 2734ccafdd Remove deprecated Megamorphic stub.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35594 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-30 20:12:57 +00:00
zra@google.com a4b84a722a Ensures that stubs added to each object pool on x64
are generated before they are used by reordering the
list of stubs.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35524 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-29 14:48:00 +00:00
fschneider@google.com 79a5307d5b VM: Implement closure calls as instance calls.
Conceptually f() becomes f.call() where the .call method performs the actual
closure call. The closure call itself is implemented without a stub.

The check if the object called is a closure becomes a class-id check
which can be hoisted out of loops.

R=iposva@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34917 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 10:56: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 cc9e3b8068 Introduce a lazy-compile stub for functions.
The function's code pointer is either a lazy-compile stub
or the compiled code. The function is compiled on invocation.

There is no need to check for null when invoking a function. This means
one check less when invoking functions via a stub. For this I added a  LazyCompile
stub.

Additional cleanup in Stackmap and PcDescriptors (remove unused code pointer,
and changed smi-lengh into a raw integer).

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34643 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-02 12:37:48 +00:00
johnmccutchan@google.com 762b9a400c Set VMTag from stubs when transitioning between Dart and Native
R=asiva@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34065 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-18 21:26:07 +00:00
regis@google.com 8d5dae7798 Allocate instance closures similarly to regular closures, i.e. without a
specific stub and runtime call.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33074 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-26 18:38:47 +00:00
hausner@google.com a65c571f18 Get rid of dynamic call debug stub
This leaves only one debugger stub function. Yay.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31932 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-17 21:32:58 +00:00
hausner@google.com 06da68b5aa Eliminate another debugger stub
This change replaces https://codereview.chromium.org/135213002/

The specialized debugger stub call for static method calls is
no longer needed. It was introduced because once upon a time, the
static method call stub used to patch the call site when the target
was compiled. The VM stopped patching unoptimized static calls a
long time ago. Thus we can treat a static call like a regular runtime
call when patching it to set a breakpoint.

Bonus fix: single step runtime callback on mips was broken. The
enter/leave stub frame were missing.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31928 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-17 19:09:46 +00:00
hausner@google.com 31db06a905 Delete obsolete debug stub
Remove the debug stub that became obsolete with the recent rewrite
of how we handle breakpoints at return statements.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31685 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-09 23:56:08 +00:00
hausner@google.com c571528323 Make return statements single steppable
Replace the code smashing breakpoints at function returns with a call
to a runtime stub that checks whether the debugger is single stepping.
The call to the stub is only emitted in unoptimized code.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31435 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-02 23:31:52 +00:00
zra@google.com 039a4c4078 Disconnects code objects from infrequently used unoptimized functions.
Every 30 seconds (configurable by --code-collection-interval),
before a MarkSweep collection, this change halves a function's
usage count if it is unoptimized. If the function's usage count
reaches 0 as a result of this halving, it sets the function's
code pointers to null. Then, if the code object isn't marked
during the MarkSweep, it will be collected.

This change also checks for null code pointers in various
places, and recompiles/reconnects code if needed.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29209 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 21:26:15 +00:00
fschneider@google.com a329b0e6bc Dart VM: Simplify code generation for equality operators.
By inserting the necessary checks for null inside the callee
at the AST level, the code generation of == operations can be
greatly simplified.

This is a performance-neutral change and a step for allowing
generic inlining of arbitrary == methods. So far we could only
inline them for a common set of types in the flow graph
optimizer.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28084 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 10:10:50 +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