Commit Graph

31 Commits

Author SHA1 Message Date
Alexander Markov 84fd647969 [vm] Refactor access to Integer value
Add methods to provide uniform access to values of Dart integers:

  Integer::Value()
  Integer::Value(IntegerPtr)

  Smi::Value()
  Smi::Value(SmiPtr)

  Mint::Value()
  Mint::Value(MintPtr)

Remove

  AsInt64Value()
  AsTruncatedInt64Value()
  AsTruncatedUint32Value()
  GetInt64Value(IntegerPtr)

Also, rename AsDoubleValue() to ToDouble() and
remove unused (FitsIntoSmi, AsValidInteger) and
value-based methods (IsZero, IsNegative).

TEST=ci

Change-Id: I28786ec3a14703574b7a192ead42eeefdbd09106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380586
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-19 21:46:26 +00:00
Ryan Macnak 9b6bda05ec [vm] Remove dead _localTimeZoneAdjustmentInSeconds.
Dead since 6af4987dc6.

TEST=ci
Change-Id: Ib92d2334dcc4c98e203628b4a8d244e6277b6b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-07-19 17:29:04 +00:00
Daco Harkes 14ff2110ce [vm] refactor native entry and native entry type arguments
Change-Id: I03efbbf4340de1c8f23c60854ed991671ca2b647
Reviewed-on: https://dart-review.googlesource.com/c/87077
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-13 19:29:26 +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
Zachary Anderson 2e4dfd3a2d clang-format runtime/lib
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2468093007 .
2016-11-04 12:14:41 -07:00
Regis Crelier 48dc790398 Fix core lib DateTime in the VM (fixes #19923).
Symptom of the problem:
Set your Linux workstation (or Mac or MIPS board) to the Europe/London timezone
and the corelib/date_time test will fail, claiming that 1/1/1970 was a Wednesday
(it was actually a Thursday, trust me, I was already born).

Problem:
The implementation of DateTime in the VM relies on Unix time_t, the number of
seconds since the Epoch (1/1/1970 UTC). When asked for the weekday of a given
time, our implementation limits itself to a 32-bit positive range of time_t.
If the time falls outside of this range, the implementation picks an equivalent
time in the valid range with the same weekday, also in leap year or not, etc...
The issue is that DateTime is using the underlying OS in an inconsistent manner.
Let's take the example above: 1/1/1970 in the Europe/London timezone.
First, the number of seconds since the Epoch in UTC is calculated, here 0.
Then, the timezone offset at the given time is calculated using the underlying
OS. In this case, an historical deviation is taken into account. Indeed, London
stayed on British Summer Time between 27 October 1968 and 31 October 1971. See
https://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation for
details.
Our resulting time is therefore negative (one hour difference with UTC).
When asked about the weekday of this time, the implementation notices that the
time is not in the positive range and picks an "equivalent" time in the future.
It then asks the underlying OS about the timezone offset for this time, which
is 0 (usually no daylight saving time in January in London). Unfortunately,
this time is not really equivalent, because it ignores the original historical
deviation. The result is wrongly equivalent to 12/31/1969 23:00 in London, i.e.
a Wednesday, and not a Thursday as expected.

Solution:
We should use the underlying OS in a consistent way, by simply allowing the
value of time_t passed to the underlying OS to be negative, which is legal.

R=floitsch@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1845483002 .
2016-03-30 10:09:58 -07:00
Florian Loitsch 6c84c42e67 Add microsecond support to DateTime.
R=iposva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/1493033003 .
2015-12-09 00:46:46 +01:00
regis@google.com 0220e41d72 New bigint implementation in the vm.
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40061 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-09 21:47:44 +00:00
srdjan@google.com b6b3e1f400 Factor out throwing of argument error.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28109 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 18:48:37 +00:00
asiva@google.com 8af296c9c8 Cleanup the exceptions create code to use Arrays instead GrowableArrays so
that it is consistent with the DartEntry invoke code that it calls finally.
Review URL: https://codereview.chromium.org//11639007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16295 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 23:47:35 +00:00
regis@google.com dd6a0ec349 Rename GET_NATIVE_ARGUMENT macro to GET_NON_NULL_NATIVE_ARGUMENT.
Introduce new GET_NATIVE_ARGUMENT macro accepting null.
Add test.
Review URL: https://codereview.chromium.org//11468016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15919 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 17:59:40 +00:00
hausner@google.com 7eb3efc2ba Fix native argument handling
Native functions need to fetch arguments differently if they are
called through a closure.

fixes issue 6696.
Review URL: https://codereview.chromium.org//11293290

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14937 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-15 01:14:01 +00:00
lrn@google.com a1faa6f135 Change IllegalArgumentException to ArgumentError.
Review URL: https://codereview.chromium.org//10989013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12841 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-25 12:27:52 +00:00
turnidge@google.com 14f614da12 Use the return value of vm native methods to set the return value,
based on Siva's earlier suggestion (he actually suggested putting it
in the generated stub, which I haven't done).

Added SetReturnUnsafe and use it exactly one place so far.
Review URL: https://chromiumcodereview.appspot.com//10874072

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11633 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-30 17:41:19 +00:00
floitsch@google.com dd61a23829 Reapply "Refactor Date implementation in VM."
This reapplies fixed versions of commit 7542 and commit 8544.
Original review URLs:
https://chromiumcodereview.appspot.com//10533068
https://chromiumcodereview.appspot.com//10544109

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8655 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 13:05:22 +00:00
floitsch@google.com eb92af4080 Revert "Refactor Date implementation in VM."
Also revert "Round days-computation to get rid of daylight-savings differences."

This reverts commit 7542 and commit 8544.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8547 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 13:44:45 +00:00
floitsch@google.com 17de58fbaf Reapply "Refactor Date implementation in VM."
This reapplies a fixed version of commit 8533.
https://chromiumcodereview.appspot.com//10533068

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8542 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 12:04:36 +00:00
floitsch@google.com 02f39238ae Revert "Refactor Date implementation in VM."
This reverts commit 8533.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8535 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 10:33:36 +00:00
floitsch@google.com 0e297362a2 Refactor Date implementation in VM.
Less (and simpler) native functions. More precise semantics (for both the
native functions as well as for the Date class itself).

Fixes issue 3201.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8533 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 10:24:58 +00:00
floitsch@google.com cc15d26cf7 Reapply "Add support for timezone offset and timezone name."
This reapplies commit 7800.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7805 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 16:11:20 +00:00
floitsch@google.com 77ade89e4a Revert "Add support for timezone offset and timezone name."
This reverts commit 7803.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7804 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 15:13:46 +00:00
floitsch@google.com 618c649c33 Reapply "Add support for timezone offset and timezone name."
This reapplies commit 7800.
Original CL: https://chromiumcodereview.appspot.com/10383218/

Don't write *foo += x.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7803 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 15:07:11 +00:00
floitsch@google.com 5b99866ecd Revert "Add support for timezone offset and timezone name."
This reverts commit 7801..

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7802 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 14:40:27 +00:00
floitsch@google.com 36d9c69461 Add support for timezone offset and timezone name.
Review URL: https://chromiumcodereview.appspot.com//10383218

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7801 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 14:36:43 +00:00
floitsch@google.com 410e6bf600 Reapply "Set the TZ env to get the UTC-ms since epoch."
This reapplies a fixed version of commit 7285.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7288 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 15:40:40 +00:00
floitsch@google.com a8e31e2a48 Revert "Set the TZ env to get the UTC-ms since epoch."
This reverts commit 7285.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7287 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 14:54:09 +00:00
floitsch@google.com 9cf8b9a36d Set the TZ env to get the UTC-ms since epoch.
Previously we tried to simply subtract the timezone difference from
the local value. Apparently this doesn't work...

Fixes issue 1268.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7285 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 14:46:21 +00:00
hausner@google.com 09b97fefd4 Address Ivan's review comments.
Review URL: https://chromiumcodereview.appspot.com//9696048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5438 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 21:07:42 +00:00
hausner@google.com 9655e2af7d Add type checking to some native function arguments
Review URL: https://chromiumcodereview.appspot.com//9693051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5437 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 20:53:37 +00:00
regis@google.com 2d1f63af47 Port a couple more stubs to x64.
Fix integer implementation issues.
Enable all tests on x64.
Review URL: http://codereview.chromium.org//9114054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3307 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-13 20:07:54 +00:00
floitsch@google.com 15727ed074 Rename DateTime to Date.
Review URL: https://chromereviews.googleplex.com/3529013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@107 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-06 10:14:49 +00:00