Commit graph

96 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
Srdjan Mitrovic 8e27f43f36 Allocate some data structures in old instead of in new space. Early inlining bailout for native functions. Verify heap after background compiler was shutdown.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1433463002 .
2015-11-02 16:39:22 -08:00
Siva Annamalai 5e4a3d7a65 Add IsMutatorThread to the Thread class and use it instead of MutatorThreadIsCurrentThread
Review URL: https://codereview.chromium.org/1408923005 .
2015-10-26 13:12:10 -07:00
Florian Schneider 9a0b13fe86 VM: Replace CheckedHandle with Cast/Handle in some places.
CheckedHandle are only when entering C++ from native code,
or when calling out via the API.

Otherwise Cast and Object::Handle is sufficient.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1376183002 .
2015-10-21 16:54:50 +02:00
Srdjan Mitrovic ab20fa00da Move no_callback_scope_depth_ and cha_ from isolate -> thread
Add checks for background compilation:
- Dart code may not be invoked
- Object allocation must happen in old space

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1401413002 .
2015-10-13 14:29:43 -07:00
Srdjan Mitrovic e520dd567f Remove isolate argument from handle allocation: Part I
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1393373003 .
2015-10-12 11:32:08 -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: 1d343e5a7b

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
John McCutchan 7052bd6bed Rework service extensions to be safe
- When scheduling a service extension to be invoked, store the closure in an array held in the isolate.
- At the tail of IsolateMessageHandler::HandleMessage, invoke all pending service extension closures.

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

Review URL: https://codereview.chromium.org//1299493007 .
2015-08-27 11:23:39 -07:00
Daniel Andersson 76ff397c1c Migrate LongJumpScope to Thread.
This was one of the blockers for concurrent compilation (issue 24109).

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1299653003 .
2015-08-17 13:29:17 -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
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 40fcf4a72d Handle field-invocation and method-extraction in the runtime when --lazy_dispatchers=false.
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1195573006.
2015-06-30 15:14:35 -07:00
Ryan Macnak 66194d4fc1 Port "Add flag to disable lazy compilation of invocation dispatchers."
Fix InvokeNoSuchMethodDispatcher to propagate with a rethrow instead of a throw.

Fix unit test checking raw stack frames.

R=fschneider@google.com

Review URL: https://codereview.chromium.org//1191813002.
2015-06-18 10:23:39 -07:00
Daniel Andersson fd890f4097 Cache current thread in a reserved register and use it in LoadIsolate
Add THR register that caches the current thread in generated code.
Shuffle some registers around as needed to free one up.

Note: Assembler::LoadIsolate now always loads the *current* isolate whenever the code is executed, rather than the isolate in which the code was compiled (no existing code was affected by this slight change in semantics).

Rewrite some ia32 stubs to use one less register, and for some ia32 bigint intrinsics, explicitly save THR (like CTX in the past, see r44699).

Next steps:
- pass current thread rather than isolate in NativeArguments
- ditto for exception handler jump
- migrate fields vm_tag, top_exit_frame_info, etc. to thread

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156593002
2015-05-26 13:46:12 -07: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
koda@google.com 4c74036e9b To satisfy ASAN, use stub instead of & operator to get C++ stack pointer.
Because of initialization order, this requires slightly different paths for VM isolate and others.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43865 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 04:58:08 +00:00
koda@google.com 4c7e0fa307 Suspend long jump scope when invoking Dart code.
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42880 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-14 18:37:43 +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
fschneider@google.com 1dc4e979d9 Remove isolate pointer from context objects.
By moving all stubs that do runtime calls into the isolate
we don't need to cache the current isolate in each context
object.

This saves space on each context at the cost of duplicating stubs
in each isolate. Most stubs are already isolate-specific and the total number
 of stubs is small enough for this to be a good trade-off.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41279 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 12:19:20 +00:00
johnmccutchan@google.com 3c6822fde3 - Keep track of stack base whenever Dart code is invoked.
- Update stack limit based on stack base.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39613 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 18:28:47 +00:00
asiva@google.com f85f986bda Make isolate specific stub code accessors instance methods instead
of static. This allows use of isolate without having to call
Isolate::Current() when using these accessors.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38040 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 21:25:00 +00:00
koda@google.com d3b9bc5d2e Add Instance::HashCode that matches hashCode.
Implement in C++ for strings and integers.

This is in preparation for internalized hash maps/sets.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37763 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 21:53:05 +00:00
iposva@google.com b4b4889406 - Refined https://codereview.chromium.org/293963008/
Make compilation VM more fine grained

- Use the isolate where appropriate.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36451 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-21 21:04:03 +00:00
iposva@google.com fd8565b071 - Add a minimal implementation of Capability.
- Make RawReceivePort and SendPort VM internal objects.
- Rationalize the creation of ports and their handling within the VM.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35325 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 19:44:03 +00:00
zra@google.com 2fe51715e5 Begins work on ARM64, first assembler test.
Most new code is in constants_arm64.h and
{assembler,disassembler,simulator}_arm64.{h,cc}

The rest of the CL just #def's out tests, modifies status files,
and adds UNIMPLEMENTED functions, etc.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34654 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-02 17:39:32 +00:00
iposva@google.com 0977a3bf2b - First step in refactoring ports with the goal of moving
them closer into the VM implementation.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34438 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-26 17:30:39 +00:00
fschneider@google.com 16857e0b13 Revert r32930 (Add more timing information in the VM to track time...)
It caused severe performance regressions that should be addressed.

TBR=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32959 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:15:55 +00:00
asiva@google.com 6d313d3797 Add more timing information in the VM to track time spent is dart code Vs native code.
R=johnmccutchan@google.com, turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32930 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 21:30:29 +00:00
iposva@google.com 781f737c6a First round of http://dartbug.com/15922:
- Address warnings about 64-bit to 32-bit conversions.
- Remove heap profiler.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31867 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-16 05:05:35 +00:00
johnmccutchan@google.com c76b6eb1c2 Split service into VM and embedder specific bits.
Move most service sources into the VM.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31809 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-14 22:34:43 +00:00
iposva@google.com 1e8061f060 - Remove the reply_port from the VM internal message object.
- Adjust all the uses of this API.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31205 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-17 21:11:18 +00:00
asiva@google.com 545bec0843 Cleanup StaticResolveType, it does not seem to be used anywhere.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29696 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 20:41:59 +00:00
floitsch@google.com 6a72655d1b Very simple version of Isolates.
R=ajohnsen@google.com, iposva@google.com, kasperl@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29271 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-25 19:23:00 +00:00
regis@google.com 9ec07853c5 Report correct error message in case of super invocation (fix issue 8208).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29042 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 22:12:07 +00:00
hausner@google.com fd57843900 Update handling of ambiguous name references
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
2013-09-09 21:52:40 +00:00
rmacnak@google.com d7d3588a55 Support named and optional positional arguments in reflective invocation.
R=ahe@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27134 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 17:12:28 +00:00
iposva@google.com 54b3efeede - Remove unused run state from the isolate.
Review URL: https://codereview.chromium.org//22477005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25909 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-08 01:02:13 +00:00
fschneider@google.com eae62fa866 Improve performance of Dart_ListGetAsBytes.
This fixes two performance issues with Dart_ListGetAsBytes:

1. Avoid excessive handle allocation when copying from a generic List.

2. Add a fast path when copying from byte-size typed data view objects. The
old version only supported typed data, but no views.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25731 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-02 11:32:05 +00:00
regis@google.com b55b249409 Delay resolution of redirecting factory targets in order to avoid class
finalization cycles (issue 12041).
Ensure that a super class is finalized before the class extending it.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25532 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-26 18:18:56 +00:00
regis@google.com 9581071936 Refactor resolution code in the vm to properly handle ambiguity errors.
Add test.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25324 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 00:19:39 +00:00
mlippautz@google.com 7021e5bbe1 Rename: DartLibraryCalls::ExceptionCreate -> InstanceCreate
BUG=
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25246 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 21:49:45 +00:00
fschneider@google.com dfd21c06e0 Change resolving of instance methods to check early for name mismatch.
The names of actual arguments are checked at resolving time
for a mismatch instead of deferring this check to the function
prologue (emitted as part of the CopyParameters() prologue).

For example:

class A {
  foo({a:42}) => null;
}

main() {
  var a = new A();
  a.foo(b:123);  // noSuchMethod: no named parameter named "b".
}

This enables e.g. fast noSuchMethod invocation in the case
of a named argument mismatch.

It also makes the function prologue for instance functions that
use optional parameters shorter by omitting the check for a 
name mismatch there.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25041 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-16 09:38:13 +00:00
rmacnak@google.com 39bf0aca44 Implement the invoke methods (invoke, getField, setField, newInstance, apply) as internal natives.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25024 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-15 21:14:43 +00:00
fschneider@google.com d77d1eac90 Correct handling of named optional parameters with noSuchMethod invocations.
This CL fixes a performance bug with noSuchMethod and named parameters. It also
simplifies the platform-specific code by removing special casing for the
noSuchMethod-dispatcher functions in the flow graph compiler.

Before using named optional parameters would still go through the slow
runtime in certain conditions: When running without inlining, or when
the dispatcher function was not inlined because of e.g. inlining size
heuristics, noSuchMethod would be slow if invoked with named parameters.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24906 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-11 10:01:50 +00:00
hausner@google.com 1e955965df Better single stepping in VM debugger
Single stepping now steps into the next dart code that the
user is interested in, including from one asynchronous task
to the next.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24632 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-01 17:29:18 +00:00
asiva@google.com 16c945cb88 Minor cleanups to use null_array(), null_object() and null_string() handles.
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24247 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-20 19:49:30 +00:00
srdjan@google.com 5543ce104c When canonicalize instances check if all fields are canonical. If a field is a non-canonical number or strings, canonicalize it. Otherwise report an error if a field is not canonical.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23934 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-12 21:27:37 +00:00
kmillikin@google.com 4ca50f4f39 A few simple cleanups.
* Remove BlockEntryInstr::PrepareEntry and use EmitNativeCode to emit the
  native code.
* Use Array::element_offset in a few places.
* Comment and identifier fixes.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22924 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-21 09:34:50 +00:00