OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
10 | 10 |
11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
12 #if defined(TARGET_ARCH_IA32) | 12 #if defined(TARGET_ARCH_IA32) |
13 | 13 |
14 #include "vm/intrinsifier.h" | 14 #include "vm/intrinsifier.h" |
15 | 15 |
16 #include "vm/assembler.h" | 16 #include "vm/assembler.h" |
17 #include "vm/dart_entry.h" | 17 #include "vm/dart_entry.h" |
18 #include "vm/flow_graph_compiler.h" | 18 #include "vm/flow_graph_compiler.h" |
19 #include "vm/object.h" | 19 #include "vm/object.h" |
20 #include "vm/object_store.h" | 20 #include "vm/object_store.h" |
21 #include "vm/os.h" | 21 #include "vm/os.h" |
22 #include "vm/regexp_assembler.h" | 22 #include "vm/regexp_assembler.h" |
23 #include "vm/symbols.h" | 23 #include "vm/symbols.h" |
| 24 #include "vm/timeline.h" |
24 | 25 |
25 namespace dart { | 26 namespace dart { |
26 | 27 |
27 // When entering intrinsics code: | 28 // When entering intrinsics code: |
28 // ECX: IC Data | 29 // ECX: IC Data |
29 // EDX: Arguments descriptor | 30 // EDX: Arguments descriptor |
30 // TOS: Return address | 31 // TOS: Return address |
31 // The ECX, EDX registers can be destroyed only if there is no slow-path, i.e. | 32 // The ECX, EDX registers can be destroyed only if there is no slow-path, i.e. |
32 // if the intrinsified method always executes a return. | 33 // if the intrinsified method always executes a return. |
33 // The EBP register should not be modified, because it is used by the profiler. | 34 // The EBP register should not be modified, because it is used by the profiler. |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 __ ret(); | 2125 __ ret(); |
2125 } | 2126 } |
2126 | 2127 |
2127 | 2128 |
2128 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2129 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
2129 __ LoadIsolate(EAX); | 2130 __ LoadIsolate(EAX); |
2130 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); | 2131 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); |
2131 __ ret(); | 2132 __ ret(); |
2132 } | 2133 } |
2133 | 2134 |
| 2135 |
| 2136 void Intrinsifier::Timeline_isDartStreamEnabled(Assembler* assembler) { |
| 2137 if (!FLAG_support_timeline) { |
| 2138 __ LoadObject(EAX, Bool::False()); |
| 2139 __ ret(); |
| 2140 return; |
| 2141 } |
| 2142 Label true_label; |
| 2143 // Load TimelineStream*. |
| 2144 __ movl(EAX, Address(THR, Thread::dart_stream_offset())); |
| 2145 // Load uintptr_t from TimelineStream*. |
| 2146 __ movl(EAX, Address(EAX, TimelineStream::enabled_offset())); |
| 2147 __ cmpl(EAX, Immediate(0)); |
| 2148 __ j(NOT_ZERO, &true_label, Assembler::kNearJump); |
| 2149 // Not enabled. |
| 2150 __ LoadObject(EAX, Bool::False()); |
| 2151 __ ret(); |
| 2152 // Enabled. |
| 2153 __ Bind(&true_label); |
| 2154 __ LoadObject(EAX, Bool::True()); |
| 2155 __ ret(); |
| 2156 } |
| 2157 |
2134 #undef __ | 2158 #undef __ |
| 2159 |
2135 } // namespace dart | 2160 } // namespace dart |
2136 | 2161 |
2137 #endif // defined TARGET_ARCH_IA32 | 2162 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |