OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
11 #include "vm/debugger.h" | 11 #include "vm/debugger.h" |
12 #include "vm/deopt_instructions.h" | 12 #include "vm/deopt_instructions.h" |
| 13 #include "vm/exceptions.h" |
13 #include "vm/flow_graph_allocator.h" | 14 #include "vm/flow_graph_allocator.h" |
14 #include "vm/il_printer.h" | 15 #include "vm/il_printer.h" |
15 #include "vm/intrinsifier.h" | 16 #include "vm/intrinsifier.h" |
16 #include "vm/locations.h" | 17 #include "vm/locations.h" |
17 #include "vm/longjump.h" | 18 #include "vm/longjump.h" |
18 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
19 #include "vm/parser.h" | 20 #include "vm/parser.h" |
20 #include "vm/stack_frame.h" | 21 #include "vm/stack_frame.h" |
21 #include "vm/stub_code.h" | 22 #include "vm/stub_code.h" |
22 #include "vm/symbols.h" | 23 #include "vm/symbols.h" |
23 | 24 |
24 namespace dart { | 25 namespace dart { |
25 | 26 |
26 DECLARE_FLAG(bool, code_comments); | 27 DECLARE_FLAG(bool, code_comments); |
27 DECLARE_FLAG(bool, disassemble); | 28 DECLARE_FLAG(bool, disassemble); |
28 DECLARE_FLAG(bool, disassemble_optimized); | 29 DECLARE_FLAG(bool, disassemble_optimized); |
29 DECLARE_FLAG(bool, enable_type_checks); | 30 DECLARE_FLAG(bool, enable_type_checks); |
30 DECLARE_FLAG(bool, intrinsify); | 31 DECLARE_FLAG(bool, intrinsify); |
31 DECLARE_FLAG(bool, propagate_ic_data); | 32 DECLARE_FLAG(bool, propagate_ic_data); |
32 DECLARE_FLAG(bool, report_usage_count); | 33 DECLARE_FLAG(bool, report_usage_count); |
33 DECLARE_FLAG(int, optimization_counter_threshold); | 34 DECLARE_FLAG(int, optimization_counter_threshold); |
34 DECLARE_FLAG(bool, use_cha); | 35 DECLARE_FLAG(bool, use_cha); |
35 DECLARE_FLAG(bool, use_osr); | 36 DECLARE_FLAG(bool, use_osr); |
36 DECLARE_FLAG(int, stacktrace_every); | 37 DECLARE_FLAG(int, stacktrace_every); |
37 DECLARE_FLAG(charp, stacktrace_filter); | 38 DECLARE_FLAG(charp, stacktrace_filter); |
38 DECLARE_FLAG(int, deoptimize_every); | 39 DECLARE_FLAG(int, deoptimize_every); |
39 DECLARE_FLAG(charp, deoptimize_filter); | 40 DECLARE_FLAG(charp, deoptimize_filter); |
| 41 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
40 | 42 |
41 DEFINE_FLAG(bool, enable_simd_inline, true, | 43 DEFINE_FLAG(bool, enable_simd_inline, true, |
42 "Enable inlining of SIMD related method calls."); | 44 "Enable inlining of SIMD related method calls."); |
43 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); | 45 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); |
44 | 46 |
45 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 47 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
46 // with PushArgument. Recursively allocates from outermost to innermost | 48 // with PushArgument. Recursively allocates from outermost to innermost |
47 // environment. | 49 // environment. |
48 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( | 50 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( |
49 Environment* env, | 51 Environment* env, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 set_current_block(NULL); | 333 set_current_block(NULL); |
332 } | 334 } |
333 | 335 |
334 | 336 |
335 void FlowGraphCompiler::Bailout(const char* reason) { | 337 void FlowGraphCompiler::Bailout(const char* reason) { |
336 const Function& function = parsed_function_.function(); | 338 const Function& function = parsed_function_.function(); |
337 const Error& error = Error::Handle( | 339 const Error& error = Error::Handle( |
338 LanguageError::NewFormatted(Error::Handle(), // No previous error. | 340 LanguageError::NewFormatted(Error::Handle(), // No previous error. |
339 Script::Handle(function.script()), | 341 Script::Handle(function.script()), |
340 function.token_pos(), | 342 function.token_pos(), |
341 LanguageError::kError, | 343 LanguageError::kBailout, |
342 Heap::kNew, | 344 Heap::kNew, |
343 "FlowGraphCompiler Bailout: %s %s", | 345 "FlowGraphCompiler Bailout: %s %s", |
344 String::Handle(function.name()).ToCString(), | 346 String::Handle(function.name()).ToCString(), |
345 reason)); | 347 reason)); |
346 Isolate::Current()->long_jump_base()->Jump(1, error); | 348 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 349 UNREACHABLE(); |
347 } | 350 } |
348 | 351 |
349 | 352 |
350 void FlowGraphCompiler::EmitTrySync(Instruction* instr, intptr_t try_index) { | 353 void FlowGraphCompiler::EmitTrySync(Instruction* instr, intptr_t try_index) { |
351 ASSERT(is_optimizing()); | 354 ASSERT(is_optimizing()); |
352 Environment* env = instr->env(); | 355 Environment* env = instr->env(); |
353 CatchBlockEntryInstr* catch_block = | 356 CatchBlockEntryInstr* catch_block = |
354 flow_graph().graph_entry()->GetCatchEntry(try_index); | 357 flow_graph().graph_entry()->GetCatchEntry(try_index); |
355 const GrowableArray<Definition*>* idefs = catch_block->initial_definitions(); | 358 const GrowableArray<Definition*>* idefs = catch_block->initial_definitions(); |
356 | 359 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 break; | 824 break; |
822 default: | 825 default: |
823 UNIMPLEMENTED(); | 826 UNIMPLEMENTED(); |
824 } | 827 } |
825 ExternalLabel target_label("InlineCache", label_address); | 828 ExternalLabel target_label("InlineCache", label_address); |
826 EmitOptimizedInstanceCall(&target_label, ic_data, | 829 EmitOptimizedInstanceCall(&target_label, ic_data, |
827 argument_count, deopt_id, token_pos, locs); | 830 argument_count, deopt_id, token_pos, locs); |
828 return; | 831 return; |
829 } | 832 } |
830 | 833 |
831 if (is_optimizing()) { | 834 if (is_optimizing() && |
| 835 // Do not make the instance call megamorphic if the callee needs to decode |
| 836 // the calling code sequence to lookup the ic data and verify if a JS |
| 837 // warning has already been issued or not. |
| 838 (!FLAG_warn_on_javascript_compatibility || |
| 839 !ic_data.MayCheckForJSWarning())) { |
832 EmitMegamorphicInstanceCall(ic_data, argument_count, | 840 EmitMegamorphicInstanceCall(ic_data, argument_count, |
833 deopt_id, token_pos, locs); | 841 deopt_id, token_pos, locs); |
834 return; | 842 return; |
835 } | 843 } |
836 | 844 |
837 switch (ic_data.NumArgsTested()) { | 845 switch (ic_data.NumArgsTested()) { |
838 case 1: | 846 case 1: |
839 label_address = StubCode::OneArgCheckInlineCacheEntryPoint(); | 847 label_address = StubCode::OneArgCheckInlineCacheEntryPoint(); |
840 break; | 848 break; |
841 case 2: | 849 case 2: |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 | 1325 |
1318 for (int i = 0; i < len; i++) { | 1326 for (int i = 0; i < len; i++) { |
1319 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1327 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1320 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1328 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1321 ic_data.GetCountAt(i))); | 1329 ic_data.GetCountAt(i))); |
1322 } | 1330 } |
1323 sorted->Sort(HighestCountFirst); | 1331 sorted->Sort(HighestCountFirst); |
1324 } | 1332 } |
1325 | 1333 |
1326 } // namespace dart | 1334 } // namespace dart |
OLD | NEW |