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 .
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 .
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 .
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 .
- 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 .
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 .
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 .
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.
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
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
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
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