Commit Graph

82 Commits

Author SHA1 Message Date
asiva@google.com 9e7f76623a Reuse the top ApiLocalScope so that we do not allocate and free an ApiLocalScope
for each Dart_EnterScope/Dart_ExitScope sequence.

The runtime of UseDartApi benchmark on linux ia32 improves from
187316 to 121083.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25292 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 18:46:14 +00:00
iposva@google.com 364a9b28a9 - Adjust parameter types for Dart_NewWeakReferenceSet implementation.
Review URL: https://codereview.chromium.org//16247002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23436 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-30 18:52:06 +00:00
iposva@google.com b60d09b1fb - Add different types for persistent and weak persistent handles
in the Dart C API.
- Adapt code in the runtime.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23421 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-30 15:55:59 +00:00
vegorov@google.com ec1f97d4a2 Fix clang unused-private-field error.
../../runtime/vm/dart_api_state.h:736:18: error: private field 'key_' is not used [-Werror,-Wunused-private-field]
  ThreadLocalKey key_;
                   ^
R=scheglov@google.com
TEST=ninja -C out/Debug
Signed-off-by: Thiago Farina <tfarina@chromium.org>

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

Patch from Thiago Farina <tfarina@chromium.org>.

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21778 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-19 22:42:46 +00:00
regis@google.com 05e2ba9540 Support FrameLookup vm test on ARM, requiring among other things:
Maintain a separate top_exit_frame_info for simulated frames and use it to
verify that longjumps are safe.
Make sure unwinding of scopes works in the presence of a simulator.
Support inline allocation of objects.
Support checking of inline cache and instance calls.
Support subtype test cache.
Support (some) equality checks.
Support for (some) conditional branches.
Support for pool pointer setup in stubs.
Review URL: https://codereview.chromium.org//13502002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20890 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-03 20:17:14 +00:00
asiva@google.com 647d060f10 - The callback_error_ handle was never being setup.
- Remove some unnecessary DARTSCOPE calls when true/false/null Dart_Handles are
  created.
Review URL: https://codereview.chromium.org//13171004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20701 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-30 00:07:13 +00:00
asiva@google.com c64871d699 First set of changes towards cleaning up the bytearray access APIs
- Added unimplemented versions of Dart_ByteArrayAcquireData and
  Dart_ByteArrayReleaseData
- Added infrastructure to prevent callbacks into an API function that
  allocates a new object on the Dart heap or invokes dart code.
- Removed the old Dart_ByteArrayGet* access functions as it was felt that
  they have become redundant once we provide direct access to the internal
  data pointers.
- Removed DARTSCOPE_NOCHECKS as it seems to be redundant after the change
  to not create explicit stack zones on each Dart API call.
Review URL: https://codereview.chromium.org//12036098

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17958 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 23:56:48 +00:00
asiva@google.com f644dfc14e Fix for issue-7157 - set the stack marker in the top API local scope just before entering dart code. It used to be set in Dart_EnterScope and this was causing problems as the marker could potentially end up being lower than the stack pointer at the time of entering Dart code resulting in an destruction of the top scope during 'state->UnwindScopes(...)'
Review URL: https://codereview.chromium.org//12118002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17939 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 19:16:47 +00:00
asiva@google.com a02f310d91 Added code to trace zone and handles creation/deletion under flags
--trace-zone and trace-handles
Review URL: https://codereview.chromium.org//11879005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17001 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-12 00:33:16 +00:00
asiva@google.com 4c069867e4 - Make Boolean 'true' and 'false' singleton VM isolate objects.
- Change all uses of it
Review URL: https://codereview.chromium.org//11745022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16623 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-04 01:52:05 +00:00
tball@google.com 2cd8436c5a Changed StackZone and ApiZone to be containers for Zone.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13707 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-16 22:05:40 +00:00
tball@google.com 76d7c9b105 Renamed Zone->StackZone, BaseZone->Zone, in preparation for changing isolate->get_zone() to return what was called the BaseZone instead of its wrapper. The GetBaseZone() methods were not renamed, to help the next CL.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13314 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-05 19:52:55 +00:00
cshapiro@google.com 5665da6258 Revert "Revert "Finalize reachable weak persistent handles at isolate shutdown.""
This reverts commit d701af3a2c8a7169898adcb38fe9da0a667ae7ff.

Review URL: https://chromiumcodereview.appspot.com//10928065

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12072 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-07 22:17:56 +00:00
turnidge@google.com 9a0cbfe8da Make fewer assumptions about the layout of api handles.
Found these problems by changing the layout and seeing what broke.
Review URL: https://chromiumcodereview.appspot.com//10915015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11647 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 19:40:27 +00:00
turnidge@google.com 2803d78dfd Change the zone allocation api.
Instead of passing a size in bytes to the allocation function, we now
have a templatized Alloc function:

  zone->Alloc<Type>(len)

This is better for security, as we can check for integer overflow in
the size computation before performing the allocation.  Before, we
often failed to check this.
Review URL: https://chromiumcodereview.appspot.com//10836061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10254 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 21:51:44 +00:00
cshapiro@google.com d11bc69870 Rename WeakReference to WeakReferenceSet.
This makes room for naming other weak reference types.

Review URL: https://chromiumcodereview.appspot.com//10824053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9970 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 23:52:20 +00:00
antonm@google.com 0ccc21fc5a Fix Mac build.
TBR=iposva@google.com

Review URL: https://chromiumcodereview.appspot.com//10388075

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7503 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-10 18:06:00 +00:00
turnidge@google.com 9731c1c254 Rename Api::NewLocalHandle -> Api::NewHandle.
Api::NewHandle now takes a RawObject* intead of an Object&.
- This makes the code shorter and easier to read.
- This allows us to drop the DARTSCOPE from Dart_GetNativeArgument.
  (6% speedup on Benchmark_UseDartApi)
Review URL: https://chromiumcodereview.appspot.com//10014002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6283 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-06 17:05:50 +00:00
cshapiro@google.com f4c5dd4db3 Implement prologue weak persistent handles.
Prologue weak persistent handles are similar to weak persistent
handles but exhibit different behavior during garbage collections that
invoke the prologue and epilogue callbacks.  While weak persistent
handles always weakly reference their referents, prologue weak
persistent handles weakly reference their referents only during a
garbage collection occurs that invokes the prologue and epilogue
callbacks.  During all other garbage collections, prologue weak
persistent handles strongly reference their referents.

Review URL: https://chromiumcodereview.appspot.com//9655011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5445 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 23:41:59 +00:00
cshapiro@google.com 05fc273cfa Implement weak references sets and provide an embedding API.
Weak reference sets are similar to "populations" or "weak pairs".
Like these structures, objects in a key set preserve members of an
associated value set.  Unlike these structures, a weak reference set
is not a general associative container.  Weak reference sets exist
for the duration of a garbage collection.

Weak reference sets are proceesed iteratively allowing values of one
weak reference to be keys of a other weak reference sets.  The garbage
collector will process weak reference sets iteratively, revisiting all
unmarked weak reference sets if any one weak reference set is marked.
This process repeates until a fixed-point is reached.

Review URL: https://chromiumcodereview.appspot.com//9531001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4917 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-03 02:30:20 +00:00
cshapiro@google.com fb485357cb Thread the weak persistent handle free-list through the raw_ field.
As free-list pointers are either the address of the next free handle
or NULL, raw_ fields should conveniently appear as a smi and be
ignored during weak reference processing.  Ordinary persistent handles
already reuse the raw_ field for this purpose and rely on confusing
free-list links with tagged smi values.

Of course, nothing strictly requires that the addresses of handles be
aligned in just the right way.  So, just in case, new asserts check
that raw_ field values are not confusable with tagged heap addresses.

Review URL: https://chromiumcodereview.appspot.com//9413003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4423 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 03:52:12 +00:00
sgjesse@google.com 2df1d80a02 Add API function Dart_ZoneAllocate
This provides the embedder with the option for allocating temporary C
objects in the current ApiZone.

Zone allocation is especially useful when building a graph of
Dart_CObject structures for posting using Dart_PostCObject.

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

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9347040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4348 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-17 07:43:24 +00:00
cshapiro@google.com 44daee3e6c Ignore deleted handles when processing weak roots.
Previously, deleted weak persistent handles in live handle blocks were
always assumed live.  With this change, dead handles are always ignored.

When a handle is deleted NULL is stored into the raw object member. This
looks like a Smi encoded 0.  As the handle blocks do not otherwise encode
which elements are live in an allocated block, the garbage collector now
uses this signal to distinguish live handles from deleted handles.

BUG=1640

Review URL: https://chromiumcodereview.appspot.com//9398014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4291 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-15 20:56:15 +00:00
cshapiro@google.com e8f396df7e Add external byte array API and finalize external strings and byte arrays.
This change adds peer and callback arguments to the external byte array
constructor and moves the peer, callback, and data storage into a VM
peer object.  At construction time, a weak persistent handle and VM
callback is associated with the VM peer.  The VM callback will delete
the VM peer and invokes the user callback to reclaim the user peer.

This change also activates the callback support for the various classes of
external strings.

Review URL: https://chromiumcodereview.appspot.com//9368049

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4164 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-11 04:34:44 +00:00
sgjesse@google.com ff3c5e88f1 Add support for byte arrays to native messages
R=asiva@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9348019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4071 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-09 09:34:31 +00:00
sgjesse@google.com 3481c5661a Decode the Dart message into a Dart_CMessage structure before calling the native port callback
The native port callback is now passed the message as a decodes
Dart_CMessage structure. The Dart_CMessage structure is allocated
in a zone and the callback receiving it should expect the
lifetime to be controlled by the caller.

Added support for zones which do not require a current
isolate. Changed the GrowableArray to support allocating in
aprovided zone instead of the zone for the current isolate.

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

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9325022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4068 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-09 08:47:19 +00:00
cshapiro@google.com 917bbbfc39 Provide API support for weak handles and post-mortem finalization.
In addition, this change separates the storage of weak persistent
handles from ordinary persistent handles.  An ordinary persistent
handle now stores no other data than the raw pointer value.

Review URL: http://codereview.chromium.org//9148051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3273 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-13 01:23:42 +00:00
cshapiro@google.com 32f55ce37b Implement weak persistent handles in the Dart API.
Review URL: http://codereview.chromium.org//8984006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2607 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 01:44:53 +00:00
asiva@google.com 5cf3ad018a Changes to pass the current isolate to all runtime and native calls.
Review URL: http://codereview.chromium.org//8528010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1499 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-12 05:55:22 +00:00
turnidge@google.com 9a118fbb49 Add Dart_Null, Dart_True, and Dart_False.
Fix Dart_NewPersistentHandle so it won't break if passed one of these
persistent handles.

Reviewer: Should I document that these new functions return a
persistent handle?
Review URL: http://codereview.chromium.org//8446009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1230 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-05 00:09:36 +00:00
turnidge@google.com e756497a78 Refactor the dart api a bit:
- Dart_Result is gone.  Dart_Handle mostly replaces it.
- Name/signature changes
  - IsValidResult -> IsValid
  - GetErrorCString -> GetError
  - many more...
- Make details of persistent handle freelist private.
- Add persistent "True" handle to api state.

Things I am not doing in this changelist:

- Documentation updates
Review URL: http://codereview.chromium.org//8380020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@778 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 20:38:41 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00