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

Side by Side Diff: runtime/vm/stub_code_arm.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/object.cc ('k') | runtime/vm/stub_code_arm64.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) 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_ARM) 6 #if defined(TARGET_ARCH_ARM)
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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // R1: number of context variables. 846 // R1: number of context variables.
847 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1; 847 intptr_t fixed_size = sizeof(RawContext) + kObjectAlignment - 1;
848 __ LoadImmediate(R2, fixed_size); 848 __ LoadImmediate(R2, fixed_size);
849 __ add(R2, R2, Operand(R1, LSL, 2)); 849 __ add(R2, R2, Operand(R1, LSL, 2));
850 ASSERT(kSmiTagShift == 1); 850 ASSERT(kSmiTagShift == 1);
851 __ bic(R2, R2, Operand(kObjectAlignment - 1)); 851 __ bic(R2, R2, Operand(kObjectAlignment - 1));
852 852
853 __ MaybeTraceAllocation(kContextCid, R4, &slow_case,
854 /* inline_isolate = */ false);
853 // Now allocate the object. 855 // Now allocate the object.
854 // R1: number of context variables. 856 // R1: number of context variables.
855 // R2: object size. 857 // R2: object size.
856 const intptr_t cid = kContextCid; 858 const intptr_t cid = kContextCid;
857 Heap::Space space = Heap::SpaceForAllocation(cid); 859 Heap::Space space = Heap::SpaceForAllocation(cid);
858 __ LoadIsolate(R5); 860 __ LoadIsolate(R5);
859 __ ldr(R5, Address(R5, Isolate::heap_offset())); 861 __ ldr(R5, Address(R5, Isolate::heap_offset()));
860 __ ldr(R0, Address(R5, Heap::TopOffset(space))); 862 __ ldr(R0, Address(R5, Heap::TopOffset(space)));
861 __ add(R3, R2, Operand(R0)); 863 __ add(R3, R2, Operand(R0));
862 // Check if the allocation fits into the remaining space. 864 // Check if the allocation fits into the remaining space.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 // The generated code is different if the class is parameterized. 1043 // The generated code is different if the class is parameterized.
1042 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; 1044 const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
1043 ASSERT(!is_cls_parameterized || 1045 ASSERT(!is_cls_parameterized ||
1044 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); 1046 (cls.type_arguments_field_offset() != Class::kNoTypeArguments));
1045 // kInlineInstanceSize is a constant used as a threshold for determining 1047 // kInlineInstanceSize is a constant used as a threshold for determining
1046 // when the object initialization should be done as a loop or as 1048 // when the object initialization should be done as a loop or as
1047 // straight line code. 1049 // straight line code.
1048 const int kInlineInstanceSize = 12; 1050 const int kInlineInstanceSize = 12;
1049 const intptr_t instance_size = cls.instance_size(); 1051 const intptr_t instance_size = cls.instance_size();
1050 ASSERT(instance_size > 0); 1052 ASSERT(instance_size > 0);
1053 Isolate* isolate = Isolate::Current();
1051 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && 1054 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) &&
1052 !cls.trace_allocation()) { 1055 !cls.TraceAllocation(isolate)) {
1053 Label slow_case; 1056 Label slow_case;
1054 // Allocate the object and update top to point to 1057 // Allocate the object and update top to point to
1055 // next object start and initialize the allocated object. 1058 // next object start and initialize the allocated object.
1056 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 1059 Heap::Space space = Heap::SpaceForAllocation(cls.id());
1057 __ ldr(R5, Address(THR, Thread::heap_offset())); 1060 __ ldr(R5, Address(THR, Thread::heap_offset()));
1058 __ ldr(R0, Address(R5, Heap::TopOffset(space))); 1061 __ ldr(R0, Address(R5, Heap::TopOffset(space)));
1059 __ AddImmediate(R1, R0, instance_size); 1062 __ AddImmediate(R1, R0, instance_size);
1060 // Check if the allocation fits into the remaining space. 1063 // Check if the allocation fits into the remaining space.
1061 // R0: potential new object start. 1064 // R0: potential new object start.
1062 // R1: potential next object start. 1065 // R1: potential next object start.
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 // Result: 2082 // Result:
2080 // R1: entry point. 2083 // R1: entry point.
2081 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { 2084 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2082 EmitMegamorphicLookup(assembler, R0, R1, R1); 2085 EmitMegamorphicLookup(assembler, R0, R1, R1);
2083 __ Ret(); 2086 __ Ret();
2084 } 2087 }
2085 2088
2086 } // namespace dart 2089 } // namespace dart
2087 2090
2088 #endif // defined TARGET_ARCH_ARM 2091 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698