Commit Graph

95 Commits

Author SHA1 Message Date
Vyacheslav Egorov 28046fcf7d VM: [DBC] Fix GetDeoptFpOffset in the presence of materializations.
Number of materializations was not taken into account when computing FP offset
on DBC.

This fixes flaky crashes on language/vm/optimized_stacktrace_test.

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

Review-Url: https://codereview.chromium.org/2571843002 .
2016-12-13 18:53:31 +01:00
John McCutchan f125cc7d0b Improve the casing of Stackmap and Stacktrace.
- [x] Stackmap -> StackMap
- [x] Stacktrace -> StackTrace

This makes us consistent with the Dart language (StackTrace) and
corrects the casing of StackMap.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2572563004 .
2016-12-12 14:51:30 -08:00
Florian Schneider ff483c2a78 VM: Fix potential problem with visiting stack frames.
LookupDartCode would only return a non-null coe object for regular functions,
but not for stub code objects.  We should also visit pointers for stub code objects.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2528433007 .
2016-11-29 09:57:05 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Ryan Macnak 1c23917b09 Remove frames skipped by a throw from the lazy deopt table.
Be careful to unmark the frames first so stack walks can still succeed. Likewise update the frame before removing the table entry in DeoptimizeCopyFrame.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2396433003 .
2016-10-04 15:12:54 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
Ryan Macnak 708334c614 DBC: Fix reading locals out of a deopt frame.
R=zra@google.com

Review URL: https://codereview.chromium.org/2176413003 .
2016-07-26 10:36:07 -07:00
Vyacheslav Egorov 655bc90489 Enable optimizer pipeline for DBC.
Most of the infrastructure is fixed to work with DBC stack layout:

- register allocator allocates DBC registers with the limitation that we allocate only 20 registers and bail out if anything needs spilling (there is no use implementing spilling on DBC because registers are memory locations themselves). We should be able to bump number of CPU registers on DBC up to 256 but this requires major surgery in some parts - so I postponed this;
- lazy deoptimization is implemented, eager deoptimization is not - because we don't emit any code that actually requires it. it's a minor change to support it once we have a target;
- stack scanning respects stack maps built by registers allocator;

We bailout from all unsupported instructions.

R=zra@google.com

Review URL: https://codereview.chromium.org/1992963002 .
2016-05-24 14:35:50 +02:00
Ryan Macnak f7a3e215a5 Undo "Don't include an object header for instructions in the text section."
This undoes most of b2f3e8efe1.

This optimization prevents precompiled code from being disabled and re-enabled, because disabling causes the code to lose its only reference to its own instructions. This was okay for precompilated code that ran without a JIT because it is never disabled, but precompiled code that runs in a JIT will become disabled when corresponding optimized code is compiled and re-abled after a deopt.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1925153003 .
2016-05-03 11:22:28 -07:00
Zachary Anderson a1d241922f Adds more DBC assembler tests.
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1944503002 .
2016-05-03 09:01:11 -07:00
Vyacheslav Egorov ee0f608ce4 Dart Byte Code interpreter.
This version is Clang/GCC only and does not support Windows because it uses computed goto's.

Only unoptimized mode is supported.

Architecture is described in constants_dbc.h and stack_frame_dbc.h.

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

Review URL: https://codereview.chromium.org/1858283002 .
2016-04-18 23:02:01 +02:00
Ryan Macnak b2f3e8efe1 Precompilation: don't include an object header for instructions in the text section.
Reference Instructions only through Code::entry_point_ (or Function::entry_point_). Store the instructions size in its corresponding Code object.

precompiled dart2js x64 22163470 -> 21621102 (-2.45%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1808553002 .
2016-03-29 11:04:04 -07:00
Srdjan Mitrovic 389dad87f7 Fix stub frame walking: when materializing the frame content during deoptimization, the stack is not yet set up properly (missing code object). This happens when background compiler requires GC.
Revert fixes other crashes in stack walk.
Revert "Reapply "Remove Code::active_instructions_.""

This reverts commit 28846c4bd4.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1830733002 .
2016-03-23 14:43:02 -07:00
Florian Schneider 72a815c39f VM: Add smi fast path operations for precompiled code
The non-smi case is handled in a slow-path deferred code path.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1756403002 .
2016-03-04 09:33:09 -08:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

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

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
Siva Annamalai 9e19d236ca - Add an OSThread structure which is the generic TLS structure for all C++
fields in a thread (i.e fields that are not Dart VM related)
- Split the Thread structure to be a pure Dart per thread structure and add
  a pointer to os_thread which points to the OSThread structure
- Change Schedule/UnSchedule to set the Dart Thread structure as the TLS of
  the thread when it is inside the Dart world and reset the TLS back to the
  OSThread strcuture when is exits the Dart World.
- Moved the stack_base and few stack size related functions to OSThread from Isolate

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

Review URL: https://codereview.chromium.org/1439483003 .
2015-11-19 13:45:10 -08:00
John McCutchan 24ceded4e9 Pass Thread into StackFrameIterator
- StackFrameIterator is now constructed with a Thread instead of an Isolate.
- Profiler provides Thread to StackFrameIterator- allowing this to work on Windows.

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

Review URL: https://codereview.chromium.org/1411703004 .
2015-10-21 07:37:22 -07:00
Srdjan Mitrovic 769119b067 Fix windows build
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1422453002 .
2015-10-20 14:23:03 -07:00
Srdjan Mitrovic b9426418d8 Get rid of deprecated methods accessing mutator_thread_ instead of current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1410643008 .
2015-10-20 10:26:08 -07:00
Srdjan Mitrovic 53e814f0dd Move reusable handles from isolate to thread.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1394673002 .
2015-10-09 10:10:34 -07:00
Srdjan Mitrovic 8c7a94e9f4 Preparation for moving reusable handles to thread and more cleanups: isolate -> thread based handle allocation.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1384403002 .
2015-10-06 10:17:12 -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
Daniel Andersson c089a152ac Migrate most uses of Isolate::current_zone to Thread::zone.
After https://codereview.chromium.org/1204303003/ is submitted, the last remaining uses can go.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1220193009 .
2015-07-08 09:59:32 -07:00
Florian Schneider 265a54411a Object pool with support for untagged entries.
This adds meta-information to object pool entries to allow storing
untagged immediates or code addresses (ExternalLabel) directly.

This eliminates the need to generate extra code to preserve the LSB
when storing immediates as smis (x64, arm64).

BUG=

Review URL: https://codereview.chromium.org//1175523002.
2015-06-10 11:41:22 +02:00
fschneider@google.com 4aa1febbe6 Eliminate object table and use regular object pool for deoptimization infos.
On platforms that already use an object pool, we had a separate object table
used only for deoptimization infos. With this CL we don't have separate
tables, but only use the common object pool for both purposes.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45108 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 15:43:58 +00:00
vegorov@google.com 3062d3bae0 Compress deopt instructions in memory using variable length encoding.
Remove DeoptInfo type entirely and store compressed instructions in the TypedData.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44966 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-08 13:08:36 +00:00
koda@google.com e3a345a84b Rename NoGCScope -> NoSafepointScope.
The old name makes less sense in the context of concurrent GC (and multiple threads in general).

Document the intended semantics of this (DEBUG-only) guard scope.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44616 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-20 22:08:25 +00:00
fschneider@google.com b79f717e89 VM: Use PC offset instead of absolute PC in exception handler info.
Similar to the change I did for PC descriptors: We can save space by
using a uint32_t for the offset, instead of a uword for the absolute pc.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43138 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 15:40:06 +00:00
fschneider@google.com dd824bd017 Store pc offset instead of absolute pc in the pc descriptors.
This saves space on 64-bit platforms as the offset is stored
as a uint32_t compared to a pointer-size absolute address.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43100 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 12:30:11 +00:00
koda@google.com 08edbbd6b4 MemorySanitizer support.
Enables building (including generating snapshot) and running simple scripts under MemorySanitizer.
Not all tests pass yet.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42561 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-23 01:07:58 +00:00
fschneider@google.com 876193b31a Make CTX allocatable by the register allocator.
This change makes CTX available by not caching the current
context while in Dart code. Instead the current context
is held in a local variable (:saved_current_context_var) and
is passed as argument in CTX at calls.

This also simplifies a lot of code in the debugger: As a result,
Isolate::top_context is not needed anymore since the current context
can always be extracted from a Dart frame.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41422 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-30 15:42:38 +00:00
vegorov@google.com e6113cc0f5 If bounds check 0 <= index < length is not redundant we attempt to
replace it with a sequence of checks that guarantee

          0 <= LowerBound(index) < UpperBound(index) < length

and hoist all of those checks out of the enclosing loop.

Upper/Lower bounds are symbolic arithmetic expressions with +, -, *
operations and are computed based on discovered simple induction variables.

Simple induction variable is a variable that follows the pattern v1 <- phi(v0, v1 + 1)

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40969 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-07 18:50:29 +00:00
hausner@google.com 48807614ee Eliminate 99% of allocated ExceptionHandler objects
The vast majority of functions have no exception handlers, thus they can all
share a single ExceptionHandler descriptor.

This CL reduces the number of ExceptionHandler objects on the heap from
about 8400 to 16, from 132KB to less than 1KB, when running dart2js.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40323 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-16 16:27:04 +00:00
zra@google.com c686b2c624 Finishes removing intptr_t from raw object fields.
Also removes {Read,Write}IntptrValue from the snapshot reader and writer.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40048 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-09 19:51:22 +00:00
zra@google.com 5d3f4708ec Fixes to support ARMv5 lego mindstorm.
1. Deopts on division when neither vfp nor idiv are present.
   In a subsequent CL, I can add a leaf runtime call for this.

2. Uses a different PC read offset in STR and STM instructions.
   On ARMv5 and earlier, the PC read offset is 8 except in STR
   and STM instructions, where it is implementation defined. On
   lego mindstorm it is 12. This requires changing
   kEntryPointToPcMarkerOffset to be a function.

3. Uses a dummy struct to compute the size of a compressed
   pc descriptor to avoid alignment issues. sizeof(PcDescriptorRec)
   is 16 on ia32 and arm. Subtracting sizeof(int16_t) gives 14,
   which creates alignment problems on ARM, i.e. poor performance on
   ARMv6 and later, and wrong results on ARMv5 and earlier.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39250 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-14 15:42:00 +00:00
srdjan@google.com 154eb30f58 ONe more iteration of PcDesacriptor iterator imporvement: do not copy record but access individual values when needed.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38408 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-18 20:11:29 +00:00
srdjan@google.com 1259bda234 Fix PcDescriptor iterator to never return a pointer to a memory location since the PcDescriptor can move with the GC.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38338 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-17 18:30:38 +00:00
srdjan@google.com 9c8a395f6f More PcDescriptor cleanups, compress recors if no try index is needed (frequent).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38242 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-15 17:07:03 +00:00
srdjan@google.com 4c69c06f27 Specify descriptor kind to iterate on.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38128 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-10 19:44:49 +00:00
srdjan@google.com 2bb77cd8d5 Iterate over PcDescriptors only via iterators, not via an index. (preparation for more compression of PcDescriptors).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38032 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 18:25:45 +00:00
johnmccutchan@google.com 9812f8a581 - Enable top exit frame profiler mode by default
- Final Windows fixes for using StackFrameIterator from different thread.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37918 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 22:21:43 +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
rmacnak@google.com 7ce5c53f0b Pass around the current isolate in exception handling code.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37409 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 18:17:03 +00:00
regis@google.com e0ab99b0b2 Remember all deopt reasons in ic_data, not just the last one.
Remember if a JS warning was issued in ic_data.
Save a word in ic_data on 64-bit platforms.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35457 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 23:45:14 +00:00
turnidge@google.com 110570e9fe Fixes a problem with the recovery of contexts in the debugger at closure calls.
When we call a closure, the caller saves the context before the call.
So when walking the stack, we used to check the callee activation to
see if it was a closure call, and then recover our caller-saved
context.

This breaks down in the following case:

1. Caller calls function F.
2. Function F is compiled.
3. The compiler needs to run code to evaluate a constant (e.g. a
   static final getter).
4. We hit a breakpoint *while* evaluating the constant.

In this case, there is no callee frame for the closure call yet.

I fix this by using the the pc descriptors to see if the current pc in
the caller is a closure call.  This avoids needing to have a callee
frame available.

---

ALSO:

New flags:

--verify-incoming-contexts: in development - verify assumptions about
  contexts in stub code. (currently ia32 only)

--trace-debugger-stacktrace: this helps debug these kinds of
  stacktrace issues.

Miscellaneous improvements to frame and context printing.

BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35130 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-16 20:03:30 +00:00
srdjan@google.com d7ea982b3f When deoptimizing use the code stored in the deopt information instead of current unoptimized code (could be different once deferred loading comes in).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34259 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-21 17:32:59 +00:00
johnmccutchan@google.com e9e54f6af6 Cleanup native, collected, and stub code handling in profiler
R=iposva@google.com, turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33177 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-28 22:55:53 +00:00
turnidge@google.com 21f92bfa63 Don't forget to subtract materialization instructions when computing the offset of the frame pointer after deoptimization.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32773 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 01:02:09 +00:00