| 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 |
| (...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | 2053 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 2054 if (FLAG_use_jscre) { | 2054 if (FLAG_use_jscre) { |
| 2055 return; | 2055 return; |
| 2056 } | 2056 } |
| 2057 static const intptr_t kRegExpParamOffset = 3 * kWordSize; | 2057 static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
| 2058 static const intptr_t kStringParamOffset = 2 * kWordSize; | 2058 static const intptr_t kStringParamOffset = 2 * kWordSize; |
| 2059 // start_index smi is located at offset 1. | 2059 // start_index smi is located at offset 1. |
| 2060 | 2060 |
| 2061 // Incoming registers: | 2061 // Incoming registers: |
| 2062 // EAX: Function. (Will be loaded with the specialized matcher function.) | 2062 // EAX: Function. (Will be loaded with the specialized matcher function.) |
| 2063 // ECX: IC-Data. (Will be preserved.) | 2063 // ECX: Unknown. (Must be GC safe on tail call.) |
| 2064 // EDX: Arguments descriptor. (Will be preserved.) | 2064 // EDX: Arguments descriptor. (Will be preserved.) |
| 2065 | 2065 |
| 2066 // Load the specialized function pointer into EAX. Leverage the fact the | 2066 // Load the specialized function pointer into EAX. Leverage the fact the |
| 2067 // string CIDs as well as stored function pointers are in sequence. | 2067 // string CIDs as well as stored function pointers are in sequence. |
| 2068 __ movl(EBX, Address(ESP, kRegExpParamOffset)); | 2068 __ movl(EBX, Address(ESP, kRegExpParamOffset)); |
| 2069 __ movl(EDI, Address(ESP, kStringParamOffset)); | 2069 __ movl(EDI, Address(ESP, kStringParamOffset)); |
| 2070 __ LoadClassId(EDI, EDI); | 2070 __ LoadClassId(EDI, EDI); |
| 2071 __ SubImmediate(EDI, Immediate(kOneByteStringCid)); | 2071 __ SubImmediate(EDI, Immediate(kOneByteStringCid)); |
| 2072 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, | 2072 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, |
| 2073 JSRegExp::function_offset(kOneByteStringCid))); | 2073 JSRegExp::function_offset(kOneByteStringCid))); |
| 2074 | 2074 |
| 2075 // Registers are now set up for the lazy compile stub. It expects the function | 2075 // Registers are now set up for the lazy compile stub. It expects the function |
| 2076 // in EAX, the argument descriptor in EDX, and IC-Data in ECX. | 2076 // in EAX, the argument descriptor in EDX, and IC-Data in ECX. |
| 2077 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; | 2077 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 2078 __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count))); | 2078 __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
| 2079 __ xorl(ECX, ECX); |
| 2079 | 2080 |
| 2080 // Tail-call the function. | 2081 // Tail-call the function. |
| 2081 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); | 2082 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); |
| 2082 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 2083 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 2083 __ jmp(EDI); | 2084 __ jmp(EDI); |
| 2084 } | 2085 } |
| 2085 | 2086 |
| 2086 | 2087 |
| 2087 // On stack: user tag (+1), return-address (+0). | 2088 // On stack: user tag (+1), return-address (+0). |
| 2088 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 2089 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 Isolate::current_tag_offset()); | 2126 Isolate::current_tag_offset()); |
| 2126 // Set return value to Isolate::current_tag_. | 2127 // Set return value to Isolate::current_tag_. |
| 2127 __ movl(EAX, current_tag_addr); | 2128 __ movl(EAX, current_tag_addr); |
| 2128 __ ret(); | 2129 __ ret(); |
| 2129 } | 2130 } |
| 2130 | 2131 |
| 2131 #undef __ | 2132 #undef __ |
| 2132 } // namespace dart | 2133 } // namespace dart |
| 2133 | 2134 |
| 2134 #endif // defined TARGET_ARCH_IA32 | 2135 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |