Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: runtime/vm/stub_code_arm64.cc

Issue 1191813002: Port "Add flag to disable lazy compilation of invocation dispatchers." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flow_graph_compiler.h" 12 #include "vm/flow_graph_compiler.h"
13 #include "vm/heap.h" 13 #include "vm/heap.h"
14 #include "vm/instructions.h" 14 #include "vm/instructions.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/stack_frame.h" 16 #include "vm/stack_frame.h"
17 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
18 #include "vm/tags.h" 18 #include "vm/tags.h"
19 19
20 #define __ assembler-> 20 #define __ assembler->
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); 24 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects.");
25 DEFINE_FLAG(bool, use_slow_path, false, 25 DEFINE_FLAG(bool, use_slow_path, false,
26 "Set to true for debugging & verifying the slow paths."); 26 "Set to true for debugging & verifying the slow paths.");
27 DECLARE_FLAG(bool, trace_optimized_ic_calls); 27 DECLARE_FLAG(bool, trace_optimized_ic_calls);
28 DECLARE_FLAG(int, optimization_counter_threshold); 28 DECLARE_FLAG(int, optimization_counter_threshold);
29 DECLARE_FLAG(bool, support_debugger); 29 DECLARE_FLAG(bool, support_debugger);
30 DECLARE_FLAG(bool, lazy_dispatchers);
30 31
31 // Input parameters: 32 // Input parameters:
32 // LR : return address. 33 // LR : return address.
33 // SP : address of last argument in argument array. 34 // SP : address of last argument in argument array.
34 // SP + 8*R4 - 8 : address of first argument in argument array. 35 // SP + 8*R4 - 8 : address of first argument in argument array.
35 // SP + 8*R4 : address of return value. 36 // SP + 8*R4 : address of return value.
36 // R5 : address of the runtime function to call. 37 // R5 : address of the runtime function to call.
37 // R4 : number of arguments to the call. 38 // R4 : number of arguments to the call.
38 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { 39 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
39 const intptr_t thread_offset = NativeArguments::thread_offset(); 40 const intptr_t thread_offset = NativeArguments::thread_offset();
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 __ AddImmediate(LR, LR, -CallPattern::kLengthInBytes, kNoPP); 571 __ AddImmediate(LR, LR, -CallPattern::kLengthInBytes, kNoPP);
571 GenerateDeoptimizationSequence(assembler, true); // Preserve R0. 572 GenerateDeoptimizationSequence(assembler, true); // Preserve R0.
572 } 573 }
573 574
574 575
575 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { 576 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
576 GenerateDeoptimizationSequence(assembler, false); // Don't preserve R0. 577 GenerateDeoptimizationSequence(assembler, false); // Don't preserve R0.
577 } 578 }
578 579
579 580
581 static void GenerateDispatcherCode(Assembler* assembler,
582 Label* call_target_function) {
583 __ Comment("NoSuchMethodDispatch");
584 // When lazily generated invocation dispatchers are disabled, the
585 // miss-handler may return null.
586 __ CompareObject(R0, Object::null_object(), PP);
587 __ b(call_target_function, NE);
588 __ EnterStubFrame();
589
590 // Load the receiver.
591 __ LoadFieldFromOffset(R2, R4, ArgumentsDescriptor::count_offset(), kNoPP);
592 __ add(TMP, FP, Operand(R2, LSL, 2)); // R2 is Smi.
593 __ LoadFromOffset(R6, TMP, kParamEndSlotFromFp * kWordSize, kNoPP);
594 __ PushObject(Object::null_object(), PP);
595 __ Push(R6);
596 __ Push(R5);
597 __ Push(R4);
598 // R2: Smi-tagged arguments array length.
599 PushArgumentsArray(assembler);
600 const intptr_t kNumArgs = 4;
601 __ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
602 __ Drop(4);
603 __ Pop(R0); // Return value.
604 __ LeaveStubFrame();
605 __ ret();
606 }
607
608
580 void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) { 609 void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
581 __ EnterStubFrame(); 610 __ EnterStubFrame();
582 611
583 // Load the receiver. 612 // Load the receiver.
584 __ LoadFieldFromOffset(R2, R4, ArgumentsDescriptor::count_offset(), kNoPP); 613 __ LoadFieldFromOffset(R2, R4, ArgumentsDescriptor::count_offset(), kNoPP);
585 __ add(TMP, FP, Operand(R2, LSL, 2)); // R2 is Smi. 614 __ add(TMP, FP, Operand(R2, LSL, 2)); // R2 is Smi.
586 __ LoadFromOffset(R6, TMP, kParamEndSlotFromFp * kWordSize, kNoPP); 615 __ LoadFromOffset(R6, TMP, kParamEndSlotFromFp * kWordSize, kNoPP);
587 616
588 // Preserve IC data and arguments descriptor. 617 // Preserve IC data and arguments descriptor.
589 __ Push(R5); 618 __ Push(R5);
(...skipping 11 matching lines...) Expand all
601 // Remove arguments. 630 // Remove arguments.
602 __ Drop(3); 631 __ Drop(3);
603 __ Pop(R0); // Get result into R0 (target function). 632 __ Pop(R0); // Get result into R0 (target function).
604 633
605 // Restore IC data and arguments descriptor. 634 // Restore IC data and arguments descriptor.
606 __ Pop(R4); 635 __ Pop(R4);
607 __ Pop(R5); 636 __ Pop(R5);
608 637
609 __ LeaveStubFrame(); 638 __ LeaveStubFrame();
610 639
640 if (!FLAG_lazy_dispatchers) {
641 Label call_target_function;
642 GenerateDispatcherCode(assembler, &call_target_function);
643 __ Bind(&call_target_function);
644 }
645
611 // Tail-call to target function. 646 // Tail-call to target function.
612 __ LoadFieldFromOffset(R2, R0, Function::instructions_offset(), kNoPP); 647 __ LoadFieldFromOffset(R2, R0, Function::instructions_offset(), kNoPP);
613 __ AddImmediate(R2, R2, Instructions::HeaderSize() - kHeapObjectTag, PP); 648 __ AddImmediate(R2, R2, Instructions::HeaderSize() - kHeapObjectTag, PP);
614 __ br(R2); 649 __ br(R2);
615 } 650 }
616 651
617 652
618 // Called for inline allocation of arrays. 653 // Called for inline allocation of arrays.
619 // Input parameters: 654 // Input parameters:
620 // LR: return address. 655 // LR: return address.
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 __ CallRuntime(handle_ic_miss, num_args + 1); 1546 __ CallRuntime(handle_ic_miss, num_args + 1);
1512 // Remove the call arguments pushed earlier, including the IC data object. 1547 // Remove the call arguments pushed earlier, including the IC data object.
1513 __ Drop(num_args + 1); 1548 __ Drop(num_args + 1);
1514 // Pop returned function object into R0. 1549 // Pop returned function object into R0.
1515 // Restore arguments descriptor array and IC data array. 1550 // Restore arguments descriptor array and IC data array.
1516 __ Pop(R0); // Pop returned function object into R0. 1551 __ Pop(R0); // Pop returned function object into R0.
1517 __ Pop(R5); // Restore IC Data. 1552 __ Pop(R5); // Restore IC Data.
1518 __ Pop(R4); // Restore arguments descriptor array. 1553 __ Pop(R4); // Restore arguments descriptor array.
1519 __ LeaveStubFrame(); 1554 __ LeaveStubFrame();
1520 Label call_target_function; 1555 Label call_target_function;
1521 __ b(&call_target_function); 1556 if (!FLAG_lazy_dispatchers) {
1557 GenerateDispatcherCode(assembler, &call_target_function);
1558 } else {
1559 __ b(&call_target_function);
1560 }
1522 1561
1523 __ Bind(&found); 1562 __ Bind(&found);
1524 __ Comment("Update caller's counter"); 1563 __ Comment("Update caller's counter");
1525 // R6: pointer to an IC data check group. 1564 // R6: pointer to an IC data check group.
1526 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; 1565 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize;
1527 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; 1566 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize;
1528 __ LoadFromOffset(R0, R6, target_offset, kNoPP); 1567 __ LoadFromOffset(R0, R6, target_offset, kNoPP);
1529 1568
1530 if (FLAG_optimization_counter_threshold >= 0) { 1569 if (FLAG_optimization_counter_threshold >= 0) {
1531 // Update counter. 1570 // Update counter.
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 // Result: 2186 // Result:
2148 // R1: entry point. 2187 // R1: entry point.
2149 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { 2188 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2150 EmitMegamorphicLookup(assembler, R0, R1, R1); 2189 EmitMegamorphicLookup(assembler, R0, R1, R1);
2151 __ ret(); 2190 __ ret();
2152 } 2191 }
2153 2192
2154 } // namespace dart 2193 } // namespace dart
2155 2194
2156 #endif // defined TARGET_ARCH_ARM64 2195 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698