Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 1217323002: Intrinsic version of Object.runtimeType (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 __ cmpl(EAX, Address(ESP, + 2 * kWordSize)); 1659 __ cmpl(EAX, Address(ESP, + 2 * kWordSize));
1660 __ j(EQUAL, &is_true, Assembler::kNearJump); 1660 __ j(EQUAL, &is_true, Assembler::kNearJump);
1661 __ LoadObject(EAX, Bool::False()); 1661 __ LoadObject(EAX, Bool::False());
1662 __ ret(); 1662 __ ret();
1663 __ Bind(&is_true); 1663 __ Bind(&is_true);
1664 __ LoadObject(EAX, Bool::True()); 1664 __ LoadObject(EAX, Bool::True());
1665 __ ret(); 1665 __ ret();
1666 } 1666 }
1667 1667
1668 1668
1669 // Return type quickly for simple types (not parametrized and not signature)
regis 2015/06/30 23:28:32 parametrized -> parameterized
srdjan 2015/07/01 00:35:41 Done.
1670 void Intrinsifier::ObjectRuntimeType(Assembler* assembler) {
1671 Label fall_through, not_smi;
1672 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1673 __ testl(EAX, Immediate(kSmiTagMask));
1674 __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
1675 __ LoadObject(EAX, Type::ZoneHandle(Type::IntType()));
1676 __ ret();
1677
1678 __ Bind(&not_smi);
1679 __ LoadClass(EBX, EAX, EDI);
regis 2015/06/30 23:28:32 The C++ code explicitly checks for a null instance
srdjan 2015/07/01 00:35:41 Added a test. The explicit check is probably in C+
1680 // EBX: class of instance (EAX).
1681 // if ((NumTypeArguments() == 0) && !IsSignatureClass()) {
1682 // return reinterpret_cast<RawType*>(raw_ptr()->canonical_types_);
1683 // }
regis 2015/06/30 23:28:32 I would remove the code in the comment.
srdjan 2015/07/01 00:35:41 Done.
1684 const Immediate& raw_null =
1685 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1686 __ movl(EDI, FieldAddress(EBX, Class::signature_function_offset()));
1687 __ cmpl(EDI, raw_null);
1688 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
1689
1690 __ movzxw(EDI, FieldAddress(EBX, Class::num_type_arguments_offset()));
1691 __ cmpl(EDI, Immediate(0));
1692 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
1693 __ movl(EAX, FieldAddress(EBX, Class::canonical_types_offset()));
1694 __ cmpl(EAX, raw_null);
1695 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Not yet set.
1696 __ ret();
1697
1698 __ Bind(&fall_through);
1699 }
1700
1701
1669 void Intrinsifier::String_getHashCode(Assembler* assembler) { 1702 void Intrinsifier::String_getHashCode(Assembler* assembler) {
1670 Label fall_through; 1703 Label fall_through;
1671 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. 1704 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object.
1672 __ movl(EAX, FieldAddress(EAX, String::hash_offset())); 1705 __ movl(EAX, FieldAddress(EAX, String::hash_offset()));
1673 __ cmpl(EAX, Immediate(0)); 1706 __ cmpl(EAX, Immediate(0));
1674 __ j(EQUAL, &fall_through, Assembler::kNearJump); 1707 __ j(EQUAL, &fall_through, Assembler::kNearJump);
1675 __ ret(); 1708 __ ret();
1676 __ Bind(&fall_through); 1709 __ Bind(&fall_through);
1677 // Hash not yet computed. 1710 // Hash not yet computed.
1678 } 1711 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 __ movl(EBX, Address(ESP, kRegExpParamOffset)); 2099 __ movl(EBX, Address(ESP, kRegExpParamOffset));
2067 __ movl(EDI, Address(ESP, kStringParamOffset)); 2100 __ movl(EDI, Address(ESP, kStringParamOffset));
2068 __ LoadClassId(EDI, EDI); 2101 __ LoadClassId(EDI, EDI);
2069 __ SubImmediate(EDI, Immediate(kOneByteStringCid)); 2102 __ SubImmediate(EDI, Immediate(kOneByteStringCid));
2070 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, 2103 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4,
2071 JSRegExp::function_offset(kOneByteStringCid))); 2104 JSRegExp::function_offset(kOneByteStringCid)));
2072 2105
2073 // Registers are now set up for the lazy compile stub. It expects the function 2106 // Registers are now set up for the lazy compile stub. It expects the function
2074 // in EAX, the argument descriptor in EDX, and IC-Data in ECX. 2107 // in EAX, the argument descriptor in EDX, and IC-Data in ECX.
2075 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; 2108 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
2076 __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count))); 2109 __ LoadObject(EDX, Array::ZoneHandle(ArgumentsDescriptor::New(arg_count)));
2077 __ xorl(ECX, ECX); 2110 __ xorl(ECX, ECX);
2078 2111
2079 // Tail-call the function. 2112 // Tail-call the function.
2080 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); 2113 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset()));
2081 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 2114 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
2082 __ jmp(EDI); 2115 __ jmp(EDI);
2083 } 2116 }
2084 2117
2085 2118
2086 // On stack: user tag (+1), return-address (+0). 2119 // On stack: user tag (+1), return-address (+0).
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 Isolate::current_tag_offset()); 2157 Isolate::current_tag_offset());
2125 // Set return value to Isolate::current_tag_. 2158 // Set return value to Isolate::current_tag_.
2126 __ movl(EAX, current_tag_addr); 2159 __ movl(EAX, current_tag_addr);
2127 __ ret(); 2160 __ ret();
2128 } 2161 }
2129 2162
2130 #undef __ 2163 #undef __
2131 } // namespace dart 2164 } // namespace dart
2132 2165
2133 #endif // defined TARGET_ARCH_IA32 2166 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698