Commit Graph

574 Commits

Author SHA1 Message Date
John McCutchan 89d05debec Improve token position for the entry CheckStackoverflowInstr
- Have it use the same token position as the DebugStepCheckInstr at entry.
- Add a token pos to ConstantInstr (but it's not really used yet).

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1561833006 .
2016-01-06 11:21:00 -08:00
Vyacheslav Egorov c0e374d455 Ensure consistency of representations when replacing integer ops with constants
during canonicalization.

BUG=dartbug.com/25335
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1557923003 .
2016-01-05 17:10:31 +01:00
Florian Schneider 413ec9682e VM compiler: Remove dead strict-compare instructions in optimized code.
Also, remove two redundant const_casts.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1554183002 .
2016-01-04 18:22:26 +01:00
Florian Schneider fbdce6a59e VM: Const-correctness fixes.
Three types of fixes:
1. Remove redundant const_cast
2. Remove const_cast by adding const when appropiate.
3. Remove const_cast by removing const (e.g. places where we call free with it)

For now I only fixed places where the fix is local enough - i.e. does not require
changed a large amount of code.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1526123002 .
2015-12-15 19:24:40 +01:00
Florian Schneider eee0e6d8c3 Fix optimizations on static fields in precompiled code.
Don't perform LICM / or load elimination of static fields in precompiled
code since they may not be initialized and we don't record an explicit
dependency between the initialization and the load of a static field.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1497783002 .
2015-12-04 12:42:39 +01:00
Florian Schneider f6b96b3d07 Start remove dependencies on compiler-related files.
Minimize the number of dependencies of compiler-related files.

This is needed to remove whole .cc/.h files from a compiler-less VM binary which
can be used for running precompiled code.

* removed dependencies of object.cc on flow_graph_compiler.h and flow_graph_builder.h

* removed unnecessary includes from object.h

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1411873005 .
2015-11-05 00:08:35 +01:00
Srdjan Mitrovic 181e8cc2a9 Move resolving of natives to a late stage (during code emission). That eliminates unnecessary native resolution (e.g., when native gets recognized or rejected in the inliner). Removed tests that are now impossible to implement with AST (fake native functions).
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1420173006 .
2015-11-03 16:18:24 -08:00
Srdjan Mitrovic 772ee329c4 Make ICData changes thread safe (first compute array, then set it). Install code in the main thread instead of in the background compilation thread.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1410363005 .
2015-10-26 15:12:29 -07:00
Srdjan Mitrovic 6f53350611 Move deopt_id and related helpers/definitions from Isolate to Thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1390153004 .
2015-10-13 10:08:14 -07:00
Srdjan Mitrovic d867784de5 Cleanups and preemptively pass Heap::kOld whenever subtype testing in compiler
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1377453005 .
2015-09-29 11:05:54 -07:00
Florian Schneider 4a653d9e17 VM: Store edge counters in one per-function array.
Reserve first element in the Function's ic_data_array to hold the edge
counter array.

Until now we had a one-element array per edge counter. This reduces memory
used by edge counters.

This CL allows to optimize code without having to have the unoptimized
code present.

Also, save space in Instruction by making place_id_ and lifetime_position_
a union. place_id_ is exclusively needed by Load/StoreOptimizer,
lifetime_position by the FlowGraphAllocator.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1343383003 .
2015-09-28 13:28:04 +02: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 718ae3a704 Don't optimize away static field initialization when precompiling.
R=hausner@google.com

Review URL: https://codereview.chromium.org//1327383002 .
2015-09-10 17:27:38 -07:00
Siva Annamalai 79ef28317f Changes to prepare for allowing script snapshots to be taken after running the main application:
- Rename accessors of class Field to make it more apparent as to what is being accessed (static field values or instance field offsets
- Use precompiled initializer state (Used only during precompilation) to also store saved initial value of static fields (Used only during application snapshot   generation)

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

Review URL: https://codereview.chromium.org//1289643005 .
2015-09-04 11:03:46 -07:00
Srdjan Mitrovic d4365bc6f4 Lookup getter/setter symbols before alllocating them, thus eliminating extra String allocations in new space.
Various old space allocations, cleanups.
Add a test for Symbols concatenation.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1320673012 .
2015-09-03 14:09:34 -07:00
Srdjan Mitrovic 0094f0a76f More cleanups in compiler (remove allocation in new space).
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1314363003 .
2015-09-02 16:03:24 -07:00
Ryan Macnak 9d8dcd1288 Load runtime entries from the Thread instead of the ObjectPool.
Removes the need to relocate their ObjectPool entries when loading a precompiled snapshot.

Saves about ~2kB of ObjectPool in hello_world at the cost of ~400B/Thread (64-bit).

R=fschneider@google.com

Review URL: https://codereview.chromium.org//1315893004 .
2015-09-02 14:58:26 -07:00
Srdjan Mitrovic 7fb555045a Remove allocation in old space ....
Eliminate need for GrowableObjectArray, allocate constants in old space.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1305223006 .
2015-09-02 08:59:33 -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
Srdjan Mitrovic 1a1ff00a29 Use zone when allocating handles in FlowGraphCompiler assembling operations. Add profiling VM tags for parse and flow graph builder, active only when --profile_vm. Lazily generate IR constant_value handles.
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1263573010 .
2015-08-03 10:10:24 -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
Ryan Macnak d1475c0356 Port irregexp bytecode compiler and interpreter from V8 r24065.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1201383002 .
2015-07-07 14:43:32 -07:00
Srdjan Mitrovic e91b99b66d Fix crash in modPow (issue 23693); various bigint knowledge missing.
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1197263002.
2015-06-22 15:11:36 -07:00
Srdjan Mitrovic 247805b8e5 Add flag polymorphic_with_deopt (default true) and handle case when false: use megamorphic instead of deopt. Tested, it will be used with --noopt
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1190473004.
2015-06-16 14:11:05 -07:00
Ivan Posva f5e3f94019 Fix http://dartbug.com/23578:
- Complete revamp of isolate-specific flags.
- Associate flags with the isolate on creation.
- Dart_CreateIsolate and associate callback do take an
  extra flags argument.
- Make sure to clear IC data array when clearing code.

BUG=23578

Review URL: https://codereview.chromium.org//1162033005
2015-06-07 17:57:34 +02:00
Srdjan Mitrovic ed73a3d151 With --noopt run unoptimized code through optimizer, more optimizations can be done later.
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1149713002
2015-05-28 10:05:46 -07:00
Florian Schneider 96e4c4d3c6 VM: Fix bugs with missing deoptimization environment and int32x4 constructor
It can occur that we don't have exact type information at UnboxUint32 instructions,
but range information concludes that the instruction can't deoptimize. In this case,
we can assume the input must be a smi or mint if the range fits into mint range.

The generated coe for this case was missing on x64 and arm64. It was already added
for ia32, ARM and MIPS (see https://codereview.chromium.org//770303002)

The optimized instruction of the Int32x4 constructor was incorrectly using uint32 as
input representation, instead of int32.

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

Review URL: https://codereview.chromium.org//1148943004
2015-05-28 10:09:49 +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 3ac643115f Remove unneeded flag declaratiosn (enable_type_checks, enable_asserts).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45647 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 16:48:43 +00:00
srdjan@google.com 2a89dbdcbf A CheckClass instruction that compares against a null class only can be optimized to check instance instead of its class, since null-class has only one instance (not counting the sentinel, transitional etc temorary instances).
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44920 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-06 17:32:09 +00:00
koda@google.com 9c181ec6d5 Thread/Isolate refactoring: new(Isolate*) -> new(Zone*)
Refactor all remaning cases where the current zone is used through new(Isolate*) and remove this interface.

Removing this interface is needed to move towards multiple threads per isolate, and also makes the caller more aware of the scope of the zone used, reducing the risk of use-after-free.

Make the current thread and the stack zone created around native/runtime entries directly available in their body, saving an indirection (and optimized away if unused).

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44541 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 19:24:26 +00:00
fschneider@google.com ea77da464b VM: Better type propagation for string objects.
For strings we can't propagate the class-id because of externalization,
but we still can record the compile-type (String). This is for example useful
for eliminating number-checks with identical-comparisons.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44133 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 16:10:22 +00:00
vegorov@google.com 598811048b Fold BIT_NOT and NEGATE during constant propagation.
Convert (a & 2^n) == 2^n into TestSmi instruction.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43957 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 14:53:02 +00:00
srdjan@google.com b67d23747f - Fix sin-cos merge, add a flag to turn it on/off. Using fsincos is much slower than calling out to runtime.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43891 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 20:19:16 +00:00
vegorov@google.com e8b7f9cb06 Don't constant fold operation if result is incompatible with it.
For example we can't replace BinarySmiOp with Mint constant because we might have removed the checks based on the assumption that BinarySmiOp always returns a Smi.

BUG=http://dartbug.com/22480
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43875 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 13:48:48 +00:00
zra@google.com 1299ad1485 Allows turning on checked mode on a per-isolate basis
using the embedding API.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43481 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 18:32:48 +00:00
srdjan@google.com 12c5e2bbaf Cleanup: use const reference for ParsedFunction where possible.
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43226 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-28 00:41:09 +00:00
srdjan@google.com 110a74f954 Cleanups: parsed_function()->function() => function()
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43213 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-27 22:09:31 +00:00
fschneider@google.com e081d375e4 Fix 64-bit bug in optimized class-check instructions.
The mask is machine-word wide, so the computation of the mask
must not use a 32-bit shift operation.

BUG=dartbug.com/22104
TEST=tests/language/vm/optimized_check_class_test.dart
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43014 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 16:00:43 +00:00
koda@google.com 33b55e64e4 Isolate/Thread split: Isolate -> Zone for LocationSummary.
The isolate was being passed around, even though only its current zone was used.

Pass that zone directly instead, giving two benefits:
1. helps prepare for the upcoming Isolate/Thread split, where "new(isolate)" must go, and
2. saves a pointer indirection at the allocation sites.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42935 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 21:29:57 +00:00
vegorov@google.com cc33fcab6b Handle LoadClassId(obj) === cid during type propagation.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42779 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-12 17:25:22 +00:00
zerny@google.com 786485b43b Use a fixed-size typed array for the dispatch offsets table.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42686 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-08 11:21:29 +00:00
fschneider@google.com 009eb5d33c Move ConstantPropagator from flow_graph_optimizer.cc/.h into separate files.
flow_graph_optimizer.cc is becoming unnecessarily large, so
I'm  moving self-contained optimization passes into
separate files.

In a separate CL I'll also move load/store optimization into
separate files.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42567 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-29 14:41:27 +00:00
srdjan@google.com f116c94dfc Cleanup access to Instruction's fields (especially deopt_id_).
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42405 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 18:27:24 +00:00
vegorov@google.com 9fcfaa8468 Support remaping of pair location inside materializations for slow paths.
Move remaping logic into Location::RemapForSlowPath to ensure that it is shared and will not get out of sync again.

BUG=http://dartbug.com/21887
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42396 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 15:18:51 +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
vegorov@google.com 4b0428dd83 Partially revert r42319 to pacify tests.
I will reconcile UnboxIntConverterInstr::CanDeoptimize and UnboxInt32::CanDeoptimize in a follow up CL.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42322 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-12 16:05:48 +00:00
vegorov@google.com a1b54bb96f When canonicalizing UnboxInt32([tr], BoxInt64()) make sure to mark resulting converter truncating.
We regressed this logic in r41736 when we started to  checking whether current UnboxInt32 can deoptimize, instead of whether it is truncating or not. This was too aggressive.

Additionally fix CanDeoptimize for UnboxInt32([tr], BoxInt64()). It was always returning true because CompileType is not smart enough to encode that Boxing returns either Smi or Mint, which is enough to guarantee that truncating UnboxInt32 won't deoptimize.

R=fschneider@google.com, fscheider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42319 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-12 13:54:23 +00:00