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

Unified Diff: runtime/vm/flow_graph_compiler_arm.cc

Issue 1263573010: Use zone when allocating handles in FlowGraphCompiler assembling operations. Add profiling VM tags… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_arm.cc
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index df9d3cc86034d7ab729d9ec2f5699e210302a82b..89e554439764aec399c48c738f590b01d5d6a9b8 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -98,15 +98,17 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
// The real frame starts here.
builder->MarkFrameStart();
+ Zone* zone = compiler->zone();
+
// Current PP, FP, and PC.
- builder->AddPp(Function::Handle(current->code().function()), slot_ix++);
+ builder->AddPp(Function::Handle(zone, current->code().function()), slot_ix++);
builder->AddCallerFp(slot_ix++);
- builder->AddReturnAddress(Function::Handle(current->code().function()),
+ builder->AddReturnAddress(Function::Handle(zone, current->code().function()),
deopt_id(),
slot_ix++);
// Callee's PC marker is not used anymore. Pass Function::null() to set to 0.
- builder->AddPcMarker(Function::Handle(), slot_ix++);
+ builder->AddPcMarker(Function::Handle(zone), slot_ix++);
// Emit all values that are needed for materialization as a part of the
// expression stack for the bottom-most frame. This guarantees that GC
@@ -124,17 +126,19 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
current = current->outer();
while (current != NULL) {
// PP, FP, and PC.
- builder->AddPp(Function::Handle(current->code().function()), slot_ix++);
+ builder->AddPp(
+ Function::Handle(zone, current->code().function()), slot_ix++);
builder->AddCallerFp(slot_ix++);
// For any outer environment the deopt id is that of the call instruction
// which is recorded in the outer environment.
- builder->AddReturnAddress(Function::Handle(current->code().function()),
- Isolate::ToDeoptAfter(current->deopt_id()),
- slot_ix++);
+ builder->AddReturnAddress(
+ Function::Handle(zone, current->code().function()),
+ Isolate::ToDeoptAfter(current->deopt_id()),
+ slot_ix++);
// PC marker.
- builder->AddPcMarker(Function::Handle(previous->code().function()),
+ builder->AddPcMarker(Function::Handle(zone, previous->code().function()),
slot_ix++);
// The values of outgoing arguments can be changed from the inlined call so
@@ -167,7 +171,7 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
builder->AddCallerPc(slot_ix++);
// PC marker.
- builder->AddPcMarker(Function::Handle(previous->code().function()),
+ builder->AddPcMarker(Function::Handle(zone, previous->code().function()),
slot_ix++);
// For the outermost environment, set the incoming arguments.
@@ -233,7 +237,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub(
ASSERT(instance_reg == R0);
ASSERT(temp_reg == kNoRegister); // Unused on ARM.
const SubtypeTestCache& type_test_cache =
- SubtypeTestCache::ZoneHandle(SubtypeTestCache::New());
+ SubtypeTestCache::ZoneHandle(zone(), SubtypeTestCache::New());
__ LoadUniqueObject(R2, type_test_cache);
if (test_kind == kTestTypeOneArg) {
ASSERT(type_arguments_reg == kNoRegister);
@@ -268,11 +272,11 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
Label* is_not_instance_lbl) {
__ Comment("InstantiatedTypeWithArgumentsTest");
ASSERT(type.IsInstantiated());
- const Class& type_class = Class::ZoneHandle(type.type_class());
+ const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
const Register kInstanceReg = R0;
- Error& malformed_error = Error::Handle();
- const Type& int_type = Type::Handle(Type::IntType());
+ Error& malformed_error = Error::Handle(zone());
+ const Type& int_type = Type::Handle(zone(), Type::IntType());
const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error);
// Malformed type should have been handled at graph construction time.
ASSERT(smi_is_ok || malformed_error.IsNull());
@@ -286,7 +290,7 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
const intptr_t num_type_params = type_class.NumTypeParameters();
const intptr_t from_index = num_type_args - num_type_params;
const TypeArguments& type_arguments =
- TypeArguments::ZoneHandle(type.arguments());
+ TypeArguments::ZoneHandle(zone(), type.arguments());
const bool is_raw_type = type_arguments.IsNull() ||
type_arguments.IsRaw(from_index, num_type_params);
// Signature class is an instantiated parameterized type.
@@ -307,12 +311,12 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
// If one type argument only, check if type argument is Object or dynamic.
if (type_arguments.Length() == 1) {
const AbstractType& tp_argument = AbstractType::ZoneHandle(
- type_arguments.TypeAt(0));
+ zone(), type_arguments.TypeAt(0));
ASSERT(!tp_argument.IsMalformed());
if (tp_argument.IsType()) {
ASSERT(tp_argument.HasResolvedTypeClass());
// Check if type argument is dynamic or Object.
- const Type& object_type = Type::Handle(Type::ObjectType());
+ const Type& object_type = Type::Handle(zone(), Type::ObjectType());
if (object_type.IsSubtypeOf(tp_argument, NULL)) {
// Instance class test only necessary.
return GenerateSubtype1TestCacheLookup(
@@ -358,16 +362,16 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
Label* is_not_instance_lbl) {
__ Comment("InstantiatedTypeNoArgumentsTest");
ASSERT(type.IsInstantiated());
- const Class& type_class = Class::Handle(type.type_class());
+ const Class& type_class = Class::Handle(zone(), type.type_class());
ASSERT(type_class.NumTypeArguments() == 0);
const Register kInstanceReg = R0;
__ tst(kInstanceReg, Operand(kSmiTagMask));
// If instance is Smi, check directly.
- const Class& smi_class = Class::Handle(Smi::Class());
- if (smi_class.IsSubtypeOf(TypeArguments::Handle(),
+ const Class& smi_class = Class::Handle(zone(), Smi::Class());
+ if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()),
type_class,
- TypeArguments::Handle(),
+ TypeArguments::Handle(zone()),
NULL)) {
__ b(is_instance_lbl, EQ);
} else {
@@ -396,7 +400,7 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
}
// Custom checking for numbers (Smi, Mint, Bigint and Double).
// Note that instance is not Smi (checked above).
- if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) {
+ if (type.IsSubtypeOf(Type::Handle(zone(), Type::Number()), NULL)) {
GenerateNumberTypeCheck(
kClassIdReg, type, is_instance_lbl, is_not_instance_lbl);
return false;
@@ -465,18 +469,18 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
FieldAddress(R1, TypeArguments::type_at_offset(type_param.index())));
// R2: concrete type of type.
// Check if type argument is dynamic.
- __ CompareObject(R2, Type::ZoneHandle(Type::DynamicType()));
+ __ CompareObject(R2, Type::ZoneHandle(zone(), Type::DynamicType()));
__ b(is_instance_lbl, EQ);
- __ CompareObject(R2, Type::ZoneHandle(Type::ObjectType()));
+ __ CompareObject(R2, Type::ZoneHandle(zone(), Type::ObjectType()));
__ b(is_instance_lbl, EQ);
// For Smi check quickly against int and num interfaces.
Label not_smi;
__ tst(R0, Operand(kSmiTagMask)); // Value is Smi?
__ b(&not_smi, NE);
- __ CompareObject(R2, Type::ZoneHandle(Type::IntType()));
+ __ CompareObject(R2, Type::ZoneHandle(zone(), Type::IntType()));
__ b(is_instance_lbl, EQ);
- __ CompareObject(R2, Type::ZoneHandle(Type::Number()));
+ __ CompareObject(R2, Type::ZoneHandle(zone(), Type::Number()));
__ b(is_instance_lbl, EQ);
// Smi must be handled in runtime.
Label fall_through;
@@ -489,7 +493,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
const Register kTypeArgumentsReg = R1;
const Register kTempReg = kNoRegister;
const SubtypeTestCache& type_test_cache =
- SubtypeTestCache::ZoneHandle(
+ SubtypeTestCache::ZoneHandle(zone(),
GenerateCallSubtypeTestStub(kTestTypeThreeArgs,
kInstanceReg,
kTypeArgumentsReg,
@@ -540,7 +544,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
return SubtypeTestCache::null();
}
if (type.IsInstantiated()) {
- const Class& type_class = Class::ZoneHandle(type.type_class());
+ const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
// A class equality check is only applicable with a dst type of a
// non-parameterized class, non-signature class, or with a raw dst type of
// a parameterized class.
@@ -609,7 +613,7 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t token_pos,
}
// Generate inline instanceof test.
- SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
+ SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(zone());
test_cache = GenerateInlineInstanceof(token_pos, type,
&is_instance, &is_not_instance);
@@ -704,7 +708,7 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos,
}
// Generate inline type check, linking to runtime call if not assignable.
- SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
+ SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(zone());
test_cache = GenerateInlineInstanceof(token_pos, dst_type,
&is_assignable, &runtime_call);
@@ -861,7 +865,7 @@ void FlowGraphCompiler::CopyParameters() {
__ Bind(&load_default_value);
// Load R5 with default argument.
const Object& value = Object::ZoneHandle(
- parsed_function().default_parameter_values().At(
+ zone(), parsed_function().default_parameter_values().At(
param_pos - num_fixed_params));
__ LoadObject(R5, value);
__ Bind(&assign_optional_parameter);
@@ -897,7 +901,7 @@ void FlowGraphCompiler::CopyParameters() {
__ b(&next_parameter, GT);
// Load R5 with default argument.
const Object& value = Object::ZoneHandle(
- parsed_function().default_parameter_values().At(i));
+ zone(), parsed_function().default_parameter_values().At(i));
__ LoadObject(R5, value);
// Assign R5 to fp[kFirstLocalSlotFromFp - param_pos].
// We do not use the final allocation index of the variable here, i.e.
@@ -1208,8 +1212,8 @@ void FlowGraphCompiler::EmitEdgeCounter() {
// deoptimize, there is a bound on the number of
// optimization/deoptimization cycles we will attempt.
ASSERT(assembler_->constant_pool_allowed());
- const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
- counter.SetAt(0, Smi::Handle(Smi::New(0)));
+ const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld));
+ counter.SetAt(0, Smi::Handle(zone(), Smi::New(0)));
__ Comment("Edge counter");
__ LoadUniqueObject(R0, counter);
intptr_t increment_start = assembler_->CodeSize();
@@ -1246,7 +1250,7 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(
intptr_t deopt_id,
intptr_t token_pos,
LocationSummary* locs) {
- ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
+ ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
// Each ICData propagated from unoptimized to optimized code contains the
// function that corresponds to the Dart function of that IC call. Due
// to inlining in optimized code, that function may not correspond to the
@@ -1271,7 +1275,7 @@ void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label,
intptr_t deopt_id,
intptr_t token_pos,
LocationSummary* locs) {
- ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
+ ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
__ LoadUniqueObject(R5, ic_data);
GenerateDartCall(deopt_id,
token_pos,
@@ -1289,12 +1293,12 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
intptr_t token_pos,
LocationSummary* locs) {
MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table();
- const String& name = String::Handle(ic_data.target_name());
+ const String& name = String::Handle(zone(), ic_data.target_name());
const Array& arguments_descriptor =
- Array::ZoneHandle(ic_data.arguments_descriptor());
+ Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
- const MegamorphicCache& cache =
- MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor));
+ const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
+ zone(), table->Lookup(name, arguments_descriptor));
const Register receiverR = R0;
const Register cacheR = R1;
const Register targetR = R1;
@@ -1524,8 +1528,8 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
ASSERT(is_optimizing());
__ Comment("EmitTestAndCall");
const Array& arguments_descriptor =
- Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
- argument_names));
+ Array::ZoneHandle(zone(), ArgumentsDescriptor::New(argument_count,
+ argument_names));
// Load receiver into R0.
__ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize);
@@ -1552,7 +1556,7 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
&StubCode::CallStaticFunctionLabel(),
RawPcDescriptors::kOther,
locs);
- const Function& function = Function::Handle(ic_data.GetTargetAt(0));
+ const Function& function = Function::Handle(zone(), ic_data.GetTargetAt(0));
AddStaticCallTarget(function);
__ Drop(argument_count);
if (kNumChecks > 1) {
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698