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

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

Issue 600243002: Patchable AllocateArray stub, like instance allocation stubs. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« 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"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 __ Pop(R0); 428 __ Pop(R0);
429 // Remove the stub frame. 429 // Remove the stub frame.
430 __ LeaveStubFrame(); 430 __ LeaveStubFrame();
431 // Jump to the dart function. 431 // Jump to the dart function.
432 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset(), kNoPP); 432 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset(), kNoPP);
433 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); 433 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP);
434 __ br(R0); 434 __ br(R0);
435 } 435 }
436 436
437 437
438 // Called from array allocate instruction when the allocation stub has been
439 // disabled.
440 // R1: element type (preserved).
441 // R2: length (preserved).
442 void StubCode::GenerateFixAllocateArrayStubTargetStub(Assembler* assembler) {
443 __ EnterStubFrame();
444 // Setup space on stack for return value and preserve length, element type.
445 __ Push(R1);
446 __ Push(R2);
447 __ PushObject(Object::null_object(), PP);
448 __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0);
449 // Get Code object result and restore length, element type.
450 __ Pop(R0);
451 __ Pop(R2);
452 __ Pop(R1);
453 // Remove the stub frame.
454 __ LeaveStubFrame();
455 // Jump to the dart function.
456 __ LoadFieldFromOffset(R0, R0, Code::instructions_offset(), kNoPP);
457 __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag, kNoPP);
458 __ br(R0);
459 }
460
461
438 // Input parameters: 462 // Input parameters:
439 // R2: smi-tagged argument count, may be zero. 463 // R2: smi-tagged argument count, may be zero.
440 // FP[kParamEndSlotFromFp + 1]: last argument. 464 // FP[kParamEndSlotFromFp + 1]: last argument.
441 static void PushArgumentsArray(Assembler* assembler) { 465 static void PushArgumentsArray(Assembler* assembler) {
442 StubCode* stub_code = Isolate::Current()->stub_code(); 466 StubCode* stub_code = Isolate::Current()->stub_code();
443 // Allocate array to store arguments of caller. 467 // Allocate array to store arguments of caller.
444 __ LoadObject(R1, Object::null_object(), PP); 468 __ LoadObject(R1, Object::null_object(), PP);
445 // R1: null element type for raw Array. 469 // R1: null element type for raw Array.
446 // R2: smi-tagged argument count, may be zero. 470 // R2: smi-tagged argument count, may be zero.
447 __ BranchLink(&stub_code->AllocateArrayLabel(), PP); 471 const Code& array_stub = Code::Handle(stub_code->GetAllocateArrayStub());
472 const ExternalLabel array_label(array_stub.EntryPoint());
473 __ BranchLink(&array_label, PP);
448 // R0: newly allocated array. 474 // R0: newly allocated array.
449 // R2: smi-tagged argument count, may be zero (was preserved by the stub). 475 // R2: smi-tagged argument count, may be zero (was preserved by the stub).
450 __ Push(R0); // Array is in R0 and on top of stack. 476 __ Push(R0); // Array is in R0 and on top of stack.
451 __ add(R1, FP, Operand(R2, LSL, 2)); 477 __ add(R1, FP, Operand(R2, LSL, 2));
452 __ AddImmediate(R1, R1, kParamEndSlotFromFp * kWordSize, PP); 478 __ AddImmediate(R1, R1, kParamEndSlotFromFp * kWordSize, PP);
453 __ AddImmediate(R3, R0, Array::data_offset() - kHeapObjectTag, PP); 479 __ AddImmediate(R3, R0, Array::data_offset() - kHeapObjectTag, PP);
454 // R1: address of first argument on stack. 480 // R1: address of first argument on stack.
455 // R3: address of first argument in array. 481 // R3: address of first argument in array.
456 482
457 Label loop, loop_exit; 483 Label loop, loop_exit;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 661 }
636 662
637 663
638 // Called for inline allocation of arrays. 664 // Called for inline allocation of arrays.
639 // Input parameters: 665 // Input parameters:
640 // LR: return address. 666 // LR: return address.
641 // R2: array length as Smi. 667 // R2: array length as Smi.
642 // R1: array element type (either NULL or an instantiated type). 668 // R1: array element type (either NULL or an instantiated type).
643 // NOTE: R2 cannot be clobbered here as the caller relies on it being saved. 669 // NOTE: R2 cannot be clobbered here as the caller relies on it being saved.
644 // The newly allocated object is returned in R0. 670 // The newly allocated object is returned in R0.
645 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { 671 void StubCode::GeneratePatchableAllocateArrayStub(Assembler* assembler,
672 uword* entry_patch_offset, uword* patch_code_pc_offset) {
673 *entry_patch_offset = assembler->CodeSize();
646 Label slow_case; 674 Label slow_case;
647 // Compute the size to be allocated, it is based on the array length 675 // Compute the size to be allocated, it is based on the array length
648 // and is computed as: 676 // and is computed as:
649 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). 677 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
650 // Assert that length is a Smi. 678 // Assert that length is a Smi.
651 __ tsti(R2, kSmiTagMask); 679 __ tsti(R2, kSmiTagMask);
652 if (FLAG_use_slow_path) { 680 if (FLAG_use_slow_path) {
653 __ b(&slow_case); 681 __ b(&slow_case);
654 } else { 682 } else {
655 __ b(&slow_case, NE); 683 __ b(&slow_case, NE);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 __ PushObject(Object::null_object(), PP); 795 __ PushObject(Object::null_object(), PP);
768 __ Push(R2); 796 __ Push(R2);
769 __ Push(R1); 797 __ Push(R1);
770 __ CallRuntime(kAllocateArrayRuntimeEntry, 2); 798 __ CallRuntime(kAllocateArrayRuntimeEntry, 2);
771 // Pop arguments; result is popped in IP. 799 // Pop arguments; result is popped in IP.
772 __ Pop(R1); 800 __ Pop(R1);
773 __ Pop(R2); 801 __ Pop(R2);
774 __ Pop(R0); 802 __ Pop(R0);
775 __ LeaveStubFrame(); 803 __ LeaveStubFrame();
776 __ ret(); 804 __ ret();
805 *patch_code_pc_offset = assembler->CodeSize();
806 StubCode* stub_code = Isolate::Current()->stub_code();
807 __ BranchPatchable(&stub_code->FixAllocateArrayStubTargetLabel());
777 } 808 }
778 809
779 810
780 // Called when invoking Dart code from C++ (VM code). 811 // Called when invoking Dart code from C++ (VM code).
781 // Input parameters: 812 // Input parameters:
782 // LR : points to return address. 813 // LR : points to return address.
783 // R0 : entrypoint of the Dart function to call. 814 // R0 : entrypoint of the Dart function to call.
784 // R1 : arguments descriptor array. 815 // R1 : arguments descriptor array.
785 // R2 : arguments array. 816 // R2 : arguments array.
786 // R3 : new context containing the current isolate pointer. 817 // R3 : new context containing the current isolate pointer.
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 const Register right = R0; 2124 const Register right = R0;
2094 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); 2125 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP);
2095 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); 2126 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP);
2096 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2127 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2097 __ ret(); 2128 __ ret();
2098 } 2129 }
2099 2130
2100 } // namespace dart 2131 } // namespace dart
2101 2132
2102 #endif // defined TARGET_ARCH_ARM64 2133 #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