| 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 | 24 |
| 25 namespace dart { | 25 namespace dart { |
| 26 | 26 |
| 27 DECLARE_FLAG(bool, interpret_irregexp); |
| 28 |
| 27 // When entering intrinsics code: | 29 // When entering intrinsics code: |
| 28 // ECX: IC Data | 30 // ECX: IC Data |
| 29 // EDX: Arguments descriptor | 31 // EDX: Arguments descriptor |
| 30 // TOS: Return address | 32 // TOS: Return address |
| 31 // The ECX, EDX registers can be destroyed only if there is no slow-path, i.e. | 33 // 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. | 34 // if the intrinsified method always executes a return. |
| 33 // The EBP register should not be modified, because it is used by the profiler. | 35 // The EBP register should not be modified, because it is used by the profiler. |
| 34 | 36 |
| 35 #define __ assembler-> | 37 #define __ assembler-> |
| 36 | 38 |
| (...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 StringEquality(assembler, kOneByteStringCid); | 2072 StringEquality(assembler, kOneByteStringCid); |
| 2071 } | 2073 } |
| 2072 | 2074 |
| 2073 | 2075 |
| 2074 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 2076 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
| 2075 StringEquality(assembler, kTwoByteStringCid); | 2077 StringEquality(assembler, kTwoByteStringCid); |
| 2076 } | 2078 } |
| 2077 | 2079 |
| 2078 | 2080 |
| 2079 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | 2081 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 2082 if (FLAG_interpret_irregexp) return; |
| 2083 |
| 2080 static const intptr_t kRegExpParamOffset = 3 * kWordSize; | 2084 static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
| 2081 static const intptr_t kStringParamOffset = 2 * kWordSize; | 2085 static const intptr_t kStringParamOffset = 2 * kWordSize; |
| 2082 // start_index smi is located at offset 1. | 2086 // start_index smi is located at offset 1. |
| 2083 | 2087 |
| 2084 // Incoming registers: | 2088 // Incoming registers: |
| 2085 // EAX: Function. (Will be loaded with the specialized matcher function.) | 2089 // EAX: Function. (Will be loaded with the specialized matcher function.) |
| 2086 // ECX: Unknown. (Must be GC safe on tail call.) | 2090 // ECX: Unknown. (Must be GC safe on tail call.) |
| 2087 // EDX: Arguments descriptor. (Will be preserved.) | 2091 // EDX: Arguments descriptor. (Will be preserved.) |
| 2088 | 2092 |
| 2089 // Load the specialized function pointer into EAX. Leverage the fact the | 2093 // Load the specialized function pointer into EAX. Leverage the fact the |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 Isolate::current_tag_offset()); | 2153 Isolate::current_tag_offset()); |
| 2150 // Set return value to Isolate::current_tag_. | 2154 // Set return value to Isolate::current_tag_. |
| 2151 __ movl(EAX, current_tag_addr); | 2155 __ movl(EAX, current_tag_addr); |
| 2152 __ ret(); | 2156 __ ret(); |
| 2153 } | 2157 } |
| 2154 | 2158 |
| 2155 #undef __ | 2159 #undef __ |
| 2156 } // namespace dart | 2160 } // namespace dart |
| 2157 | 2161 |
| 2158 #endif // defined TARGET_ARCH_IA32 | 2162 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |