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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 RAX. | 26 // on the stack and return the result in a fixed register RAX. |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 comp->locs()->out().reg()); | 307 comp->locs()->out().reg()); |
307 } | 308 } |
308 | 309 |
309 | 310 |
310 static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler, | 311 static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler, |
311 EqualityCompareComp* comp) { | 312 EqualityCompareComp* comp) { |
312 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 313 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
313 comp->cid(), | 314 comp->cid(), |
314 comp->token_pos(), | 315 comp->token_pos(), |
315 comp->try_index()); | 316 comp->try_index()); |
316 const String& operator_name = String::ZoneHandle(String::NewSymbol("==")); | 317 const String& operator_name = String::ZoneHandle(Symbols::New("==")); |
317 const int kNumberOfArguments = 2; | 318 const int kNumberOfArguments = 2; |
318 const Array& kNoArgumentNames = Array::Handle(); | 319 const Array& kNoArgumentNames = Array::Handle(); |
319 const int kNumArgumentsChecked = 2; | 320 const int kNumArgumentsChecked = 2; |
320 | 321 |
321 compiler->GenerateInstanceCall(comp->cid(), | 322 compiler->GenerateInstanceCall(comp->cid(), |
322 comp->token_pos(), | 323 comp->token_pos(), |
323 comp->try_index(), | 324 comp->try_index(), |
324 operator_name, | 325 operator_name, |
325 kNumberOfArguments, | 326 kNumberOfArguments, |
326 kNoArgumentNames, | 327 kNoArgumentNames, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 kNumArguments, | 630 kNumArguments, |
630 Array::Handle(), // No named arguments. | 631 Array::Handle(), // No named arguments. |
631 deopt, // Deoptimize target. | 632 deopt, // Deoptimize target. |
632 NULL, // Fallthrough when done. | 633 NULL, // Fallthrough when done. |
633 cid(), | 634 cid(), |
634 token_pos(), | 635 token_pos(), |
635 try_index()); | 636 try_index()); |
636 return; | 637 return; |
637 } | 638 } |
638 const String& function_name = | 639 const String& function_name = |
639 String::ZoneHandle(String::NewSymbol(Token::Str(kind()))); | 640 String::ZoneHandle(Symbols::New(Token::Str(kind()))); |
640 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 641 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
641 cid(), | 642 cid(), |
642 token_pos(), | 643 token_pos(), |
643 try_index()); | 644 try_index()); |
644 const intptr_t kNumArguments = 2; | 645 const intptr_t kNumArguments = 2; |
645 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 646 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
646 compiler->GenerateInstanceCall(cid(), | 647 compiler->GenerateInstanceCall(cid(), |
647 token_pos(), | 648 token_pos(), |
648 try_index(), | 649 try_index(), |
649 function_name, | 650 function_name, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 } else { | 827 } else { |
827 ASSERT(receiver_type() == kIllegalObjectKind); | 828 ASSERT(receiver_type() == kIllegalObjectKind); |
828 return MakeCallSummary(); | 829 return MakeCallSummary(); |
829 } | 830 } |
830 } | 831 } |
831 | 832 |
832 | 833 |
833 static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler, | 834 static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler, |
834 StoreIndexedComp* comp) { | 835 StoreIndexedComp* comp) { |
835 const String& function_name = | 836 const String& function_name = |
836 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX))); | 837 String::ZoneHandle(Symbols::New(Token::Str(Token::kASSIGN_INDEX))); |
837 | 838 |
838 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 839 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
839 comp->cid(), | 840 comp->cid(), |
840 comp->token_pos(), | 841 comp->token_pos(), |
841 comp->try_index()); | 842 comp->try_index()); |
842 | 843 |
843 const intptr_t kNumArguments = 3; | 844 const intptr_t kNumArguments = 3; |
844 const intptr_t kNumArgsChecked = 1; // Type-feedback. | 845 const intptr_t kNumArgsChecked = 1; // Type-feedback. |
845 compiler->GenerateInstanceCall(comp->cid(), | 846 compiler->GenerateInstanceCall(comp->cid(), |
846 comp->token_pos(), | 847 comp->token_pos(), |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), | 2147 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), |
2147 cid(), token_pos(), try_index()); | 2148 cid(), token_pos(), try_index()); |
2148 return; | 2149 return; |
2149 } | 2150 } |
2150 // Otherwise polymorphic dispatch? | 2151 // Otherwise polymorphic dispatch? |
2151 } | 2152 } |
2152 // Not equal is always split into '==' and negate, | 2153 // Not equal is always split into '==' and negate, |
2153 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; | 2154 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; |
2154 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); | 2155 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); |
2155 const String& function_name = | 2156 const String& function_name = |
2156 String::ZoneHandle(String::NewSymbol(Token::Str(call_kind))); | 2157 String::ZoneHandle(Symbols::New(Token::Str(call_kind))); |
2157 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 2158 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
2158 cid(), | 2159 cid(), |
2159 token_pos(), | 2160 token_pos(), |
2160 try_index()); | 2161 try_index()); |
2161 const intptr_t kNumArguments = 2; | 2162 const intptr_t kNumArguments = 2; |
2162 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 2163 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
2163 compiler->GenerateInstanceCall(cid(), | 2164 compiler->GenerateInstanceCall(cid(), |
2164 token_pos(), | 2165 token_pos(), |
2165 try_index(), | 2166 try_index(), |
2166 function_name, | 2167 function_name, |
2167 kNumArguments, | 2168 kNumArguments, |
2168 Array::ZoneHandle(), // No optional arguments. | 2169 Array::ZoneHandle(), // No optional arguments. |
2169 kNumArgsChecked); | 2170 kNumArgsChecked); |
2170 ASSERT(locs()->out().reg() == RAX); | 2171 ASSERT(locs()->out().reg() == RAX); |
2171 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2172 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
2172 EmitBranchOnCondition(compiler, branch_condition); | 2173 EmitBranchOnCondition(compiler, branch_condition); |
2173 } | 2174 } |
2174 | 2175 |
2175 } // namespace dart | 2176 } // namespace dart |
2176 | 2177 |
2177 #undef __ | 2178 #undef __ |
2178 | 2179 |
2179 #endif // defined TARGET_ARCH_X64 | 2180 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |