Commit Graph

59 Commits

Author SHA1 Message Date
srdjan@google.com 35ef4ddbd5 Enable correct optimized double modulo operation. (TODO: enable remainder optimization).
Review URL: https://codereview.chromium.org//12082063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17859 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-30 17:40:28 +00:00
srdjan@google.com 6e26ea871d On Ia32 optimistically assume that results from int32 and uint32 array loads fit into Smi. Only if the instruction caused deoptimization will we assume mixed Smi/Mint operations. In absence of precise tracking of deoptimization history (location/reason) conservatively assume that a method that was deoptimized once may have been deoptimzied because of uint32/int32 loads.
Significant improvement for MeshDecompression on ia32.
Review URL: https://codereview.chromium.org//12086045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17810 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-29 21:16:44 +00:00
srdjan@google.com 18b376a8ad Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the result.
Review URL: https://codereview.chromium.org//11568044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16272 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 18:43:29 +00:00
cshapiro@google.com 49f6f9f36d Merge the Merlin heap tracing to top-of-trunk.
Review URL: https://codereview.chromium.org//11428067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16199 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-15 19:58:45 +00:00
kmillikin@google.com 1610d7d2ac Refactor the InstanceFunctionLookupStub.
The stub is used in the case that an IC miss handler cannot find a
cacheable target.  It handles implicit closures, calls to instance
fields, and no such method.

Refactor the stub to make a single call into the runtime.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16057 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 19:52:47 +00:00
regis@google.com 697550b2a2 Support call operator in the vm.
Review URL: https://codereview.chromium.org//11316343

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16009 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 00:48:58 +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 d6772016eb Cleanups based on Kevin's and Florian's suggestions.
Review URL: https://codereview.chromium.org//11481002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15850 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 17:59:53 +00:00
kmillikin@google.com 3dabe31e91 Reapply "Do not call ResolveCompileInstanceFunction from the lookup stub."
With a fix for a crash bug on x64.  The near jump encoding could fail on
some platforms due to platform-specific code.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15845 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 13:00:38 +00:00
kmillikin@google.com 1ddeb10349 Revert "Do not call ResolveCompileInstanceFunction from the lookup stub."
This reverts svn revision 15842 due to a snapshot build failure on Mac.

TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15843 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 11:21:13 +00:00
kmillikin@google.com c9bab9efaa Do not call ResolveCompileInstanceFunction from the lookup stub.
The InstanceFunctionLookup stub is only called after the inline cache miss
handler.  The miss handler ensures that ResolveCompileInstanceCallTarget is
called.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15842 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 11:13:51 +00:00
kmillikin@google.com 8c4e214722 Pass IC data and arguments descriptor to IC miss runtime functions.
Before, we obtained them by pattern matching backwards on the machine
instructions at the call site.  This previous approach becomes unwieldy when
we need to use to use multiple instance call patterns.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15737 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-05 15:35:18 +00:00
regis@google.com f19052e037 Remove ClosureArgumentMismatch runtime entry in vm and
replace with call to noSuchMethod.
Review URL: https://codereview.chromium.org//11421134

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15472 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-28 21:14:43 +00:00
srdjan@google.com 99ff4cef45 Address Florian's comments: use restricted lazy deoptimization, fix typo.
Review URL: https://codereview.chromium.org//11364245

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14938 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-15 01:36:04 +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
fschneider@google.com a42474ba37 Reland: Improve smi shift operations and avoid repeated deoptimizations.
This CL includes a bug fix where a NULL check of the pc was missing.

Also change the dart2js test status of arithmetic_test from Skip to Fail.
Review URL: https://codereview.chromium.org//11369158

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14755 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 19:54:55 +00:00
fschneider@google.com a830c7c091 Revert r14711 and r14709 because of test failures.
TBR=srdjan@google.com
Review URL: https://codereview.chromium.org//11363151

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14712 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 22:37:26 +00:00
fschneider@google.com 0f251088ec Improve smi shift operations and avoid repeated deoptimizations.
Smi left shifts do not contain a call now. Only after deoptimizing
at a smi operation we we generate mint code or a generic call to
avoid repeated deoptimization.

Added a test case for the code that was not covered by existing tests.
Review URL: https://codereview.chromium.org//11363141

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14709 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-08 22:03:47 +00:00
fschneider@google.com 85a2dca687 Inline native String.charCodeAt in optimized code and fix a bounds-check bug.
Introduce a new IL instruction that does charCodeAt from
1- and 2-byte character strings. The existing CheckArrayBound
instructions is extended to be used for string bounds checking.

Also fix a bug with a missing compile-time bounds-check on constant
arrays.

TEST=tests/language/optimized_string_charcodeat.dart,
tests/language/optimized_constant_array_string_access.dart
Review URL: https://codereview.chromium.org//11360033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14441 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-01 22:47:41 +00:00
fschneider@google.com 058f8105d6 Small IL cleanup.
1. Remove manual inlining and intrinsification of Double.toDouble
and Integer.toInt. The flow graph inliner can handle these since
they are not native library functions.

2. Remove unused member instance_call_ from UnarySmiOp.

R=kmillikin@google.com
Review URL: https://codereview.chromium.org//11267043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14079 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-25 14:31:44 +00:00
srdjan@google.com 64a5b5f609 In optimized code always deoptimize if we encounter an instance call without type feedback (ICData has no checks).
Fix a bug in inliner: do not inline methods that have no compiled code as we can not deoptimize into them. This is the simplest fix, more complex fixes can be implemented if we see a need for them.

This improves the speed of Meteor by 15% and NavierStokes by 40% (Mac OS X). 
Review URL: https://codereview.chromium.org//11186007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13712 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-16 23:46:27 +00:00
fschneider@google.com 3efefbd582 Faster 64-bit right-shift for the ia32 compiler.
Review URL: https://codereview.chromium.org//11027060

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13295 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-05 14:42:00 +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
fschneider@google.com f60ebcc5fb Add fast 64-bit bitwise negation to the IA32 optimizing compiler.
Review URL: https://codereview.chromium.org//11043020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13221 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-04 12:01:12 +00:00
kmillikin@google.com d7115e5eda Remove deoptimization index PC descriptors.
Put the PC (offset) of the deoptimization point and the deoptimization
reason in the DeoptInfo table.  The table entries are now triples of
(PC offset, info, reason).

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13056 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-01 10:16:22 +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
fschneider@google.com d25bfcb4c5 Revert r11772: Add check for non-smi to the IL and use it for class checks.
In its current state this causes some performance regressions because
we can't eliminate non-smi checks properly in the optimizer.

TBR=vegorov@google.com
Review URL: https://chromiumcodereview.appspot.com//10905065

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11774 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-03 16:56:31 +00:00
fschneider@google.com c045c3aff1 Add check for non-smi to the IL and use it for class checks.
Review URL: https://chromiumcodereview.appspot.com//10911057

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11772 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-03 15:19:27 +00:00
regis@google.com 9e00bd8ccb Implement argument definition test in the vm.
Add tests.
Various cleanups.
Review URL: https://chromiumcodereview.appspot.com//10915022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11664 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 22:46:44 +00:00
vegorov@google.com a573d2dec8 Unbox phis that were proven to be of type Double.
Eliminate Boxing/Unboxing pairs.

Allow boxing, unboxing and double binary operations to participate in CSE.

Allow double comparisons to operate on unboxed inputs.

Support XMM registers and double spill slots in deoptimization.

Save XMM registers when calling to runtime from WriteBarrier stub.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11652 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 20:39:48 +00:00
srdjan@google.com caf04303f7 Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This assumption (verified with Todd and Gilad) simplifies the implementation of lazy deoptimization considerably.
Add flag --deoptimize-alot, which will lazily deoptimize all live optimized frames. Currently only the presence of deoptimization information is checked.

Add kDeoptAfter deoptimization point, which is the continuation for lazy deoptimization, after a call. Rename kDeopt to kDeoptBefore.

Removed a tests case that called into a native without properly setting up a Dart frame (Ok-d by Siva).

Native functions are not optimizable.

TODO: Split deoptimization information from DeoptimizationStubs. Check for redundant PcDescriptor information (what can be merged, especially at calls).
Review URL: https://chromiumcodereview.appspot.com//10885039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11642 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 18:53:46 +00:00
srdjan@google.com 5f5150e031 Emit deoptimization information at stati calls (preparation for full deoptimization). Currently we use Deoptimization stubs to maintain the deoptimization info, do not emit stubs though for static calls.
Any instruction  that calls out of Dart code and into other Dart code or C++ may deoptimize.
Review URL: https://chromiumcodereview.appspot.com//10880079

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11467 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-28 17:25:10 +00:00
fschneider@google.com e450dfb95a Add a smi-check instruction for arithmetic smi operations.
The flowgraph optimizer inserts smi checks for the inputs of
arithmetic smi operations:

      PushArgument v0
      PushArgument v1
v2 <- InstanceCall(+, v0, v1) IC[1: Smi, Smi]

becomes

      CheckSmi(v0)
      CheckSmi(v1)
v2 <- BinarySmiOp(+, v0, v1)


Each input operand is checked separately. This avoids using a temp
register for a combined smi check. It also allows us to easily eliminate
the checks for left and right input separately.

There are two ways to eliminate smi checks:
1. By common subexpression elimination: if the value checked is already
   checked for smi-ness before.
2. By class-id propagation: If the input value is guaranteed to be a smi.
Review URL: https://chromiumcodereview.appspot.com//10867012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11216 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-23 08:24:29 +00:00
fschneider@google.com f5ec253dec Split BinaryOp into BinarySmiOp and BinaryMintOp.
This refactoring is a preparation for inserting explicit
class checks for arithmetic operations.
Review URL: https://chromiumcodereview.appspot.com//10879005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11132 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-22 11:17:57 +00:00
fschneider@google.com 253c3f8499 Implement class id checks as a separate instruction and add a local CSE optimization pass.
This CL contains:
A new CheckClassComp instruction. Currently it is used only for instance loads:
(LoadInstanceFieldComp)

A pass LocalCSE that performs block-local common subexpression elimination. To identify
redundant expressions I use a hash map per basic block. Computations that do not have
side effects can participate in CSE. For now, I only enabled it for CheckClass.
Any computation that participates in CSE must implement the AttributesEqual function.


Other smaller fixes:

Places where we can pass the correct initial size for GrowableArrays
that have a known size. We should consider having a FixedLengthArray for this purpose.

Made the accessors ic_data() and set_ic_data() use a const ICData*.
Review URL: https://chromiumcodereview.appspot.com//10824349

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10948 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 12:40:14 +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 00c3067049 Fix problem of excessive attempts to optimize, fix excessive deoptimizations for load/store indexed, performance issue with non-inlineable instance setter (direct call instead of IC call). Add tracing of issues encountered when attepting to optimize a method (--trace_failed_optimization_attempts), rename flag --print_stacktrace_at_throw.
Review URL: https://chromiumcodereview.appspot.com//10704210

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9680 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 20:55:09 +00:00
srdjan@google.com f5b544c948 Equality compare should record two arguments in IC data. Inline double equality comparison.
Review URL: https://chromiumcodereview.appspot.com//10702195

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9644 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-13 20:17:42 +00:00
regis@google.com 8997078334 Remove old code generator.
Review URL: https://chromiumcodereview.appspot.com//10665038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9122 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-26 17:43:44 +00:00
srdjan@google.com 5f509dc665 Removing more IC calls in optimized code.
Review URL: https://chromiumcodereview.appspot.com//10572050

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8950 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-20 23:19:02 +00:00
srdjan@google.com f26f243476 Improve equality operation (inline, direct calls).
Review URL: https://chromiumcodereview.appspot.com//10545186

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8700 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-15 00:40:58 +00:00
srdjan@google.com 0d74d13f2b Implement polymorphic instance calls.
Review URL: https://chromiumcodereview.appspot.com//10539145

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8678 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 18:07:43 +00:00
srdjan@google.com 69be8e6f0b Add righ shift test for corner cases, use macro for deopt reasons (all suggested by Slava in a previous CL)
Review URL: https://chromiumcodereview.appspot.com//10539068

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8459 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-08 18:20:45 +00:00
srdjan@google.com 6fc1247bb6 Using SubtypeTestCache object instead of an array, that way we do not need to patch and can communicate to type tests if there is a cache to update (quicker than looking up code).
Review URL: https://chromiumcodereview.appspot.com//10352012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7304 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 22:00:52 +00:00
regis@google.com 7793191032 Check upper bounds of type arguments when allocating objects of a generic type
at run time when they cannot be checked at compile time.
Review URL: https://chromiumcodereview.appspot.com//10280007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7211 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-02 01:57:22 +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 e360e4d1c9 Second set of changes for implementation of stack map support.
- Added functionality to be able to build stack maps in the compiler and register them into the Code object during Code finalization.
- Merged code_generator_ia32_test.cc and code_generator_x64_test.cc into code_generator_test.cc as the two files were identical.
Review URL: https://chromiumcodereview.appspot.com//9721006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5764 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 01:27:35 +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 1eaef108b9 Move CodeGenerator::DescriptorList into shared part.
Review URL: https://chromiumcodereview.appspot.com//9465028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4582 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-24 23:27:24 +00:00
srdjan@google.com d525130469 More optimizations and cleanups.
Review URL: http://codereview.chromium.org//8972005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2548 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 23:16:00 +00:00