| Index: runtime/vm/flow_graph_compiler_x64.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_compiler_x64.cc (revision 37923)
|
| +++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
|
| @@ -165,7 +165,8 @@
|
|
|
| ASSERT(deopt_env() != NULL);
|
|
|
| - __ Call(&StubCode::DeoptimizeLabel(), PP);
|
| + StubCode* stub_code = compiler->isolate()->stub_code();
|
| + __ Call(&stub_code->DeoptimizeLabel(), PP);
|
| set_pc_offset(assem->CodeSize());
|
| __ int3();
|
| #undef __
|
| @@ -199,20 +200,21 @@
|
| Label* is_not_instance_lbl) {
|
| const SubtypeTestCache& type_test_cache =
|
| SubtypeTestCache::ZoneHandle(SubtypeTestCache::New());
|
| + StubCode* stub_code = isolate()->stub_code();
|
| __ LoadObject(temp_reg, type_test_cache, PP);
|
| __ pushq(temp_reg); // Subtype test cache.
|
| __ pushq(instance_reg); // Instance.
|
| if (test_kind == kTestTypeOneArg) {
|
| ASSERT(type_arguments_reg == kNoRegister);
|
| __ PushObject(Object::null_object(), PP);
|
| - __ Call(&StubCode::Subtype1TestCacheLabel(), PP);
|
| + __ Call(&stub_code->Subtype1TestCacheLabel(), PP);
|
| } else if (test_kind == kTestTypeTwoArgs) {
|
| ASSERT(type_arguments_reg == kNoRegister);
|
| __ PushObject(Object::null_object(), PP);
|
| - __ Call(&StubCode::Subtype2TestCacheLabel(), PP);
|
| + __ Call(&stub_code->Subtype2TestCacheLabel(), PP);
|
| } else if (test_kind == kTestTypeThreeArgs) {
|
| __ pushq(type_arguments_reg);
|
| - __ Call(&StubCode::Subtype3TestCacheLabel(), PP);
|
| + __ Call(&stub_code->Subtype3TestCacheLabel(), PP);
|
| } else {
|
| UNREACHABLE();
|
| }
|
| @@ -906,13 +908,14 @@
|
| __ Bind(&wrong_num_arguments);
|
| if (function.IsClosureFunction()) {
|
| // Invoke noSuchMethod function passing "call" as the original name.
|
| + StubCode* stub_code = isolate()->stub_code();
|
| const int kNumArgsChecked = 1;
|
| const ICData& ic_data = ICData::ZoneHandle(
|
| ICData::New(function, Symbols::Call(), Object::empty_array(),
|
| Isolate::kNoDeoptId, kNumArgsChecked));
|
| __ LoadObject(RBX, ic_data, PP);
|
| __ LeaveDartFrame(); // The arguments are still on the stack.
|
| - __ jmp(&StubCode::CallNoSuchMethodFunctionLabel());
|
| + __ jmp(&stub_code->CallNoSuchMethodFunctionLabel());
|
| // The noSuchMethod call may return to the caller, but not here.
|
| __ int3();
|
| } else if (check_correct_named_args) {
|
| @@ -974,6 +977,7 @@
|
| if (CanOptimizeFunction() &&
|
| function.IsOptimizable() &&
|
| (!is_optimizing() || may_reoptimize())) {
|
| + StubCode* stub_code = isolate()->stub_code();
|
| const Register function_reg = RDI;
|
| new_pp = R13;
|
| new_pc = R12;
|
| @@ -1015,7 +1019,7 @@
|
| Immediate(FLAG_optimization_counter_threshold));
|
| }
|
| ASSERT(function_reg == RDI);
|
| - __ J(GREATER_EQUAL, &StubCode::OptimizeFunctionLabel(), R13);
|
| + __ J(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel(), R13);
|
| } else if (!flow_graph().IsCompiledForOsr()) {
|
| // We have to load the PP here too because a load of an external label
|
| // may be patched at the AddCurrentDescriptor below.
|
| @@ -1068,6 +1072,7 @@
|
| const int num_fixed_params = function.num_fixed_parameters();
|
| const int num_copied_params = parsed_function().num_copied_params();
|
| const int num_locals = parsed_function().num_stack_locals();
|
| + StubCode* stub_code = isolate()->stub_code();
|
|
|
| // We check the number of passed arguments when we have to copy them due to
|
| // the presence of optional parameters.
|
| @@ -1107,7 +1112,7 @@
|
| Isolate::kNoDeoptId, kNumArgsChecked));
|
| __ LoadObject(RBX, ic_data, PP);
|
| __ LeaveDartFrame(); // The arguments are still on the stack.
|
| - __ jmp(&StubCode::CallNoSuchMethodFunctionLabel());
|
| + __ jmp(&stub_code->CallNoSuchMethodFunctionLabel());
|
| // The noSuchMethod call may return to the caller, but not here.
|
| __ int3();
|
| } else {
|
| @@ -1141,11 +1146,11 @@
|
| patch_code_pc_offset_ = assembler()->CodeSize();
|
| // This is patched up to a point in FrameEntry where the PP for the
|
| // current function is in R13 instead of PP.
|
| - __ JmpPatchable(&StubCode::FixCallersTargetLabel(), R13);
|
| + __ JmpPatchable(&stub_code->FixCallersTargetLabel(), R13);
|
|
|
| if (is_optimizing()) {
|
| lazy_deopt_pc_offset_ = assembler()->CodeSize();
|
| - __ Jmp(&StubCode::DeoptimizeLazyLabel(), PP);
|
| + __ Jmp(&stub_code->DeoptimizeLazyLabel(), PP);
|
| }
|
| }
|
|
|
| @@ -1211,10 +1216,11 @@
|
| LocationSummary* locs,
|
| const ICData& ic_data) {
|
| uword label_address = 0;
|
| + StubCode* stub_code = isolate()->stub_code();
|
| if (ic_data.NumArgsTested() == 0) {
|
| - label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint();
|
| + label_address = stub_code->ZeroArgsUnoptimizedStaticCallEntryPoint();
|
| } else if (ic_data.NumArgsTested() == 2) {
|
| - label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint();
|
| + label_address = stub_code->TwoArgsUnoptimizedStaticCallEntryPoint();
|
| } else {
|
| UNIMPLEMENTED();
|
| }
|
| @@ -1361,12 +1367,13 @@
|
| intptr_t deopt_id,
|
| intptr_t token_pos,
|
| LocationSummary* locs) {
|
| + StubCode* stub_code = isolate()->stub_code();
|
| __ LoadObject(R10, arguments_descriptor, PP);
|
| // Do not use the code from the function, but let the code be patched so that
|
| // we can record the outgoing edges to other code.
|
| GenerateDartCall(deopt_id,
|
| token_pos,
|
| - &StubCode::CallStaticFunctionLabel(),
|
| + &stub_code->CallStaticFunctionLabel(),
|
| PcDescriptors::kOptStaticCall,
|
| locs);
|
| AddStaticCallTarget(function);
|
| @@ -1388,12 +1395,13 @@
|
| }
|
|
|
| if (needs_number_check) {
|
| + StubCode* stub_code = isolate()->stub_code();
|
| __ pushq(reg);
|
| __ PushObject(obj, PP);
|
| if (is_optimizing()) {
|
| - __ CallPatchable(&StubCode::OptimizedIdenticalWithNumberCheckLabel());
|
| + __ CallPatchable(&stub_code->OptimizedIdenticalWithNumberCheckLabel());
|
| } else {
|
| - __ CallPatchable(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
|
| + __ CallPatchable(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel());
|
| }
|
| if (token_pos != Scanner::kNoSourcePos) {
|
| AddCurrentDescriptor(PcDescriptors::kRuntimeCall,
|
| @@ -1414,14 +1422,15 @@
|
| bool needs_number_check,
|
| intptr_t token_pos) {
|
| if (needs_number_check) {
|
| + StubCode* stub_code = isolate()->stub_code();
|
| __ pushq(left);
|
| __ pushq(right);
|
| if (is_optimizing()) {
|
| - __ CallPatchable(&StubCode::OptimizedIdenticalWithNumberCheckLabel());
|
| + __ CallPatchable(&stub_code->OptimizedIdenticalWithNumberCheckLabel());
|
| } else {
|
| __ movq(R10, Immediate(0));
|
| __ movq(RBX, Immediate(0));
|
| - __ CallPatchable(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
|
| + __ CallPatchable(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel());
|
| }
|
| if (token_pos != Scanner::kNoSourcePos) {
|
| AddCurrentDescriptor(PcDescriptors::kRuntimeCall,
|
| @@ -1478,6 +1487,8 @@
|
| const Array& arguments_descriptor =
|
| Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
|
| argument_names));
|
| + StubCode* stub_code = isolate()->stub_code();
|
| +
|
| __ LoadObject(R10, arguments_descriptor, PP);
|
| for (intptr_t i = 0; i < len; i++) {
|
| const bool is_last_check = (i == (len - 1));
|
| @@ -1492,7 +1503,7 @@
|
| // that we can record the outgoing edges to other code.
|
| GenerateDartCall(deopt_id,
|
| token_index,
|
| - &StubCode::CallStaticFunctionLabel(),
|
| + &stub_code->CallStaticFunctionLabel(),
|
| PcDescriptors::kOptStaticCall,
|
| locs);
|
| const Function& function = *sorted[i].target;
|
|
|