Commit Graph

80 Commits

Author SHA1 Message Date
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
zra@google.com daf539e2f9 Fixes a couple problems with GC of unoptimized code.
1. Instead of making a pass before the Marking phase,
   this change does not visit code pointers in functions
   during marking. Then after marking, if the code has
   still not been marked, code pointers in functions
   are nulled out.
2. Since code pointers in functions may be nulled out,
   functions are no longer used as proxies for code in
   deoptimization info.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30600 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-23 00:17:28 +00:00
zra@google.com 136597ec7d Pushes 0 for PC marker in runtime call stubs on ARM and MIPS.
R=iposva@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30555 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-21 23:18:53 +00:00
asiva@google.com eaebf15f43 Fix for issue 14790 - Crash when using dartium devtools
The stack frame iteration during GC was missing one slot in stub frames that
did not save the pool pointer.

- This change makes all stub frames uniform, i.e they always save/restore the pool pointer. This ensures that we will traverse all slots on the stack.

- A new constant called kFirstObjectSlotFromFp has been added which is used as the slot to start stack traversal.

(The ARM and MIPs changes will be in a different CL)

R=iposva@google.com, regis@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30088 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-08 00:25:40 +00:00
turnidge@google.com b15b2931e0 Allow the debugger to inspect local variables from optimized and
inlined frames.

------------

Most remaining deoptimization code from the code generator moves to
DeoptContext.  This allows the code to be reused by the debugger.
There is some rework of the code along the way.  The remaining code in
the code generator is simpler.

Implement the ability to deopt a frame to an Array.  Each inlined
frame accesses its locals from this array at some fixed offset.

Refactor the Debugger::CollectStackTrace code.  New code is int
Debugger::CollectStackTraceNew.  There is a flag --use_new_stacktrace
which can be used to revert back to the old version.  I intend to
remove this flag shortly, after any dust clears.

Added a unit test which makes sure that we can inspect locals from
optimized and inlined frames.  Tested this code in the dart editor
debugger as well.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28468 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-10 18:15:53 +00:00
srdjan@google.com 8cd4bf5b92 Change inlined stack frame iterator to use code and pc instead of frame.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27140 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 19:36:20 +00:00
srdjan@google.com cfb81a40aa Last round of cleanups in exception handler, before going to the next stage.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26941 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-30 20:47:02 +00:00
iposva@google.com da4806e40c - Reapply change r26880.
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26933 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-30 18:01:18 +00:00
kmillikin@google.com ea5dfcd2e4 Revert "Compress memory usage. Imprive speed of finding exception handle..."
This reverts svn revision 26880.  That change has broken stack traces for
exceptions, making it impossible to use them for debugging Dart code.

BUG=https://code.google.com/p/dart/issues/detail?id=12940

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26909 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-30 11:19:22 +00:00
srdjan@google.com e8117fea14 Compress memory usage. Imprive speed of finding exception handlers: if a code does not have any handlers, do not reaverse the PC descriptors.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26880 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-29 16:47:49 +00:00
srdjan@google.com e06ea63b60 Mark exception handlers if they have a stacktrace specified. Do not build a stacktrace if the handler has no stacktrace.
R=asiva@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26823 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 22:42:21 +00:00
jacobr@google.com 605b33c1bc fix cpp11 compile errors
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
regis@google.com d7f7604cf0 Implement backtracing and toggling of execution tracing in ARM simulator.
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22967 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-21 22:07:55 +00:00
regis@google.com 53347a3337 Remove stack_frame_<arch>.cc files.
The architecture specific information is in stack_frame_<arch>.h files.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22470 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-07 18:06:21 +00:00
vegorov@google.com 9f3783186f Ensure that all goto instructions have deoptimization target.
R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21351 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 11:19:34 +00:00
regis@google.com 7b5a610084 Make allocation of Dart parameters and local variables architecture independent.
Enable a couple more vm tests on ARM.
Fix function usage counter access on ARM.
Review URL: https://codereview.chromium.org//12776006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20048 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 21:33:03 +00:00