OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
11 #include "vm/os.h" | 11 #include "vm/os.h" |
12 #include "vm/timeline.h" | 12 #include "vm/timeline.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 // Native implementations for the dart:developer library. | 16 // Native implementations for the dart:developer library. |
17 | 17 |
18 DEFINE_NATIVE_ENTRY(Timeline_getIsolateNum, 0) { | 18 DEFINE_NATIVE_ENTRY(Timeline_getIsolateNum, 0) { |
19 return Integer::New(static_cast<int64_t>(isolate->main_port()), | 19 return Integer::New(static_cast<int64_t>(isolate->main_port()), Heap::kOld); |
20 Heap::kOld, | |
21 true); | |
22 } | 20 } |
23 | 21 |
24 | 22 |
25 DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) { | 23 DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) { |
26 if (!FLAG_support_timeline) { | 24 if (!FLAG_support_timeline) { |
27 return Integer::New(0); | 25 return Integer::New(0); |
28 } | 26 } |
29 TimelineEventRecorder* recorder = Timeline::recorder(); | 27 TimelineEventRecorder* recorder = Timeline::recorder(); |
30 if (recorder == NULL) { | 28 if (recorder == NULL) { |
31 return Integer::New(0); | 29 return Integer::New(0); |
32 } | 30 } |
33 return Integer::New(recorder->GetNextAsyncId()); | 31 return Integer::New(recorder->GetNextAsyncId()); |
34 } | 32 } |
35 | 33 |
36 | 34 |
37 DEFINE_NATIVE_ENTRY(Timeline_getTraceClock, 0) { | 35 DEFINE_NATIVE_ENTRY(Timeline_getTraceClock, 0) { |
38 return Integer::New(OS::GetCurrentMonotonicMicros(), Heap::kNew, true); | 36 return Integer::New(OS::GetCurrentMonotonicMicros(), Heap::kNew); |
39 } | 37 } |
40 | 38 |
41 | 39 |
42 DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) { | 40 DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) { |
43 if (!FLAG_support_timeline) { | 41 if (!FLAG_support_timeline) { |
44 return Object::null(); | 42 return Object::null(); |
45 } | 43 } |
46 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); | 44 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); |
47 GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(1)); | 45 GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(1)); |
48 GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2)); | 46 GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 args.ToCString()); | 185 args.ToCString()); |
188 | 186 |
189 event->Instant("", start.AsInt64Value()); | 187 event->Instant("", start.AsInt64Value()); |
190 // json was allocated in the zone and a copy will be stored in event. | 188 // json was allocated in the zone and a copy will be stored in event. |
191 event->CompleteWithPreSerializedJSON(json); | 189 event->CompleteWithPreSerializedJSON(json); |
192 | 190 |
193 return Object::null(); | 191 return Object::null(); |
194 } | 192 } |
195 | 193 |
196 } // namespace dart | 194 } // namespace dart |
OLD | NEW |