Ben Konyi
b6284b41e3
Revert "[VM] Dart_Initialize no longer crashes after Dart_Cleanup"
...
This reverts commit 519ee905f9 .
Reason for revert: Seeing multiple crashes on Windows
Original change's description:
> [VM] Dart_Initialize no longer crashes after Dart_Cleanup
>
> Change-Id: I3cfdab9553aad045f024b6f9aec0b40b08234007
> Reviewed-on: https://dart-review.googlesource.com/75786
> Reviewed-by: Ryan Macnak <rmacnak@google.com >
> Commit-Queue: Ben Konyi <bkonyi@google.com >
TBR=bkonyi@google.com ,rmacnak@google.com ,zra@google.com
Change-Id: I33ad79dbc3fcf44f93612ff63bd2d8431f6067c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/76342
Reviewed-by: Ben Konyi <bkonyi@google.com >
Commit-Queue: Ben Konyi <bkonyi@google.com >
2018-09-25 02:17:37 +00:00
Ben Konyi
519ee905f9
[VM] Dart_Initialize no longer crashes after Dart_Cleanup
...
Change-Id: I3cfdab9553aad045f024b6f9aec0b40b08234007
Reviewed-on: https://dart-review.googlesource.com/75786
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Commit-Queue: Ben Konyi <bkonyi@google.com >
2018-09-25 01:20:24 +00:00
Ryan Macnak
8da46d35f5
[vm] Move heap-related code to its own subdirectory (cf. compiler).
...
Remove some dead includes.
Change-Id: I31f3e739e5ee46dcbba5d6a2f091491b46402943
Reviewed-on: https://dart-review.googlesource.com/60146
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-06-20 00:39:49 +00:00
Ryan Macnak
4d3ebab589
[vm] Fix error message when an API function is called without a current isolate.
...
Change-Id: Id29fe5d14a58d85984902952dc53cc56cda16ccc
Reviewed-on: https://dart-review.googlesource.com/55842
Reviewed-by: Siva Annamalai <asiva@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-05-21 16:27:48 +00:00
Ryan Macnak
ebdc8abaae
[vm, service] Avoid double TLS creating timeline events for API functions.
...
Add timeline events for Dart_CompileAll and Dart_ParseAll.
Change-Id: I184319aadfe18a6e51cb44c2ab77fb95f452f6de
Reviewed-on: https://dart-review.googlesource.com/43242
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-02-23 01:31:38 +00:00
Zachary Anderson
6cd8a79078
VM: Re-format to use at most one newline between functions
...
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Ryan Macnak
76df24b076
CoreJIT snapshots without training.
...
Only include OSR and field guards in the features descriptor for JIT code to avoid gen_snapshot and dart having different default values.
Disabled since core snapshots with code break tests with non-default flags for type checks, assertions, strict errors, OSR, or field guards.
R=zra@google.com
Review-Url: https://codereview.chromium.org/2902313004 .
2017-05-31 13:49:12 -07:00
Ben Konyi
259c7ac2be
Resolution for issue #5092 : Unit test handle checks consider dangling handles to be valid.
...
Updated the IS_VALID(handle) macro to also check if the handle is still in
scope or is a read-only handle.
BUG=
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2640573003 .
2017-01-20 15:50:15 -08:00
Zachary Anderson
a1bcf051d8
clang-format runtime/vm
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Zachary Anderson
103881d01c
Make header include guards great again
...
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER
This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.
R=asiva@google.com , rmacnak@google.com
Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Ivan Posva
5be5d54529
- Refactor Symbol allocation to expect a thread parameter.
...
- Preallocate all tokens as symbols to avoid repeated lookups.
- Pass thread/zone where useful while doing this change.
- Avoid allocating symbols for error messages.
BUG=
R=fschneider@google.com
Review URL: https://codereview.chromium.org/1870343002 .
2016-04-11 16:28:29 -07:00
Florian Loitsch
55630a5e90
Support 'dart.library.X' env variables in the VM.
...
BUG= http://dartbug.com/24587
R=iposva@google.com , johnmccutchan@google.com
Committed: https://github.com/dart-lang/sdk/commit/c2a06e22cb83f491fd3accc33d7738c87490c26d
Reverted: https://github.com/dart-lang/sdk/commit/5eb5b429895987519a00daa81b5ab261debbca3f
Review URL: https://codereview.chromium.org/1640853004 .
2016-02-29 20:58:32 +01:00
Florian Loitsch
5eb5b42989
Revert "Support 'dart.library.X' env variables in the VM."
...
This reverts commit c2a06e22cb .
Review URL: https://codereview.chromium.org/1668253002 .
2016-02-04 22:26:06 +01:00
Florian Loitsch
c2a06e22cb
Support 'dart.library.X' env variables in the VM.
...
BUG= http://dartbug.com/24587
R=iposva@google.com , johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1640853004 .
2016-02-04 13:04:31 +01:00
Todd Turnidge
6ed1a58741
Dart_SetReturnValue now accepts and propagates error handles.
...
The error propagation is delayed until the native function returns.
This should simplify error handling in embedder code and avoid failing
to propagate an error, which is a common failure.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1663613002 .
2016-02-03 11:20:02 -08:00
Siva Annamalai
e72c1fb47d
Implement safepointing of threads :
...
- uses thread execution status transition to track when a thread is in a safepoint or needs to block for a safepoint
- introduces a monitor per Thread object
- uses a per thread safepoint handshake between the thread requesting a safepoint and the requested thread.
The ThreadRegistry class now contains only the thread list for an isolate and the functionality of scheduling a thread onto an Isolate and unscheduling it from teh isolate. We could fold this functionality into the Isolate class in a different CL.
R=rmacnak@google.com , zra@google.com
Review URL: https://codereview.chromium.org/1541073002 .
2016-02-01 10:57:34 -08:00
John McCutchan
2ff1c28978
Emit Timeline events for most Dart_API calls
...
- Remove --trace-api and related macros.
- Emit Timeline events on the API stream for Dart_API calls.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1526463005 .
2015-12-15 10:27:22 -08:00
Siva Annamalai
01b69ebabc
Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone etc. are thread specific instead of being Isolate specific.
...
R=zra@google.com
Review URL: https://codereview.chromium.org/1473403003 .
2015-11-25 11:07:22 -08:00
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
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
465cf10a7c
Remove some Isolate::current_zone() calls, as it gets the zone from mutator thread not the current thread
...
BUG=
R=zra@google.com
Review URL: https://codereview.chromium.org/1414493003 .
2015-10-19 10:27:36 -07: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
5039117f50
Remove isolate parameter when allocating handles
...
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1401643002 .
2015-10-12 15:51:06 -07:00
Ryan Macnak
26c187d818
Error quickly if the embedder tries to load after Dart_Precompile.
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org/1377733007 .
2015-10-06 10:14:08 -07:00
Ivan Posva
4bd7cdc75c
- Ensure that HandleScope is initialized with a thread. (Remove
...
deprecated isolate based API.)
- Update all code impacted by this change. E.g. DARTSCOPE
- TEST_CASE now passes the current thread as a parameter to the unit test.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org//1310463005 .
2015-09-01 17:18:55 -07:00
John McCutchan
51d8bae199
Revert "Hide Isolate pointer from embedder"
...
This reverts commit 014e694ba7 .
Revert "Fix fall out from hide isolate pointer change"
This reverts commit 966aafbc81 .
Revert "Fix build"
This reverts commit d7b03ba7b0 .
BUG=
Review URL: https://codereview.chromium.org//1140263005
2015-05-19 11:41:42 -07:00
John McCutchan
014e694ba7
Hide Isolate pointer from embedder
...
BUG=
R=iposva@google.com
Review URL: https://codereview.chromium.org//1130753006
2015-05-18 14:06:10 -07:00
koda@google.com
f4419287aa
Prepares for multiple threads by further decoupling Thread from Isolate.
...
- Replace Isolate::SetCurrent with more explicit Thread::Enter/ExitIsolate.
- Lazily initialize Thread instances when entering an isolate, to avoid new API calls for embedders.
R=asiva@google.com
Review URL: https://codereview.chromium.org//1041523002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44835 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-01 17:48:11 +00:00
iposva@google.com
92f2698abe
- Refactor the way X.fromEnvironment is implemented.
...
- Predefine 'dart.isVM' to be 'true'.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//546053002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39986 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-08 18:23:05 +00:00
asiva@google.com
97b903c665
Fix for issue 19817
...
- do not try to finalize classes on every Dart API call which could
potentially result in calls to dart code
- Invoke Dart_FinalizeLoading after all loads are done to ensure that
classes are finalized
R=hausner@google.com
Review URL: https://codereview.chromium.org//411633002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38471 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-22 20:08:15 +00:00
asiva@google.com
de6a12ce6a
- Add Dart_EmptyString to return the canonical empty string similar to how
...
Null, True and False are done
- Removed check for current isolate from Dart_Null, Dart_True, Dart_False,
Dart_EmptyString as these are returning singleton objects.
R=regis@google.com
Review URL: https://codereview.chromium.org//302143004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36823 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-30 17:33:15 +00:00
asiva@google.com
d5fbbd593a
Add a new API function to extract all the native arguments into an array
...
passed in by the caller.
This call can be used in DOM bindings patterns as follows:
Old code -
Dart_Handle exception = 0;
{
WebGL* receiver = DartDOMWrapper::receiver< WebGL >(args);
unsigned srcRGB = DartUtilities::dartToUnsigned(args, 1, exception);
if (exception)
goto fail;
unsigned dstRGB = DartUtilities::dartToUnsigned(args, 2, exception);
if (exception)
goto fail;
unsigned srcAlpha = DartUtilities::dartToUnsigned(args, 3, exception);
if (exception)
goto fail;
unsigned dstAlpha = DartUtilities::dartToUnsigned(args, 4, exception);
if (exception)
goto fail;
receiver->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
return;
}
fail:
Dart_ThrowException(exception);
ASSERT_NOT_REACHED();
Proposed new code -
/**
* One time initialization code for setting up argument descriptors
*/
const int kNumArgs = 5;
const int kNumNativeFields = 2;
static const uint8_t native_arg_descriptor[kNumArgs] = {
DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kNativeFields, 0),
DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kUint32, 1),
DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kUint32, 2),
DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kUint32, 3),
DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kUint32, 4),
};
Dart_NativeArgument_Value native_args[kNumArgs];
intptr_t native_fields[kNumNativeFields];
native_args[0].as_native_fields.num_fields = kNumNativeFields;
native_args[0].as_native_fields.values = native_fields;
/**
* Code executed for each invocation of the binding method
*/
Dart_Handle result = Dart_GetNativeArguments(args, kNumArgs, native_arg_descriptor, native_args);
if (Dart_IsError(result)) {
Dart_ThrowException(result);
}
WebGL* receiver = DartDOMWrapper::receiver< WebGL >(native_args[0].as_native_fields.values);
unsigned srcRGB = native_args[1].as_uint32;
unsigned dstRGB = native_args[2].as_uint32;
unsigned srcAlpha = native_args[3].as_uint32;
unsigned dstAlpha = native_args[4].as_uint32;
receiver->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
return;
R=iposva@google.com , vsm@google.com
Review URL: https://codereview.chromium.org//282883002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36464 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 00:08:23 +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
ajohnsen@google.com
c3dfdbe772
Fix fromEnvironment when called from isolates.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//180243022
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33363 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 09:16:41 +00:00
asiva@google.com
8e0129970c
Use a tag bit for indicating prologue weak persistent handles, this avoids
...
the costly lookup to determine if a handle is a prologue weak persistent
handle or a regular weak persistent handle in Dart_DeleteWeakPersistentHandle
R=iposva@google.com
Review URL: https://codereview.chromium.org//177093010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33254 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 00:35:45 +00:00
asiva@google.com
c059ba6f6d
1. Added new versions of Api::UnWrapStringHandle Api::UnWrapInstanceHandle to
...
use a reused handle instead of creating a new one
2. Use CHEK_ISOLATE instead of DARTSCOPE in some of the API functions where
no handles are created
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//181843007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33142 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-27 23:38: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
asiva@google.com
7f1055df45
Implement GetNativeReceiver without handles under a NoGCScope, this should
...
eliminate the hot InitializeHandle calls that were observed in the profile.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//101153005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31405 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-30 19:55:28 +00:00
asiva@google.com
491035987f
Change Dart_GetNativeBooleanArgument to use class Ids and direct
...
pointer comparision of the singleton objects to determine value.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//113763004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31311 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 00:15:13 +00:00
asiva@google.com
f21708a38a
- Dart_ObjectIsType was allowing classes as parameter, changed it to only
...
allow types.
- Return canonical Dart_Null, Dart_True and Dart_False handles instead of
creating a new handle
R=srdjan@google.com
Review URL: https://codereview.chromium.org//26306006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28366 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-08 16:42:30 +00:00
asiva@google.com
d6aaf0cc94
1. Add flag --trace-api to trace API function invocation
...
2. Add tracing of external native functions under --trace-natives flag
3. Added a _printCurrentStacktrace() function so that one could get a
dart stack trace under 'gdb' when in a native or runtime function.
R=regis@google.com
Review URL: https://codereview.chromium.org//23453035
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27166 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 23:42:13 +00:00
asiva@google.com
848291cea7
- Setup a peer for read only strings that are not externalized in
...
Dart_MakeExternalString so that it is not necessary to create
a new reference for it everytime it is accessed in native code.
- Removed unused function Dart_ExternalStringGetPeer
R=iposva@google.com
Review URL: https://codereview.chromium.org//22980022
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26538 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 17:10:37 +00:00
asiva@google.com
543d80f5f8
Fix signature of Dart_SetIntegerReturnValue.
...
R=vsm@google.com
Review URL: https://codereview.chromium.org//22897020
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26487 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 23:45:02 +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
asiva@google.com
fc5ffa288f
Simplify access to peer pointer for external strings.
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org//23118006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26202 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-15 17:10:07 +00:00
asiva@google.com
4b2c10ae32
Added following dart API changes to enable more efficient access based
...
on the dartium usage pattern:
- Dart_GetNativeStringArgument (gets a String object, peer etc. directly from
the native arguments)
- Dart_SetWeakHandleReturnValue (allows a weak handle to be passed to the
return value, this ensures a new local handle does not have to be created
from a weak handle just to return a value)
- Dart_StringGetProperties (gets some common properties of a string, avoids
multiple API calls to set up a native string)
R=srdjan@google.com , vsm@google.com
Review URL: https://codereview.chromium.org//22632010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26046 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 01:19:25 +00:00
asiva@google.com
a0571ccb07
Fix incorrect usage of NoGCScope in previous change (dart objects are being
...
allocated so it is possible to have GC).
R=srdjan@google.com
Review URL: https://codereview.chromium.org//21252005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25691 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 23:47:04 +00:00
asiva@google.com
2c5c1fb855
- Add following additional methods to the API to make returning values
...
from Dartium easier:
Dart_SetBooleanReturnValue
Dart_SetIntegerReturnValue
Dart_SetDoubleReturnValue
- Use Isolate value stored in NativeArguments instead of calling
Isolate::Current
R=srdjan@google.com
Review URL: https://codereview.chromium.org//21319002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25676 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 18:05:05 +00:00
asiva@google.com
51651ee00b
Split dart_api.h into multiple parts:
...
dart_api.h - Has the core API functions
dart_mirrors_api.h - Has API functions to support Mirrors or reflection
dart_native_api.h - Has parts which support the native message handling,
profilling and other internal tools
R=sgjesse@google.com , vsm@google.com
Review URL: https://codereview.chromium.org//16973003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24062 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 23:47:40 +00:00