Chromium Code Reviews| Index: runtime/vm/simulator_dbc.cc |
| diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc |
| index 9a8838fa60dac34fdb0d0ea8b5d2f66fd2e77820..432815f81796518fc0da8ece43be47efda42a126 100644 |
| --- a/runtime/vm/simulator_dbc.cc |
| +++ b/runtime/vm/simulator_dbc.cc |
| @@ -835,7 +835,11 @@ DART_FORCE_INLINE void Simulator::InstanceCall1(Thread* thread, |
| RawObject** args = call_base; |
| RawArray* cache = icdata->ptr()->ic_data_->ptr(); |
| - RawSmi* receiver_cid = SimulatorHelpers::GetClassIdAsSmi(args[0]); |
| + const intptr_t type_args_len = Smi::Value(*reinterpret_cast<RawSmi**>( |
| + reinterpret_cast<uword>(icdata->ptr()->args_descriptor_->ptr()) + |
| + Array::element_offset(ArgumentsDescriptor::kTypeArgsLenIndex))); |
| + const intptr_t receiver_idx = type_args_len > 0 ? 1 : 0; |
| + RawSmi* receiver_cid = SimulatorHelpers::GetClassIdAsSmi(args[receiver_idx]); |
| bool found = false; |
| const intptr_t length = Smi::Value(cache->length_); |
| @@ -853,8 +857,8 @@ DART_FORCE_INLINE void Simulator::InstanceCall1(Thread* thread, |
| SimulatorHelpers::IncrementICUsageCount(cache->data(), i, kCheckedArgs); |
| } |
| } else { |
| - InlineCacheMiss(kCheckedArgs, thread, icdata, call_base, top, *pc, *FP, |
| - *SP); |
| + InlineCacheMiss(kCheckedArgs, thread, icdata, call_base + receiver_idx, top, |
| + *pc, *FP, *SP); |
| } |
| *argdesc = icdata->ptr()->args_descriptor_; |
| @@ -877,8 +881,12 @@ DART_FORCE_INLINE void Simulator::InstanceCall2(Thread* thread, |
| RawObject** args = call_base; |
| RawArray* cache = icdata->ptr()->ic_data_->ptr(); |
| - RawSmi* receiver_cid = SimulatorHelpers::GetClassIdAsSmi(args[0]); |
| - RawSmi* arg0_cid = SimulatorHelpers::GetClassIdAsSmi(args[1]); |
| + const intptr_t type_args_len = Smi::Value(*reinterpret_cast<RawSmi**>( |
|
zra
2017/08/08 17:47:18
Maybe pull the type_args_len calculation out into
regis
2017/08/08 22:58:28
Done.
|
| + reinterpret_cast<uword>(icdata->ptr()->args_descriptor_->ptr()) + |
| + Array::element_offset(ArgumentsDescriptor::kTypeArgsLenIndex))); |
| + const intptr_t receiver_idx = type_args_len > 0 ? 1 : 0; |
| + RawSmi* receiver_cid = SimulatorHelpers::GetClassIdAsSmi(args[receiver_idx]); |
| + RawSmi* arg0_cid = SimulatorHelpers::GetClassIdAsSmi(args[receiver_idx + 1]); |
| bool found = false; |
| const intptr_t length = Smi::Value(cache->length_); |
| @@ -897,8 +905,8 @@ DART_FORCE_INLINE void Simulator::InstanceCall2(Thread* thread, |
| SimulatorHelpers::IncrementICUsageCount(cache->data(), i, kCheckedArgs); |
| } |
| } else { |
| - InlineCacheMiss(kCheckedArgs, thread, icdata, call_base, top, *pc, *FP, |
| - *SP); |
| + InlineCacheMiss(kCheckedArgs, thread, icdata, call_base + receiver_idx, top, |
| + *pc, *FP, *SP); |
| } |
| *argdesc = icdata->ptr()->args_descriptor_; |
| @@ -1261,6 +1269,7 @@ RawObject* Simulator::Call(const Code& code, |
| // Load argument descriptor. |
| argdesc = arguments_descriptor.raw(); |
| + ASSERT(ArgumentsDescriptor(arguments_descriptor).TypeArgsLen() == 0); |
| // Ready to start executing bytecode. Load entry point and corresponding |
| // object pool. |
| @@ -1432,7 +1441,7 @@ RawObject* Simulator::Call(const Code& code, |
| // Process the list of default values encoded as a sequence of |
| // LoadConstant instructions after EntryOpt bytecode. |
| - // Execute only those that correspond to parameters the were not passed. |
| + // Execute only those that correspond to parameters that were not passed. |
| for (intptr_t i = pos_count - num_fixed_params; i < num_opt_pos_params; |
| i++) { |
| const uint32_t load_value = pc[i]; |
| @@ -1553,6 +1562,32 @@ RawObject* Simulator::Call(const Code& code, |
| DISPATCH(); |
| } |
| + { |
| + BYTECODE(CheckFunctionTypeArgs, A_D); |
| + const uint16_t declared_type_args_len = rA; |
| + const uint16_t first_stack_local_index = rD; |
| + |
| + // Decode arguments descriptor's type args len. |
| + const intptr_t type_args_len = Smi::Value(*reinterpret_cast<RawSmi**>( |
| + reinterpret_cast<uword>(argdesc->ptr()) + |
| + Array::element_offset(ArgumentsDescriptor::kTypeArgsLenIndex))); |
| + if (type_args_len > 0) { |
| + // Decode arguments descriptor's argument count (excluding type args). |
| + const intptr_t arg_count = Smi::Value(*reinterpret_cast<RawSmi**>( |
| + reinterpret_cast<uword>(argdesc->ptr()) + |
| + Array::element_offset(ArgumentsDescriptor::kCountIndex))); |
| + // Copy passed-in type args to first local slot. |
| + FP[first_stack_local_index] = *FrameArguments(FP, arg_count + 1); |
| + } else { |
| + FP[first_stack_local_index] = Object::null(); |
| + } |
| + |
| + // TODO(regis): Verify that type_args_len is correct. |
| + USE(declared_type_args_len); |
| + |
| + DISPATCH(); |
| + } |
| + |
| { |
| BYTECODE(DebugStep, A); |
| if (thread->isolate()->single_step()) { |