| 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 #include "vm/symbols.h" |
| 17 | 17 |
| 18 #define __ compiler->assembler()-> | 18 #define __ compiler->assembler()-> |
| 19 | 19 |
| 20 namespace dart { | 20 namespace dart { |
| 21 | 21 |
| 22 DECLARE_FLAG(int, optimization_counter_threshold); | 22 DECLARE_FLAG(int, optimization_counter_threshold); |
| 23 DECLARE_FLAG(bool, trace_functions); | 23 DECLARE_FLAG(bool, trace_functions); |
| 24 DECLARE_FLAG(bool, propagate_ic_data); |
| 24 | 25 |
| 25 // Generic summary for call instructions that have all arguments pushed | 26 // Generic summary for call instructions that have all arguments pushed |
| 26 // on the stack and return the result in a fixed register RAX. | 27 // on the stack and return the result in a fixed register RAX. |
| 27 LocationSummary* Instruction::MakeCallSummary() { | 28 LocationSummary* Instruction::MakeCallSummary() { |
| 28 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 29 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
| 29 result->set_out(Location::RegisterLocation(RAX)); | 30 result->set_out(Location::RegisterLocation(RAX)); |
| 30 return result; | 31 return result; |
| 31 } | 32 } |
| 32 | 33 |
| 33 | 34 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 348 |
| 348 const Immediate raw_null = | 349 const Immediate raw_null = |
| 349 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 350 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 350 Label check_identity; | 351 Label check_identity; |
| 351 __ cmpq(Address(RSP, 0 * kWordSize), raw_null); | 352 __ cmpq(Address(RSP, 0 * kWordSize), raw_null); |
| 352 __ j(EQUAL, &check_identity, Assembler::kNearJump); | 353 __ j(EQUAL, &check_identity, Assembler::kNearJump); |
| 353 __ cmpq(Address(RSP, 1 * kWordSize), raw_null); | 354 __ cmpq(Address(RSP, 1 * kWordSize), raw_null); |
| 354 __ j(EQUAL, &check_identity, Assembler::kNearJump); | 355 __ j(EQUAL, &check_identity, Assembler::kNearJump); |
| 355 | 356 |
| 356 ICData& equality_ic_data = ICData::ZoneHandle(original_ic_data.raw()); | 357 ICData& equality_ic_data = ICData::ZoneHandle(original_ic_data.raw()); |
| 357 if (compiler->is_optimizing()) { | 358 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
| 358 ASSERT(!original_ic_data.IsNull()); | 359 ASSERT(!original_ic_data.IsNull()); |
| 359 equality_ic_data = original_ic_data.AsUnaryClassChecks(); | 360 equality_ic_data = original_ic_data.AsUnaryClassChecks(); |
| 360 } else { | 361 } else { |
| 361 equality_ic_data = ICData::New(compiler->parsed_function().function(), | 362 equality_ic_data = ICData::New(compiler->parsed_function().function(), |
| 362 operator_name, | 363 operator_name, |
| 363 deopt_id, | 364 deopt_id, |
| 364 kNumArgumentsChecked); | 365 kNumArgumentsChecked); |
| 365 } | 366 } |
| 366 compiler->GenerateInstanceCall(deopt_id, | 367 compiler->GenerateInstanceCall(deopt_id, |
| 367 token_pos, | 368 token_pos, |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 const String& function_name = | 859 const String& function_name = |
| 859 String::ZoneHandle(Symbols::New(Token::Str(kind()))); | 860 String::ZoneHandle(Symbols::New(Token::Str(kind()))); |
| 860 if (!compiler->is_optimizing()) { | 861 if (!compiler->is_optimizing()) { |
| 861 compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore, | 862 compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore, |
| 862 deopt_id(), | 863 deopt_id(), |
| 863 token_pos()); | 864 token_pos()); |
| 864 } | 865 } |
| 865 const intptr_t kNumArguments = 2; | 866 const intptr_t kNumArguments = 2; |
| 866 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 867 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
| 867 ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw()); | 868 ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw()); |
| 868 if (compiler->is_optimizing()) { | 869 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
| 869 ASSERT(!ic_data()->IsNull()); | 870 ASSERT(!ic_data()->IsNull()); |
| 870 relational_ic_data = ic_data()->AsUnaryClassChecks(); | 871 relational_ic_data = ic_data()->AsUnaryClassChecks(); |
| 871 } else { | 872 } else { |
| 872 relational_ic_data = ICData::New(compiler->parsed_function().function(), | 873 relational_ic_data = ICData::New(compiler->parsed_function().function(), |
| 873 function_name, | 874 function_name, |
| 874 deopt_id(), | 875 deopt_id(), |
| 875 kNumArgsChecked); | 876 kNumArgsChecked); |
| 876 } | 877 } |
| 877 compiler->GenerateInstanceCall(deopt_id(), | 878 compiler->GenerateInstanceCall(deopt_id(), |
| 878 token_pos(), | 879 token_pos(), |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2331 | 2332 |
| 2332 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2333 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2333 UNIMPLEMENTED(); | 2334 UNIMPLEMENTED(); |
| 2334 } | 2335 } |
| 2335 | 2336 |
| 2336 } // namespace dart | 2337 } // namespace dart |
| 2337 | 2338 |
| 2338 #undef __ | 2339 #undef __ |
| 2339 | 2340 |
| 2340 #endif // defined TARGET_ARCH_X64 | 2341 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |