| Index: runtime/vm/flow_graph_compiler_ia32.cc
|
| diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
|
| index e7202f2f956757b738d18bfc3edcd254a3649a27..0bcc4f2e32b7ac90cdafb489718ad76258f54f67 100644
|
| --- a/runtime/vm/flow_graph_compiler_ia32.cc
|
| +++ b/runtime/vm/flow_graph_compiler_ia32.cc
|
| @@ -100,12 +100,14 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| // The real frame starts here.
|
| builder->MarkFrameStart();
|
|
|
| + Zone* zone = compiler->zone();
|
| +
|
| // Callee's PC marker is not used anymore. Pass Code::null() to set to 0.
|
| - builder->AddPcMarker(Function::Handle(), slot_ix++);
|
| + builder->AddPcMarker(Function::Handle(zone), slot_ix++);
|
|
|
| // Current FP and PC.
|
| builder->AddCallerFp(slot_ix++);
|
| - builder->AddReturnAddress(Function::Handle(current->code().function()),
|
| + builder->AddReturnAddress(Function::Handle(zone, current->code().function()),
|
| deopt_id(),
|
| slot_ix++);
|
|
|
| @@ -122,7 +124,8 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| }
|
|
|
| // Current PC marker and caller FP.
|
| - builder->AddPcMarker(Function::Handle(current->code().function()), slot_ix++);
|
| + builder->AddPcMarker(Function::Handle(
|
| + zone, current->code().function()), slot_ix++);
|
| builder->AddCallerFp(slot_ix++);
|
|
|
| Environment* previous = current;
|
| @@ -130,9 +133,10 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| while (current != NULL) {
|
| // 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.
|
| @@ -152,7 +156,7 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| }
|
|
|
| // PC marker and caller FP.
|
| - builder->AddPcMarker(Function::Handle(current->code().function()),
|
| + builder->AddPcMarker(Function::Handle(zone, current->code().function()),
|
| slot_ix++);
|
| builder->AddCallerFp(slot_ix++);
|
|
|
| @@ -224,7 +228,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());
|
| const Immediate& raw_null =
|
| Immediate(reinterpret_cast<intptr_t>(Object::null()));
|
| __ LoadObject(temp_reg, type_test_cache);
|
| @@ -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 = EAX;
|
| - 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(
|
| @@ -357,16 +361,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 = EAX;
|
| __ testl(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 {
|
| @@ -397,7 +401,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;
|
| @@ -469,18 +473,18 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
| FieldAddress(EDX, TypeArguments::type_at_offset(type_param.index())));
|
| // EDI: concrete type of type.
|
| // Check if type argument is dynamic.
|
| - __ CompareObject(EDI, Type::ZoneHandle(Type::DynamicType()));
|
| + __ CompareObject(EDI, Type::ZoneHandle(zone(), Type::DynamicType()));
|
| __ j(EQUAL, is_instance_lbl);
|
| - __ CompareObject(EDI, Type::ZoneHandle(Type::ObjectType()));
|
| + __ CompareObject(EDI, Type::ZoneHandle(zone(), Type::ObjectType()));
|
| __ j(EQUAL, is_instance_lbl);
|
|
|
| // For Smi check quickly against int and num interfaces.
|
| Label not_smi;
|
| __ testl(EAX, Immediate(kSmiTagMask)); // Value is Smi?
|
| __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump);
|
| - __ CompareObject(EDI, Type::ZoneHandle(Type::IntType()));
|
| + __ CompareObject(EDI, Type::ZoneHandle(zone(), Type::IntType()));
|
| __ j(EQUAL, is_instance_lbl);
|
| - __ CompareObject(EDI, Type::ZoneHandle(Type::Number()));
|
| + __ CompareObject(EDI, Type::ZoneHandle(zone(), Type::Number()));
|
| __ j(EQUAL, is_instance_lbl);
|
| // Smi must be handled in runtime.
|
| Label fall_through;
|
| @@ -493,7 +497,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
| const Register kTypeArgumentsReg = EDX;
|
| const Register kTempReg = EDI;
|
| const SubtypeTestCache& type_test_cache =
|
| - SubtypeTestCache::ZoneHandle(
|
| + SubtypeTestCache::ZoneHandle(zone(),
|
| GenerateCallSubtypeTestStub(kTestTypeThreeArgs,
|
| kInstanceReg,
|
| kTypeArgumentsReg,
|
| @@ -544,7 +548,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.
|
| @@ -615,7 +619,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);
|
|
|
| @@ -716,7 +720,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);
|
|
|
| @@ -880,7 +884,7 @@ void FlowGraphCompiler::CopyParameters() {
|
| __ jmp(&assign_optional_parameter, Assembler::kNearJump);
|
| __ Bind(&load_default_value);
|
| // Load EAX 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(EAX, value);
|
| @@ -915,7 +919,7 @@ void FlowGraphCompiler::CopyParameters() {
|
| __ cmpl(ECX, Immediate(param_pos));
|
| __ j(GREATER, &next_parameter, Assembler::kNearJump);
|
| // Load EAX with default argument.
|
| - const Object& value = Object::ZoneHandle(
|
| + const Object& value = Object::ZoneHandle(zone(),
|
| parsed_function().default_parameter_values().At(i));
|
| __ LoadObject(EAX, value);
|
| // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos].
|
| @@ -1229,8 +1233,8 @@ void FlowGraphCompiler::EmitEdgeCounter() {
|
| // overflow; and though we do not reset the counters when we optimize or
|
| // deoptimize, there is a bound on the number of
|
| // optimization/deoptimization cycles we will attempt.
|
| - 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");
|
| __ LoadObject(EAX, counter);
|
| intptr_t increment_start = assembler_->CodeSize();
|
| @@ -1300,12 +1304,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 = EDI;
|
| const Register cacheR = EBX;
|
| const Register targetR = EBX;
|
| @@ -1510,8 +1514,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 EAX.
|
| __ movl(EAX, Address(ESP, (argument_count - 1) * kWordSize));
|
| __ LoadObject(EDX, arguments_descriptor);
|
| @@ -1537,7 +1541,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) {
|
|
|