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

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

Issue 1292723002: Enable allocation tracing for classes owned by vm isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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_mips.cc ('k') | no next file » | 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) 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 __ j(LESS, &slow_case); 586 __ j(LESS, &slow_case);
587 // Check for maximum allowed length. 587 // Check for maximum allowed length.
588 const Immediate& max_len = 588 const Immediate& max_len =
589 Immediate(reinterpret_cast<int64_t>(Smi::New(Array::kMaxElements))); 589 Immediate(reinterpret_cast<int64_t>(Smi::New(Array::kMaxElements)));
590 __ cmpq(RDI, max_len); 590 __ cmpq(RDI, max_len);
591 __ j(GREATER, &slow_case); 591 __ j(GREATER, &slow_case);
592 592
593 // Check for allocation tracing. 593 // Check for allocation tracing.
594 __ MaybeTraceAllocation(kArrayCid, 594 __ MaybeTraceAllocation(kArrayCid,
595 &slow_case, 595 &slow_case,
596 /* near_jump = */ false, 596 Assembler::kFarJump,
597 /* inline_isolate = */ false); 597 /* inline_isolate = */ false);
598 598
599 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 599 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
600 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi. 600 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi.
601 ASSERT(kSmiTagShift == 1); 601 ASSERT(kSmiTagShift == 1);
602 __ andq(RDI, Immediate(-kObjectAlignment)); 602 __ andq(RDI, Immediate(-kObjectAlignment));
603 603
604 const intptr_t cid = kArrayCid; 604 const intptr_t cid = kArrayCid;
605 Heap::Space space = Heap::SpaceForAllocation(cid); 605 Heap::Space space = Heap::SpaceForAllocation(cid);
606 __ movq(R13, Address(THR, Thread::heap_offset())); 606 __ movq(R13, Address(THR, Thread::heap_offset()));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { 841 void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
842 __ LoadObject(R12, Object::null_object()); 842 __ LoadObject(R12, Object::null_object());
843 if (FLAG_inline_alloc) { 843 if (FLAG_inline_alloc) {
844 Label slow_case; 844 Label slow_case;
845 // First compute the rounded instance size. 845 // First compute the rounded instance size.
846 // R10: number of context variables. 846 // R10: number of context variables.
847 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); 847 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1);
848 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); 848 __ leaq(R13, Address(R10, TIMES_8, fixed_size));
849 __ andq(R13, Immediate(-kObjectAlignment)); 849 __ andq(R13, Immediate(-kObjectAlignment));
850 850
851 // Check for allocation tracing.
852 __ MaybeTraceAllocation(kContextCid,
853 &slow_case,
854 Assembler::kFarJump,
855 /* inline_isolate = */ false);
856
851 // Now allocate the object. 857 // Now allocate the object.
852 // R10: number of context variables. 858 // R10: number of context variables.
853 const intptr_t cid = kContextCid; 859 const intptr_t cid = kContextCid;
854 Heap::Space space = Heap::SpaceForAllocation(cid); 860 Heap::Space space = Heap::SpaceForAllocation(cid);
855 __ movq(RCX, Address(THR, Thread::heap_offset())); 861 __ movq(RCX, Address(THR, Thread::heap_offset()));
856 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); 862 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
857 __ addq(R13, RAX); 863 __ addq(R13, RAX);
858 // Check if the allocation fits into the remaining space. 864 // Check if the allocation fits into the remaining space.
859 // RAX: potential new object. 865 // RAX: potential new object.
860 // R13: potential next object start. 866 // R13: potential next object start.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 // when the object initialization should be done as a loop or as 1053 // when the object initialization should be done as a loop or as
1048 // straight line code. 1054 // straight line code.
1049 const int kInlineInstanceSize = 12; // In words. 1055 const int kInlineInstanceSize = 12; // In words.
1050 const intptr_t instance_size = cls.instance_size(); 1056 const intptr_t instance_size = cls.instance_size();
1051 ASSERT(instance_size > 0); 1057 ASSERT(instance_size > 0);
1052 __ LoadObject(R12, Object::null_object()); 1058 __ LoadObject(R12, Object::null_object());
1053 if (is_cls_parameterized) { 1059 if (is_cls_parameterized) {
1054 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); 1060 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1055 // RDX: instantiated type arguments. 1061 // RDX: instantiated type arguments.
1056 } 1062 }
1063 Isolate* isolate = Isolate::Current();
1057 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && 1064 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) &&
1058 !cls.trace_allocation()) { 1065 !cls.TraceAllocation(isolate)) {
1059 Label slow_case; 1066 Label slow_case;
1060 // Allocate the object and update top to point to 1067 // Allocate the object and update top to point to
1061 // next object start and initialize the allocated object. 1068 // next object start and initialize the allocated object.
1062 // RDX: instantiated type arguments (if is_cls_parameterized). 1069 // RDX: instantiated type arguments (if is_cls_parameterized).
1063 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 1070 Heap::Space space = Heap::SpaceForAllocation(cls.id());
1064 __ movq(RCX, Address(THR, Thread::heap_offset())); 1071 __ movq(RCX, Address(THR, Thread::heap_offset()));
1065 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); 1072 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
1066 __ leaq(RBX, Address(RAX, instance_size)); 1073 __ leaq(RBX, Address(RAX, instance_size));
1067 // Check if the allocation fits into the remaining space. 1074 // Check if the allocation fits into the remaining space.
1068 // RAX: potential new object start. 1075 // RAX: potential new object start.
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 // Result: 2138 // Result:
2132 // RCX: entry point. 2139 // RCX: entry point.
2133 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { 2140 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2134 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); 2141 EmitMegamorphicLookup(assembler, RDI, RBX, RCX);
2135 __ ret(); 2142 __ ret();
2136 } 2143 }
2137 2144
2138 } // namespace dart 2145 } // namespace dart
2139 2146
2140 #endif // defined TARGET_ARCH_X64 2147 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698