Commit Graph

41 Commits

Author SHA1 Message Date
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
asiva@google.com b4d9e0d620 Auto create ApiLocalScope before calling native functions, this ensures that
native functions do not have to call Dart_EnterScope/Dart_ExitScope
when they callback into the VM.

Remove Dart_EnterScope/Dart_ExitScope calls around native functions in 'bin'
directory.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25827 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 19:27:48 +00:00
srdjan@google.com 5781d7cc84 Collect both arguments for math's min/max static functions. Later that information will be used to inline the operation if possible.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25225 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 16:49:29 +00:00
srdjan@google.com 0656d300ef Split IdenticalWithNumberCheck in two versions: once called from unoptimized code the other called from optimzied code. Only the one for unoptimized code will be able to stop for single stepping. The optimized version is a leaf stub and cannot cause GC.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24557 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-27 21:52:49 +00:00
srdjan@google.com fa7817bf79 Change static calls in unoptimized code to always call via a stub. Using ICData, the call count of static calls is collected as well.
TODO: Use call frequency to guide inlining.

R=asiva@google.com, hausner@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24307 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 23:35:10 +00:00
hausner@google.com 4b497b0c17 Consolidate debug stubs
The new debug stub BreakpointRuntime gets the original stub address
from the debugger. With this scheme, we don't need a new debug stub
for every runtime stub that the debugger patches.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23094 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-23 18:42:03 +00:00
hausner@google.com 7349a6d611 Make breakpoints on == fire reliably
Add breakpoints in the path taken if one of the operands
in a == b is null.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22857 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-17 17:08:09 +00:00
hausner@google.com 80c7ad1070 Implement breakpoint for closure calls
Introduce a new PcDescriptor kind to distinguish closure calls from other runtime calls. The debugger can patch these calls to set a breakpoint. When stepping into a closure call, the debugger must fish out the closure object from the stack, find the function and set breakpoints in it.

Arm and Mips breakpoint stubs are not implemented yet. ia32 and x64 stubs tested by hand. Automated test to follow.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22596 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-10 21:06:04 +00:00
regis@google.com b59deaa17a Merge JumpToErrorHandler and JumpToExceptionHandler stubs on all architectures.
Review URL: https://codereview.chromium.org//13874010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21689 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-18 18:32:06 +00:00
kmillikin@google.com a119414b2f Cache lookups at megamorphic call sites in optimized code.
The function name and argument descriptor are mapped to a lookup cache
at compile time.  The cache maps class id to target function.  It is
resizable.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15889 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 09:48:52 +00:00
srdjan@google.com 85cf9af6ab Fix for issue 6678: Result of identical(a, b) with a and b doubles not consistent.
Implement proposed new identity spec (flag --new_identity_spec). It will be enabled/committed once the new spec been confirmed.

The new spec says that identity of numbers is computed on their values instead of on the object reference. This provides deterministic behavior without having to disable optimizations in the VM. In some cases 'identical' is now slower than 'equality' as more checks need to be done. The VM compiler can optimize 'identical' in the future.

My benchmarks do not show any slow down.
Review URL: https://codereview.chromium.org//11414136

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15332 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-26 18:35:45 +00:00
srdjan@google.com 7375693321 In optimized code use IC calls for instance calls that have no IC data instead of deoptimizing. The optimized IC call increments usage counter and reoptimizes optimized function if the threshold is met.
Recognize closure calls and mark them in ICData. Closure calls do not populate ICData, i.e., number of checks is always 0 (unless mixed closure calls with regular instance calls). Therefore closure IC calls do not count for reoptimization.
Review URL: https://codereview.chromium.org//11361225

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14860 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 18:34:05 +00:00
srdjan@google.com dc8115e19a Remove unused/not working function tracing flag and functionality.
Other small fixes, use stub to call optimization of a function (in preparation for reoptimization).
Review URL: https://codereview.chromium.org//11364184

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14756 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 20:55:31 +00:00
srdjan@google.com a397650682 For megamorphic calls (IC calls in optimized code), use a stub without attempting to count usage of function.
Review URL: https://codereview.chromium.org//11359046

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14499 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-02 20:21:33 +00:00
srdjan@google.com 717e3c0396 Support for mixed null/smi equality: do not deoptimize, emit same optimized code as if that was smi-equality only.
Moved assert for duplicate class checks into ICData.
Allow CheckClassInstr to check for Smi as well.
Review URL: https://codereview.chromium.org//11048032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13254 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-04 19:35:23 +00:00
srdjan@google.com 62a76d0783 Using type feedback, eliminate store barriers for indexed stores.
Review URL: https://chromiumcodereview.appspot.com//10910224

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12268 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-12 15:52:58 +00:00
srdjan@google.com 67871d3098 Finish implementing lazy deoptimization (ia32, x64). Ran tests with --deoptimize-alot.
Review URL: https://chromiumcodereview.appspot.com//10912146

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12093 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-09 15:00:51 +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
asiva@google.com f05e3736d8 Fix issue 1968, replace usage of inline 'asm' constructs in 'stack alignment', 'jump to exception handler' and 'jump to error handler' code with calls to appropriate stubs.
Review URL: https://chromiumcodereview.appspot.com//10664004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9071 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-25 17:35:20 +00:00
iposva@google.com dbd08016de - Inline the store buffer update into a stub instead of
calling out into the C++ runtime.
Review URL: https://chromiumcodereview.appspot.com//10578046

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8929 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-20 18:05:51 +00:00
asiva@google.com 88243dfce2 Rework leaf calls as just simple C calls with a signature and not the NativeArgumentDescriptor.
Review URL: https://chromiumcodereview.appspot.com//10592006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8881 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-19 23:57:40 +00:00
asiva@google.com 16f8c892aa Add support for leaf runtime calls
- use a NoGCScope around these calls
- do not save and restore exit frame info, context register etc.
- Do not create a zone and handlescope by default
Review URL: https://chromiumcodereview.appspot.com//10542123

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8699 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-15 00:19:45 +00:00
srdjan@google.com ad95f248cb Improve type checking, remove unused stub (removed also in x64 in preparation of porting the better type checking code from ia 32 to x64).
Review URL: https://chromiumcodereview.appspot.com//10381045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7399 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-07 21:37:39 +00:00
srdjan@google.com a53d7c1d03 Temporary fix for GrowableArray type arguments: use the type arguments stores in GrowableArray instead of the one in the data container (there is a bug that Regis is fixing where data container is always null). Fix assembly subtype cache lookup lookup.
Review URL: https://chromiumcodereview.appspot.com//10345003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7255 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-02 20:49:46 +00:00
srdjan@google.com 33b4d35412 Simpler and better inlined type checks as discussed. Changed inline type test cache arrays to contain instance class, instance type argument and instantiator type argument (not yet used).
Review URL: https://chromiumcodereview.appspot.com//10243013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7113 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-28 00:06:37 +00:00
asiva@google.com 3107319e40 Simplify representation of stack frames. Remove the special types DartFrame/StubFrame and instead use StackFrame with methods IsDartFrame and IsStubFrame for frames representing Dart or Stub Code. This eliminates all the complexity that was added to ensure that we always see only one stub frame before hitting a dart frame during iteration.
Fixes bug 6380625 which was another case when we had two stub frames before hitting the dart frame.
Review URL: https://chromiumcodereview.appspot.com//10173008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6920 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-25 01:15:28 +00:00
regis@google.com 5282e44fb2 Use null type argument vector instead of vector of Dynamic for a generic raw
type when possible.
Fix type finalization of type parameters (always finalize in the context of the
class being parameterized and not in the enclosing class where the type
parameter is used).
Fix wrong generic optimization and added a test (a generic type instantiated
from a raw instantiator is not always raw).
Added printing of type argument vectors.
Review URL: https://chromiumcodereview.appspot.com//9939003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6068 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-30 22:16:52 +00:00
srdjan@google.com 0b265044c1 Factor out super-class and interface array subtype checks into a stub.
Inline more type checks.
Review URL: https://chromiumcodereview.appspot.com//9873014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5934 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-28 15:50:33 +00:00
hausner@google.com 6d9abc5e3b StepOver, StepInto, StepOut
Implement single stepping in the debugger.
- Add PC descriptors for function return
- functions to set temporary breakpoints on all
  locations in a function.
- patching/restoring of function return code pattern
- determine call target of instance calls
Review URL: https://chromiumcodereview.appspot.com//9484002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4639 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 22:00:28 +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
regis@google.com 344dcbde12 Print stop message.
Review URL: http://codereview.chromium.org//9128002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3124 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-10 00:32:51 +00:00
turnidge@google.com 0b833d4977 Add support for interrupting an isolate in the vm. Interrupts are
implemented by extending the existing support for stack overflow
checking in the vm.  When an interrupt is scheduled for an isolate, we
overwrite the isolate's stack limit with a value guaranteed to cause a
stack overflow.

We support multiple kinds of interrupts, encoded in the low bits of
the stack limit.

Add Dart_InterruptIsolate and Dart_InterruptIsolateCallback to the
dart embedding api to allow the embedder to request and handle
interrupts.

Add EXPECT_SUBSTRING(needle, haystack) testing macro.
Review URL: http://codereview.chromium.org//8851008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2529 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 18:41:20 +00:00
srdjan@google.com 7b61cef42b Implement two-arguments-check inline cache. Use it first for Smi binary operations.
Review URL: http://codereview.chromium.org//8827015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2345 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-12 17:24:47 +00:00
hausner@google.com b7cf1328a1 Very first steps for a debugger
- Introduce Debugger class.
- Each isolate has a debugger object.
- Introduce stubs that can be put in place of static or dynamic
  Dart function calls.
- Very rudimentary command line option to place a breakpoint
  at the beginning of a function.
Review URL: http://codereview.chromium.org//8687037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1928 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-30 17:04:45 +00:00
regis@google.com 0b98430a58 Cleanups.
Review URL: http://codereview.chromium.org//8390021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@726 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 23:16:16 +00:00
srdjan@google.com 693ffc9b01 Fix crash on Linux,
Review URL: http://codereview.chromium.org//8391013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@712 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 19:27:24 +00:00
srdjan@google.com 5f43c05de7 Implement new inline cache. Delete a lot of unused code (most of change).
Review URL: http://codereview.chromium.org//8379013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@706 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 18:35:49 +00:00
regis@google.com 19208574f0 Inline allocation of implicit closures.
Consolidate generation of closure allocation stubs into one function.
Fix type name printing when printing ast.
Review URL: http://codereview.chromium.org//8234016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@357 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-11 23:42:20 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00