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
This also covers "closurization" of the .call method.
This relies on the fact that f.call === f if f is a closure.
This means that adding a simple getter to _FunctionImpl that
returns this is enough. No need for a separate dispatch.
This CL reverts the previous fix for issue 12602 (modulo the
additional tests).
BUG=dartbug.com/17473, dartbug.com/12602
R=iposva@google.com
Review URL: https://codereview.chromium.org//200193002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33736 260f80e4-7a28-3924-810f-c04153c831b5
Calling closures via .call does now work in the VM - it was working in
dart2js already. Calling .call on a closure is implemented to go through
a dispatcher method. These dispatcher methods are automatically created and
cached in the same way as NoSuchMethod- or field-invocation dispatchers.
This CL does not change the way regular closure invocation works in
the VM. It is therefore performance-neutral for normal closure calls.
BUG=dartbug.com/12602
TEST=language/call_test
R=iposva@google.com
Review URL: https://codereview.chromium.org//188703004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33576 260f80e4-7a28-3924-810f-c04153c831b5
A name that is not resolved in the local scope gets looked up
in the global scope of the library to which the code being compiled
belongs. The local name dictionary gets searched first, then the
dictionary of each imported library (and and their re-exported
libraries.) Each dictionary lookup includes the lookup of the
mangled getter and setter names, which means that we concatenate
the same name many times.
This change introduces a cache that stores the result of a previous
name lookup, including negative lookup results. The latter is important
to speed up the resolution of names that are not in the global name
space, e.g. class members like .length in lists.
Experiments running dart2js (with VM option --compile_all) show
that this reduces the number of name mangling calls by a factor of 10
and speeds up compiling dart2js by 15%.
R=asiva@google.com
Review URL: https://codereview.chromium.org//135123011
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32385 260f80e4-7a28-3924-810f-c04153c831b5
Remodel the top-level isolate summary page.
Add variables to stack frames in the stack trace.
Stop putting small integers and bools in the object id ring.
Rework how we pass down null references (and null-like references like
uninitialized values).
Collect all isolate timers by default.
Change the lifetime of IsolateSpawnState so that we can refer to it
later to know how an isolate started up. Stop pretending that
IsolateSpawnState is a void*. Clean up vestigial IsolateStartData.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//145323002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32128 260f80e4-7a28-3924-810f-c04153c831b5
No need to halt on single step if there is a breakpoint on the
same location. While looking at the resulting test failures, I
discovered that the step_in_equals test was not at all testing
what it was meant to test. It happened to pass because of a
related bug in the parser. Decided to abandon that test and
instead check that we can break at == even if one of the operands
is null.
Added ability to match line numbers in the debugger tests.
R=regis@google.com
Review URL: https://codereview.chromium.org//135843003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31898 260f80e4-7a28-3924-810f-c04153c831b5
- Identify a source breakpoint by a script and a token position
rather than a function object.
- When a new breakpoint is set, iterate over all compiled functions
to see whether code breakpoints must be set.
This change fixes issues with functions that get compiled several
times, for example as implicit closures or a copies of mixin
functions or local closures of mixing functions. We did not detect
all duplicates of functions.
Eliminated recently introduced const modifiers in SourceBreakpoint
class. They tend to be in the way because several accessor methods
of SourceBreakpoint compute data lazily and modify the object as a
side effect.
Review URL: https://codereview.chromium.org//117133005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31372 260f80e4-7a28-3924-810f-c04153c831b5
This will allow us (later) to make nice descriptions of the state of
an isolate, e.g. "isolate 7112 is paused due to breakpoint 2" or
"isolate 7112 is paused due to interrupt" or "isolate 7112 is
running".
Use a new Pause() function to call the event handler during a pause.
It does some shared checking, setup, teardown.
Minor change in isolate interrupt handling - before we were not
setting 'in_event_handler_' in this case. Now we set 'pause_event_'
here, which will guard against recursive pauses in this case.
Reviewer: not sure what I think about all the names I used here.
"pause_event_" is very similar to PausedEvent but means something
different, as it includes pauses, interrupts, and (maybe) exceptions.
Dunno.
R=hausner@google.com
Review URL: https://codereview.chromium.org//118603002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31356 260f80e4-7a28-3924-810f-c04153c831b5
some breakpoints to be skipped when set in optimized closure
functions.
Update implicit_closure_function() to always return null for
factories. Factories use the shared data_ field for another purpose.
This fixes an assertion failure when HasImplicitClosureFunciton is
called for a factory.
Add a TODO for an assertion failure in Class::Name which is not in the
scope of this change.
(patched from an earlier review)
Review URL: https://codereview.chromium.org//64173005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30063 260f80e4-7a28-3924-810f-c04153c831b5
The AST for static getters differs between parsing the first time, and
subsequent parsings. This leads to a mismatch in deoptimization-ids
between the optimized and the unoptimized code.
This CL avoids creating different ASTs for the same static getters. To allow
better inlining of these getters, the initialization expression is wrapped in a
hidden static initializer-function. As a result the size of such getters is
constant and does not depend on the initializer expression.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//51123003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29680 260f80e4-7a28-3924-810f-c04153c831b5
- Make sure to keep the main/control port opened until the
isolate is finished.
- Account for the number of opened control ports to be able
to determine whether there are live ports.
- Ensure that the spawned isolated is kept alive until the
initial startup message can be handled.
- Add more isolate tracing output.
- Use the control port for the debugger id.
Review URL: https://codereview.chromium.org//47573002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29323 260f80e4-7a28-3924-810f-c04153c831b5
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
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
Update VM to latest spec. Referencing a name that is imported
from more than one library is no longer a compile-time error.
If one of the sources of an ambiguous reference is a dart library,
the dart library declaration is automatically hidden.
Also fixes a bug where looking up a getter name in a library
found the getter even though the name is filtered out in the
'hide' combinator.
Long-term we should fix the need for repeatedly convert between
the mangled getter and setter names and the untangled name.
Fixes 12915, 12913, 12724.
R=regis@google.com
Review URL: https://codereview.chromium.org//23484020
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27312 260f80e4-7a28-3924-810f-c04153c831b5