| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 | 2072 |
| 2073 | 2073 |
| 2074 LocationSummary* PolymorphicInstanceCallComp::MakeLocationSummary() const { | 2074 LocationSummary* PolymorphicInstanceCallComp::MakeLocationSummary() const { |
| 2075 return MakeCallSummary(); | 2075 return MakeCallSummary(); |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 | 2078 |
| 2079 void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 2079 void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2080 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | 2080 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), |
| 2081 kDeoptPolymorphicInstanceCallTestFail); | 2081 kDeoptPolymorphicInstanceCallTestFail); |
| 2082 if (!HasICData() || (ic_data()->NumberOfChecks() == 0)) { | 2082 if (ic_data().NumberOfChecks() == 0) { |
| 2083 __ jmp(deopt); | 2083 __ jmp(deopt); |
| 2084 return; | 2084 return; |
| 2085 } | 2085 } |
| 2086 ASSERT(HasICData()); | 2086 ASSERT(ic_data().num_args_tested() == 1); |
| 2087 ASSERT(ic_data()->num_args_tested() == 1); | |
| 2088 if (!with_checks()) { | 2087 if (!with_checks()) { |
| 2089 const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0)); | 2088 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); |
| 2090 compiler->GenerateStaticCall(instance_call()->deopt_id(), | 2089 compiler->GenerateStaticCall(instance_call()->deopt_id(), |
| 2091 instance_call()->token_pos(), | 2090 instance_call()->token_pos(), |
| 2092 target, | 2091 target, |
| 2093 instance_call()->ArgumentCount(), | 2092 instance_call()->ArgumentCount(), |
| 2094 instance_call()->argument_names(), | 2093 instance_call()->argument_names(), |
| 2095 locs()); | 2094 locs()); |
| 2096 return; | 2095 return; |
| 2097 } | 2096 } |
| 2098 | 2097 |
| 2099 // Load receiver into EAX. | 2098 // Load receiver into EAX. |
| 2100 __ movl(EAX, | 2099 __ movl(EAX, |
| 2101 Address(ESP, (instance_call()->ArgumentCount() - 1) * kWordSize)); | 2100 Address(ESP, (instance_call()->ArgumentCount() - 1) * kWordSize)); |
| 2102 | 2101 |
| 2103 Label done; | 2102 Label done; |
| 2104 __ movl(EDI, Immediate(kSmiCid)); | 2103 __ movl(EDI, Immediate(kSmiCid)); |
| 2105 __ testl(EAX, Immediate(kSmiTagMask)); | 2104 __ testl(EAX, Immediate(kSmiTagMask)); |
| 2106 __ j(ZERO, &done); | 2105 __ j(ZERO, &done); |
| 2107 __ LoadClassId(EDI, EAX); | 2106 __ LoadClassId(EDI, EAX); |
| 2108 __ Bind(&done); | 2107 __ Bind(&done); |
| 2109 | 2108 |
| 2110 compiler->EmitTestAndCall(*ic_data(), | 2109 compiler->EmitTestAndCall(ic_data(), |
| 2111 EDI, // Class id register. | 2110 EDI, // Class id register. |
| 2112 instance_call()->ArgumentCount(), | 2111 instance_call()->ArgumentCount(), |
| 2113 instance_call()->argument_names(), | 2112 instance_call()->argument_names(), |
| 2114 deopt, | 2113 deopt, |
| 2115 instance_call()->deopt_id(), | 2114 instance_call()->deopt_id(), |
| 2116 instance_call()->token_pos(), | 2115 instance_call()->token_pos(), |
| 2117 locs()); | 2116 locs()); |
| 2118 } | 2117 } |
| 2119 | 2118 |
| 2120 | 2119 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2132 summary->set_temp(0, Location::RequiresRegister()); | 2131 summary->set_temp(0, Location::RequiresRegister()); |
| 2133 return summary; | 2132 return summary; |
| 2134 } | 2133 } |
| 2135 | 2134 |
| 2136 | 2135 |
| 2137 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 2136 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2138 Register value = locs()->in(0).reg(); | 2137 Register value = locs()->in(0).reg(); |
| 2139 Register temp = locs()->temp(0).reg(); | 2138 Register temp = locs()->temp(0).reg(); |
| 2140 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 2139 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2141 kDeoptCheckClass); | 2140 kDeoptCheckClass); |
| 2142 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid); | 2141 ASSERT(unary_checks().GetReceiverClassIdAt(0) != kSmiCid); |
| 2143 __ testl(value, Immediate(kSmiTagMask)); | 2142 __ testl(value, Immediate(kSmiTagMask)); |
| 2144 __ j(ZERO, deopt); | 2143 __ j(ZERO, deopt); |
| 2145 __ LoadClassId(temp, value); | 2144 __ LoadClassId(temp, value); |
| 2146 Label is_ok; | 2145 Label is_ok; |
| 2147 const intptr_t num_checks = ic_data()->NumberOfChecks(); | 2146 const intptr_t num_checks = unary_checks().NumberOfChecks(); |
| 2148 const bool use_near_jump = num_checks < 5; | 2147 const bool use_near_jump = num_checks < 5; |
| 2149 for (intptr_t i = 0; i < num_checks; i++) { | 2148 for (intptr_t i = 0; i < num_checks; i++) { |
| 2150 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i))); | 2149 __ cmpl(temp, Immediate(unary_checks().GetReceiverClassIdAt(i))); |
| 2151 if (i == (num_checks - 1)) { | 2150 if (i == (num_checks - 1)) { |
| 2152 __ j(NOT_EQUAL, deopt); | 2151 __ j(NOT_EQUAL, deopt); |
| 2153 } else { | 2152 } else { |
| 2154 if (use_near_jump) { | 2153 if (use_near_jump) { |
| 2155 __ j(EQUAL, &is_ok, Assembler::kNearJump); | 2154 __ j(EQUAL, &is_ok, Assembler::kNearJump); |
| 2156 } else { | 2155 } else { |
| 2157 __ j(EQUAL, &is_ok); | 2156 __ j(EQUAL, &is_ok); |
| 2158 } | 2157 } |
| 2159 } | 2158 } |
| 2160 } | 2159 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 } | 2208 } |
| 2210 __ j(ABOVE_EQUAL, deopt); | 2209 __ j(ABOVE_EQUAL, deopt); |
| 2211 } | 2210 } |
| 2212 | 2211 |
| 2213 | 2212 |
| 2214 } // namespace dart | 2213 } // namespace dart |
| 2215 | 2214 |
| 2216 #undef __ | 2215 #undef __ |
| 2217 | 2216 |
| 2218 #endif // defined TARGET_ARCH_X64 | 2217 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |