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" |
11 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
12 #include "vm/locations.h" | 12 #include "vm/locations.h" |
13 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
14 #include "vm/parser.h" | 14 #include "vm/parser.h" |
15 #include "vm/stub_code.h" | 15 #include "vm/stub_code.h" |
| 16 #include "vm/symbols.h" |
16 | 17 |
17 #define __ compiler->assembler()-> | 18 #define __ compiler->assembler()-> |
18 | 19 |
19 namespace dart { | 20 namespace dart { |
20 | 21 |
21 DECLARE_FLAG(int, optimization_counter_threshold); | 22 DECLARE_FLAG(int, optimization_counter_threshold); |
22 DECLARE_FLAG(bool, trace_functions); | 23 DECLARE_FLAG(bool, trace_functions); |
23 | 24 |
24 // Generic summary for call instructions that have all arguments pushed | 25 // Generic summary for call instructions that have all arguments pushed |
25 // on the stack and return the result in a fixed register EAX. | 26 // on the stack and return the result in a fixed register EAX. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 comp->locs()->out().reg()); | 298 comp->locs()->out().reg()); |
298 } | 299 } |
299 | 300 |
300 | 301 |
301 static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler, | 302 static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler, |
302 EqualityCompareComp* comp) { | 303 EqualityCompareComp* comp) { |
303 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 304 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
304 comp->cid(), | 305 comp->cid(), |
305 comp->token_pos(), | 306 comp->token_pos(), |
306 comp->try_index()); | 307 comp->try_index()); |
307 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); | 308 const String& operator_name = String::ZoneHandle(Symbols::New("==")); |
308 const int kNumberOfArguments = 2; | 309 const int kNumberOfArguments = 2; |
309 const Array& kNoArgumentNames = Array::Handle(); | 310 const Array& kNoArgumentNames = Array::Handle(); |
310 const int kNumArgumentsChecked = 2; | 311 const int kNumArgumentsChecked = 2; |
311 | 312 |
312 compiler->GenerateInstanceCall(comp->cid(), | 313 compiler->GenerateInstanceCall(comp->cid(), |
313 comp->token_pos(), | 314 comp->token_pos(), |
314 comp->try_index(), | 315 comp->try_index(), |
315 operator_name, | 316 operator_name, |
316 kNumberOfArguments, | 317 kNumberOfArguments, |
317 kNoArgumentNames, | 318 kNoArgumentNames, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 kNumArguments, | 621 kNumArguments, |
621 Array::Handle(), // No named arguments. | 622 Array::Handle(), // No named arguments. |
622 deopt, // Deoptimize target. | 623 deopt, // Deoptimize target. |
623 NULL, // Fallthrough when done. | 624 NULL, // Fallthrough when done. |
624 cid(), | 625 cid(), |
625 token_pos(), | 626 token_pos(), |
626 try_index()); | 627 try_index()); |
627 return; | 628 return; |
628 } | 629 } |
629 const String& function_name = | 630 const String& function_name = |
630 String::ZoneHandle(String::NewSymbol(Token::Str(kind()))); | 631 String::ZoneHandle(Symbols::New(Token::Str(kind()))); |
631 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 632 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
632 cid(), | 633 cid(), |
633 token_pos(), | 634 token_pos(), |
634 try_index()); | 635 try_index()); |
635 const intptr_t kNumArguments = 2; | 636 const intptr_t kNumArguments = 2; |
636 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 637 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
637 compiler->GenerateInstanceCall(cid(), | 638 compiler->GenerateInstanceCall(cid(), |
638 token_pos(), | 639 token_pos(), |
639 try_index(), | 640 try_index(), |
640 function_name, | 641 function_name, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 } else { | 817 } else { |
817 ASSERT(receiver_type() == kIllegalObjectKind); | 818 ASSERT(receiver_type() == kIllegalObjectKind); |
818 return MakeCallSummary(); | 819 return MakeCallSummary(); |
819 } | 820 } |
820 } | 821 } |
821 | 822 |
822 | 823 |
823 static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler, | 824 static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler, |
824 StoreIndexedComp* comp) { | 825 StoreIndexedComp* comp) { |
825 const String& function_name = | 826 const String& function_name = |
826 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX))); | 827 String::ZoneHandle(Symbols::New(Token::Str(Token::kASSIGN_INDEX))); |
827 | 828 |
828 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 829 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
829 comp->cid(), | 830 comp->cid(), |
830 comp->token_pos(), | 831 comp->token_pos(), |
831 comp->try_index()); | 832 comp->try_index()); |
832 | 833 |
833 const intptr_t kNumArguments = 3; | 834 const intptr_t kNumArguments = 3; |
834 const intptr_t kNumArgsChecked = 1; // Type-feedback. | 835 const intptr_t kNumArgsChecked = 1; // Type-feedback. |
835 compiler->GenerateInstanceCall(comp->cid(), | 836 compiler->GenerateInstanceCall(comp->cid(), |
836 comp->token_pos(), | 837 comp->token_pos(), |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), | 2142 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), |
2142 cid(), token_pos(), try_index()); | 2143 cid(), token_pos(), try_index()); |
2143 return; | 2144 return; |
2144 } | 2145 } |
2145 // Otherwise polymorphic dispatch? | 2146 // Otherwise polymorphic dispatch? |
2146 } | 2147 } |
2147 // Not equal is always split into '==' and negate, | 2148 // Not equal is always split into '==' and negate, |
2148 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; | 2149 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; |
2149 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); | 2150 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); |
2150 const String& function_name = | 2151 const String& function_name = |
2151 String::ZoneHandle(String::NewSymbol(Token::Str(call_kind))); | 2152 String::ZoneHandle(Symbols::New(Token::Str(call_kind))); |
2152 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 2153 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
2153 cid(), | 2154 cid(), |
2154 token_pos(), | 2155 token_pos(), |
2155 try_index()); | 2156 try_index()); |
2156 const intptr_t kNumArguments = 2; | 2157 const intptr_t kNumArguments = 2; |
2157 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 2158 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
2158 compiler->GenerateInstanceCall(cid(), | 2159 compiler->GenerateInstanceCall(cid(), |
2159 token_pos(), | 2160 token_pos(), |
2160 try_index(), | 2161 try_index(), |
2161 function_name, | 2162 function_name, |
2162 kNumArguments, | 2163 kNumArguments, |
2163 Array::ZoneHandle(), // No optional arguments. | 2164 Array::ZoneHandle(), // No optional arguments. |
2164 kNumArgsChecked); | 2165 kNumArgsChecked); |
2165 ASSERT(locs()->out().reg() == EAX); | 2166 ASSERT(locs()->out().reg() == EAX); |
2166 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2167 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
2167 EmitBranchOnCondition(compiler, branch_condition); | 2168 EmitBranchOnCondition(compiler, branch_condition); |
2168 } | 2169 } |
2169 | 2170 |
2170 } // namespace dart | 2171 } // namespace dart |
2171 | 2172 |
2172 #undef __ | 2173 #undef __ |
2173 | 2174 |
2174 #endif // defined TARGET_ARCH_X64 | 2175 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |