| 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 #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 EAX. | 27 // on the stack and return the result in a fixed register EAX. |
| 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(EAX)); | 30 result->set_out(Location::RegisterLocation(EAX)); |
| 30 return result; | 31 return result; |
| 31 } | 32 } |
| 32 | 33 |
| 33 | 34 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 350 |
| 350 const Immediate raw_null = | 351 const Immediate raw_null = |
| 351 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 352 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 352 Label check_identity; | 353 Label check_identity; |
| 353 __ cmpl(Address(ESP, 0 * kWordSize), raw_null); | 354 __ cmpl(Address(ESP, 0 * kWordSize), raw_null); |
| 354 __ j(EQUAL, &check_identity, Assembler::kNearJump); | 355 __ j(EQUAL, &check_identity, Assembler::kNearJump); |
| 355 __ cmpl(Address(ESP, 1 * kWordSize), raw_null); | 356 __ cmpl(Address(ESP, 1 * kWordSize), raw_null); |
| 356 __ j(EQUAL, &check_identity, Assembler::kNearJump); | 357 __ j(EQUAL, &check_identity, Assembler::kNearJump); |
| 357 | 358 |
| 358 ICData& equality_ic_data = ICData::ZoneHandle(); | 359 ICData& equality_ic_data = ICData::ZoneHandle(); |
| 359 if (compiler->is_optimizing()) { | 360 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
| 360 ASSERT(!original_ic_data.IsNull()); | 361 ASSERT(!original_ic_data.IsNull()); |
| 361 equality_ic_data = original_ic_data.AsUnaryClassChecks(); | 362 equality_ic_data = original_ic_data.AsUnaryClassChecks(); |
| 362 } else { | 363 } else { |
| 363 equality_ic_data = ICData::New(compiler->parsed_function().function(), | 364 equality_ic_data = ICData::New(compiler->parsed_function().function(), |
| 364 operator_name, | 365 operator_name, |
| 365 deopt_id, | 366 deopt_id, |
| 366 kNumArgumentsChecked); | 367 kNumArgumentsChecked); |
| 367 } | 368 } |
| 368 compiler->GenerateInstanceCall(deopt_id, | 369 compiler->GenerateInstanceCall(deopt_id, |
| 369 token_pos, | 370 token_pos, |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 const String& function_name = | 990 const String& function_name = |
| 990 String::ZoneHandle(Symbols::New(Token::Str(kind()))); | 991 String::ZoneHandle(Symbols::New(Token::Str(kind()))); |
| 991 if (!compiler->is_optimizing()) { | 992 if (!compiler->is_optimizing()) { |
| 992 compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore, | 993 compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore, |
| 993 deopt_id(), | 994 deopt_id(), |
| 994 token_pos()); | 995 token_pos()); |
| 995 } | 996 } |
| 996 const intptr_t kNumArguments = 2; | 997 const intptr_t kNumArguments = 2; |
| 997 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 998 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
| 998 ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw()); | 999 ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw()); |
| 999 if (compiler->is_optimizing()) { | 1000 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
| 1000 ASSERT(!ic_data()->IsNull()); | 1001 ASSERT(!ic_data()->IsNull()); |
| 1001 relational_ic_data = ic_data()->AsUnaryClassChecks(); | 1002 relational_ic_data = ic_data()->AsUnaryClassChecks(); |
| 1002 } else { | 1003 } else { |
| 1003 relational_ic_data = ICData::New(compiler->parsed_function().function(), | 1004 relational_ic_data = ICData::New(compiler->parsed_function().function(), |
| 1004 function_name, | 1005 function_name, |
| 1005 deopt_id(), | 1006 deopt_id(), |
| 1006 kNumArgsChecked); | 1007 kNumArgsChecked); |
| 1007 } | 1008 } |
| 1008 compiler->GenerateInstanceCall(deopt_id(), | 1009 compiler->GenerateInstanceCall(deopt_id(), |
| 1009 token_pos(), | 1010 token_pos(), |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2697 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2698 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
| 2698 __ pxor(value, XMM0); | 2699 __ pxor(value, XMM0); |
| 2699 } | 2700 } |
| 2700 | 2701 |
| 2701 | 2702 |
| 2702 } // namespace dart | 2703 } // namespace dart |
| 2703 | 2704 |
| 2704 #undef __ | 2705 #undef __ |
| 2705 | 2706 |
| 2706 #endif // defined TARGET_ARCH_X64 | 2707 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |