| Index: runtime/vm/flow_graph_compiler_x64.cc
|
| diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
|
| index b8b89d7d17ebf9a276a917ab2ce563f378d35983..a206f52210dd4fd2043f04dd51187fd38bc4b4c4 100644
|
| --- a/runtime/vm/flow_graph_compiler_x64.cc
|
| +++ b/runtime/vm/flow_graph_compiler_x64.cc
|
| @@ -98,11 +98,13 @@ 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->AddPcMarker(Function::Handle(), slot_ix++);
|
| + builder->AddPp(Function::Handle(zone, current->code().function()), slot_ix++);
|
| + builder->AddPcMarker(Function::Handle(zone), 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++);
|
|
|
| @@ -122,16 +124,18 @@ 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->AddPcMarker(Function::Handle(previous->code().function()),
|
| + builder->AddPp(Function::Handle(zone, current->code().function()),
|
| + slot_ix++);
|
| + builder->AddPcMarker(Function::Handle(zone, previous->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++);
|
|
|
| // The values of outgoing arguments can be changed from the inlined call so
|
| // we must read them from the previous environment.
|
| @@ -160,7 +164,7 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| // For the outermost environment, set caller PC, caller PP, and caller FP.
|
| builder->AddCallerPp(slot_ix++);
|
| // PC marker.
|
| - builder->AddPcMarker(Function::Handle(previous->code().function()),
|
| + builder->AddPcMarker(Function::Handle(zone, previous->code().function()),
|
| slot_ix++);
|
| builder->AddCallerFp(slot_ix++);
|
| builder->AddCallerPc(slot_ix++);
|
| @@ -221,7 +225,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub(
|
| Label* is_instance_lbl,
|
| Label* is_not_instance_lbl) {
|
| const SubtypeTestCache& type_test_cache =
|
| - SubtypeTestCache::ZoneHandle(SubtypeTestCache::New());
|
| + SubtypeTestCache::ZoneHandle(zone(), SubtypeTestCache::New());
|
| __ LoadUniqueObject(temp_reg, type_test_cache);
|
| __ pushq(temp_reg); // Subtype test cache.
|
| __ pushq(instance_reg); // Instance.
|
| @@ -263,11 +267,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 = RAX;
|
| - 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());
|
| @@ -281,7 +285,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.
|
| @@ -301,13 +305,13 @@ 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(
|
| + const AbstractType& tp_argument = AbstractType::ZoneHandle(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(
|
| @@ -352,16 +356,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 = RAX;
|
| __ testq(kInstanceReg, Immediate(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)) {
|
| __ j(ZERO, is_instance_lbl);
|
| } else {
|
| @@ -390,7 +394,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;
|
| @@ -460,9 +464,9 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
| FieldAddress(RDX, TypeArguments::type_at_offset(type_param.index())));
|
| // RDI: Concrete type of type.
|
| // Check if type argument is dynamic.
|
| - __ CompareObject(RDI, Type::ZoneHandle(Type::DynamicType()));
|
| + __ CompareObject(RDI, Type::ZoneHandle(zone(), Type::DynamicType()));
|
| __ j(EQUAL, is_instance_lbl);
|
| - const Type& object_type = Type::ZoneHandle(Type::ObjectType());
|
| + const Type& object_type = Type::ZoneHandle(zone(), Type::ObjectType());
|
| __ CompareObject(RDI, object_type);
|
| __ j(EQUAL, is_instance_lbl);
|
|
|
| @@ -470,9 +474,9 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
| Label not_smi;
|
| __ testq(RAX, Immediate(kSmiTagMask)); // Value is Smi?
|
| __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump);
|
| - __ CompareObject(RDI, Type::ZoneHandle(Type::IntType()));
|
| + __ CompareObject(RDI, Type::ZoneHandle(zone(), Type::IntType()));
|
| __ j(EQUAL, is_instance_lbl);
|
| - __ CompareObject(RDI, Type::ZoneHandle(Type::Number()));
|
| + __ CompareObject(RDI, Type::ZoneHandle(zone(), Type::Number()));
|
| __ j(EQUAL, is_instance_lbl);
|
| // Smi must be handled in runtime.
|
| Label fall_through;
|
| @@ -485,7 +489,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
| const Register kTypeArgumentsReg = RDX;
|
| const Register kTempReg = R10;
|
| const SubtypeTestCache& type_test_cache =
|
| - SubtypeTestCache::ZoneHandle(
|
| + SubtypeTestCache::ZoneHandle(zone(),
|
| GenerateCallSubtypeTestStub(kTestTypeThreeArgs,
|
| kInstanceReg,
|
| kTypeArgumentsReg,
|
| @@ -536,7 +540,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.
|
| @@ -605,7 +609,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);
|
|
|
| @@ -869,7 +873,7 @@ void FlowGraphCompiler::CopyParameters() {
|
| __ jmp(&assign_optional_parameter, Assembler::kNearJump);
|
| __ Bind(&load_default_value);
|
| // Load RAX with default argument.
|
| - const Object& value = Object::ZoneHandle(
|
| + const Object& value = Object::ZoneHandle(zone(),
|
| parsed_function().default_parameter_values().At(
|
| param_pos - num_fixed_params));
|
| __ LoadObject(RAX, value);
|
| @@ -905,7 +909,7 @@ void FlowGraphCompiler::CopyParameters() {
|
| __ CompareImmediate(RCX, Immediate(param_pos));
|
| __ j(GREATER, &next_parameter, Assembler::kNearJump);
|
| // Load RAX with default argument.
|
| - const Object& value = Object::ZoneHandle(
|
| + const Object& value = Object::ZoneHandle(zone(),
|
| parsed_function().default_parameter_values().At(i));
|
| __ LoadObject(RAX, value);
|
| // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos].
|
| @@ -1245,8 +1249,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(RAX, counter);
|
| intptr_t increment_start = assembler_->CodeSize();
|
| @@ -1274,7 +1278,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
|
| @@ -1298,7 +1302,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(RBX, ic_data);
|
| GenerateDartCall(deopt_id,
|
| token_pos,
|
| @@ -1316,12 +1320,12 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
| intptr_t token_pos,
|
| LocationSummary* locs) {
|
| MegamorphicCacheTable* table = isolate()->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 = RDI;
|
| const Register cacheR = RBX;
|
| const Register targetR = RCX;
|
| @@ -1482,8 +1486,8 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
|
|
| __ 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 RAX.
|
| __ movq(RAX,
|
| Address(RSP, (argument_count - 1) * kWordSize));
|
| @@ -1510,7 +1514,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, RCX);
|
| if (kNumChecks > 1) {
|
|
|