mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 23:41:50 +00:00
Get rid of ast node ids.
Rename cid to deopt_id. Review URL: https://chromiumcodereview.appspot.com//10832150 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10306 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
d51cff04c0
commit
6f5281c404
|
@ -92,11 +92,8 @@ NODE_LIST(DEFINE_VISITOR_FUNCTION)
|
|||
|
||||
class AstNode : public ZoneAllocated {
|
||||
public:
|
||||
static const int kNoId = -1;
|
||||
|
||||
explicit AstNode(intptr_t token_pos)
|
||||
: token_pos_(token_pos),
|
||||
id_(GetNextId()),
|
||||
ic_data_(ICData::ZoneHandle()),
|
||||
info_(NULL) {
|
||||
ASSERT(token_pos >= 0);
|
||||
|
@ -110,8 +107,6 @@ class AstNode : public ZoneAllocated {
|
|||
ic_data_ = value.raw();
|
||||
}
|
||||
|
||||
intptr_t id() const { return id_; }
|
||||
|
||||
void set_info(CodeGenInfo* info) { info_ = info; }
|
||||
CodeGenInfo* info() const { return info_; }
|
||||
|
||||
|
@ -157,17 +152,8 @@ NODE_LIST(AST_TYPE_CHECK)
|
|||
protected:
|
||||
friend class ParsedFunction;
|
||||
|
||||
static intptr_t GetNextId() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
intptr_t tmp = isolate->ast_node_id();
|
||||
isolate->set_ast_node_id(tmp + 1);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private:
|
||||
const intptr_t token_pos_;
|
||||
// Unique id per function compiled, used to match AST node to a PC.
|
||||
const intptr_t id_;
|
||||
// IC data collected for this node.
|
||||
ICData& ic_data_;
|
||||
// Used by optimizing compiler.
|
||||
|
@ -182,9 +168,7 @@ class SequenceNode : public AstNode {
|
|||
: AstNode(token_pos),
|
||||
scope_(scope),
|
||||
nodes_(4),
|
||||
label_(NULL),
|
||||
first_parameter_id_(AstNode::kNoId),
|
||||
last_parameter_id_(AstNode::kNoId) {
|
||||
label_(NULL) {
|
||||
}
|
||||
|
||||
LocalScope* scope() const { return scope_; }
|
||||
|
@ -198,15 +182,6 @@ class SequenceNode : public AstNode {
|
|||
intptr_t length() const { return nodes_.length(); }
|
||||
AstNode* NodeAt(intptr_t index) const { return nodes_[index]; }
|
||||
|
||||
void set_first_parameter_id(intptr_t value) { first_parameter_id_ = value; }
|
||||
void set_last_parameter_id(intptr_t value) { last_parameter_id_ = value; }
|
||||
intptr_t ParameterIdAt(intptr_t param_pos) const {
|
||||
ASSERT(first_parameter_id_ != AstNode::kNoId);
|
||||
ASSERT(last_parameter_id_ != AstNode::kNoId);
|
||||
ASSERT(param_pos <= (last_parameter_id_ - first_parameter_id_));
|
||||
return first_parameter_id_ + param_pos;
|
||||
}
|
||||
|
||||
DECLARE_COMMON_NODE_FUNCTIONS(SequenceNode);
|
||||
|
||||
// Collects all nodes accessible from this sequence node into array 'nodes'.
|
||||
|
@ -216,8 +191,6 @@ class SequenceNode : public AstNode {
|
|||
LocalScope* scope_;
|
||||
GrowableArray<AstNode*> nodes_;
|
||||
SourceLabel* label_;
|
||||
intptr_t first_parameter_id_;
|
||||
intptr_t last_parameter_id_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SequenceNode);
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ AstPrinter::~AstPrinter() { }
|
|||
|
||||
|
||||
void AstPrinter::VisitGenericAstNode(AstNode* node) {
|
||||
OS::Print("(%d: %s ", node->id(), node->Name());
|
||||
OS::Print("(%s ", node->Name());
|
||||
node->VisitChildren(this);
|
||||
OS::Print(")");
|
||||
}
|
||||
|
@ -30,8 +30,7 @@ void AstPrinter::VisitSequenceNode(SequenceNode* node_sequence) {
|
|||
// CodeGeneratorContext.
|
||||
ASSERT(node_sequence != NULL);
|
||||
for (int i = 0; i < node_sequence->length(); i++) {
|
||||
OS::Print("id %d, scope 0x%x: ",
|
||||
node_sequence->NodeAt(i)->id(),
|
||||
OS::Print("scope 0x%x: ",
|
||||
node_sequence->scope());
|
||||
node_sequence->NodeAt(i)->Visit(this);
|
||||
OS::Print("\n");
|
||||
|
|
|
@ -8,13 +8,13 @@ namespace dart {
|
|||
|
||||
void DescriptorList::AddDescriptor(PcDescriptors::Kind kind,
|
||||
intptr_t pc_offset,
|
||||
intptr_t node_id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t try_index) {
|
||||
struct PcDesc data;
|
||||
data.pc_offset = pc_offset;
|
||||
data.kind = kind;
|
||||
data.node_id = node_id;
|
||||
data.deopt_id = deopt_id;
|
||||
data.token_index = token_index;
|
||||
data.try_index = try_index;
|
||||
list_.Add(data);
|
||||
|
@ -22,13 +22,13 @@ void DescriptorList::AddDescriptor(PcDescriptors::Kind kind,
|
|||
|
||||
|
||||
void DescriptorList::AddDeoptInfo(intptr_t pc_offset,
|
||||
intptr_t node_id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t deopt_array_index) {
|
||||
struct PcDesc data;
|
||||
data.pc_offset = pc_offset;
|
||||
data.kind = PcDescriptors::kDeoptIndex;
|
||||
data.node_id = node_id;
|
||||
data.deopt_id = deopt_id;
|
||||
data.token_index = token_index;
|
||||
// Try_index is reused for deopt_array_index.
|
||||
data.try_index = deopt_array_index;
|
||||
|
@ -44,8 +44,8 @@ RawPcDescriptors* DescriptorList::FinalizePcDescriptors(uword entry_point) {
|
|||
descriptors.AddDescriptor(i,
|
||||
(entry_point + PcOffset(i)),
|
||||
Kind(i),
|
||||
NodeId(i),
|
||||
TokenIndex(i),
|
||||
DeoptId(i),
|
||||
TokenPos(i),
|
||||
TryIndex(i));
|
||||
}
|
||||
return descriptors.raw();
|
||||
|
|
|
@ -16,7 +16,7 @@ class DescriptorList : public ZoneAllocated {
|
|||
struct PcDesc {
|
||||
intptr_t pc_offset; // PC offset value of the descriptor.
|
||||
PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther).
|
||||
intptr_t node_id; // AST node id.
|
||||
intptr_t deopt_id; // Deoptimization id.
|
||||
intptr_t token_index; // Token position in source of PC.
|
||||
intptr_t try_index; // Try block index of PC or deopt array index.
|
||||
};
|
||||
|
@ -35,10 +35,10 @@ class DescriptorList : public ZoneAllocated {
|
|||
PcDescriptors::Kind Kind(int index) const {
|
||||
return list_[index].kind;
|
||||
}
|
||||
intptr_t NodeId(int index) const {
|
||||
return list_[index].node_id;
|
||||
intptr_t DeoptId(int index) const {
|
||||
return list_[index].deopt_id;
|
||||
}
|
||||
intptr_t TokenIndex(int index) const {
|
||||
intptr_t TokenPos(int index) const {
|
||||
return list_[index].token_index;
|
||||
}
|
||||
intptr_t TryIndex(int index) const {
|
||||
|
@ -47,11 +47,11 @@ class DescriptorList : public ZoneAllocated {
|
|||
|
||||
void AddDescriptor(PcDescriptors::Kind kind,
|
||||
intptr_t pc_offset,
|
||||
intptr_t node_id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t try_index);
|
||||
void AddDeoptInfo(intptr_t pc_offset,
|
||||
intptr_t node_id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t deopt_array_index);
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ static intptr_t GetCallerLocation() {
|
|||
ASSERT(!descriptors.IsNull());
|
||||
for (int i = 0; i < descriptors.Length(); i++) {
|
||||
if (static_cast<uword>(descriptors.PC(i)) == caller_frame->pc()) {
|
||||
return descriptors.TokenIndex(i);
|
||||
return descriptors.TokenPos(i);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -434,7 +434,6 @@ static bool OptimizeTypeArguments(const Instance& instance,
|
|||
// This operation is currently very slow (lookup of code is not efficient yet).
|
||||
// 'instantiator' can be null, in which case inst_targ
|
||||
static void UpdateTypeTestCache(
|
||||
intptr_t node_id,
|
||||
const Instance& instance,
|
||||
const AbstractType& type,
|
||||
const Instance& instantiator,
|
||||
|
@ -546,23 +545,21 @@ static void UpdateTypeTestCache(
|
|||
|
||||
// Check that the given instance is an instance of the given type.
|
||||
// Tested instance may not be null, because the null test is inlined.
|
||||
// Arg0: node id of the instanceof node.
|
||||
// Arg1: instance being checked.
|
||||
// Arg2: type.
|
||||
// Arg3: instantiator (or null).
|
||||
// Arg4: type arguments of the instantiator of the type.
|
||||
// Arg5: SubtypeTestCache.
|
||||
// Arg0: instance being checked.
|
||||
// Arg1: type.
|
||||
// Arg2: instantiator (or null).
|
||||
// Arg3: type arguments of the instantiator of the type.
|
||||
// Arg4: SubtypeTestCache.
|
||||
// Return value: true or false, or may throw a type error in checked mode.
|
||||
DEFINE_RUNTIME_ENTRY(Instanceof, 6) {
|
||||
DEFINE_RUNTIME_ENTRY(Instanceof, 5) {
|
||||
ASSERT(arguments.Count() == kInstanceofRuntimeEntry.argument_count());
|
||||
intptr_t node_id = Smi::CheckedHandle(arguments.At(0)).Value();
|
||||
const Instance& instance = Instance::CheckedHandle(arguments.At(1));
|
||||
const AbstractType& type = AbstractType::CheckedHandle(arguments.At(2));
|
||||
const Instance& instantiator = Instance::CheckedHandle(arguments.At(3));
|
||||
const Instance& instance = Instance::CheckedHandle(arguments.At(0));
|
||||
const AbstractType& type = AbstractType::CheckedHandle(arguments.At(1));
|
||||
const Instance& instantiator = Instance::CheckedHandle(arguments.At(2));
|
||||
const AbstractTypeArguments& instantiator_type_arguments =
|
||||
AbstractTypeArguments::CheckedHandle(arguments.At(4));
|
||||
AbstractTypeArguments::CheckedHandle(arguments.At(3));
|
||||
const SubtypeTestCache& cache =
|
||||
SubtypeTestCache::CheckedHandle(arguments.At(5));
|
||||
SubtypeTestCache::CheckedHandle(arguments.At(4));
|
||||
ASSERT(type.IsFinalized());
|
||||
Error& malformed_error = Error::Handle();
|
||||
const Bool& result = Bool::Handle(
|
||||
|
@ -584,7 +581,7 @@ DEFINE_RUNTIME_ENTRY(Instanceof, 6) {
|
|||
location, no_name, no_name, no_name, malformed_error_message);
|
||||
UNREACHABLE();
|
||||
}
|
||||
UpdateTypeTestCache(node_id, instance, type, instantiator,
|
||||
UpdateTypeTestCache(instance, type, instantiator,
|
||||
instantiator_type_arguments, result, cache);
|
||||
arguments.SetReturn(result);
|
||||
}
|
||||
|
@ -592,25 +589,23 @@ DEFINE_RUNTIME_ENTRY(Instanceof, 6) {
|
|||
|
||||
// Check that the type of the given instance is a subtype of the given type and
|
||||
// can therefore be assigned.
|
||||
// Arg0: node-id of the assignment.
|
||||
// Arg1: instance being assigned.
|
||||
// Arg2: type being assigned to.
|
||||
// Arg3: instantiator (or null).
|
||||
// Arg4: type arguments of the instantiator of the type being assigned to.
|
||||
// Arg5: name of variable being assigned to.
|
||||
// Arg6: SubtypeTestCache.
|
||||
// Arg0: instance being assigned.
|
||||
// Arg1: type being assigned to.
|
||||
// Arg2: instantiator (or null).
|
||||
// Arg3: type arguments of the instantiator of the type being assigned to.
|
||||
// Arg4: name of variable being assigned to.
|
||||
// Arg5: SubtypeTestCache.
|
||||
// Return value: instance if a subtype, otherwise throw a TypeError.
|
||||
DEFINE_RUNTIME_ENTRY(TypeCheck, 7) {
|
||||
DEFINE_RUNTIME_ENTRY(TypeCheck, 6) {
|
||||
ASSERT(arguments.Count() == kTypeCheckRuntimeEntry.argument_count());
|
||||
intptr_t node_id = Smi::CheckedHandle(arguments.At(0)).Value();
|
||||
const Instance& src_instance = Instance::CheckedHandle(arguments.At(1));
|
||||
const AbstractType& dst_type = AbstractType::CheckedHandle(arguments.At(2));
|
||||
const Instance& dst_instantiator = Instance::CheckedHandle(arguments.At(3));
|
||||
const Instance& src_instance = Instance::CheckedHandle(arguments.At(0));
|
||||
const AbstractType& dst_type = AbstractType::CheckedHandle(arguments.At(1));
|
||||
const Instance& dst_instantiator = Instance::CheckedHandle(arguments.At(2));
|
||||
const AbstractTypeArguments& instantiator_type_arguments =
|
||||
AbstractTypeArguments::CheckedHandle(arguments.At(4));
|
||||
const String& dst_name = String::CheckedHandle(arguments.At(5));
|
||||
AbstractTypeArguments::CheckedHandle(arguments.At(3));
|
||||
const String& dst_name = String::CheckedHandle(arguments.At(4));
|
||||
const SubtypeTestCache& cache =
|
||||
SubtypeTestCache::CheckedHandle(arguments.At(6));
|
||||
SubtypeTestCache::CheckedHandle(arguments.At(5));
|
||||
ASSERT(!dst_type.IsDynamicType()); // No need to check assignment.
|
||||
ASSERT(!dst_type.IsMalformed()); // Already checked in code generator.
|
||||
ASSERT(!src_instance.IsNull()); // Already checked in inlined code.
|
||||
|
@ -647,7 +642,7 @@ DEFINE_RUNTIME_ENTRY(TypeCheck, 7) {
|
|||
dst_name, malformed_error_message);
|
||||
UNREACHABLE();
|
||||
}
|
||||
UpdateTypeTestCache(node_id, src_instance, dst_type,
|
||||
UpdateTypeTestCache(src_instance, dst_type,
|
||||
dst_instantiator, instantiator_type_arguments,
|
||||
Bool::ZoneHandle(Bool::True()), cache);
|
||||
arguments.SetReturn(src_instance);
|
||||
|
@ -1401,10 +1396,10 @@ static intptr_t GetDeoptInfo(const Code& code, uword pc) {
|
|||
// Locate deopt id at deoptimization point inside optimized code.
|
||||
for (int i = 0; i < descriptors.Length(); i++) {
|
||||
if (static_cast<uword>(descriptors.PC(i)) == pc) {
|
||||
return descriptors.NodeId(i);
|
||||
return descriptors.DeoptId(i);
|
||||
}
|
||||
}
|
||||
return Computation::kNoCid;
|
||||
return Isolate::kNoDeoptId;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1438,7 +1433,7 @@ DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
|
|||
ASSERT(optimized_code.is_optimized());
|
||||
|
||||
const intptr_t deopt_id = GetDeoptInfo(optimized_code, caller_frame->pc());
|
||||
ASSERT(deopt_id != Computation::kNoCid);
|
||||
ASSERT(deopt_id != Isolate::kNoDeoptId);
|
||||
|
||||
// Add incoming arguments.
|
||||
const Function& function = Function::Handle(optimized_code.function());
|
||||
|
@ -1498,8 +1493,8 @@ DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp) {
|
|||
intptr_t* registers_copy = isolate->deopt_registers_copy();
|
||||
|
||||
intptr_t deopt_id = GetDeoptInfo(optimized_code, caller_frame->pc());
|
||||
ASSERT(deopt_id != Computation::kNoCid);
|
||||
uword continue_at_pc = unoptimized_code.GetDeoptPcAtNodeId(deopt_id);
|
||||
ASSERT(deopt_id != Isolate::kNoDeoptId);
|
||||
uword continue_at_pc = unoptimized_code.GetDeoptPcAtDeoptId(deopt_id);
|
||||
if (FLAG_trace_deopt) {
|
||||
OS::Print(" -> continue at 0x%x\n", continue_at_pc);
|
||||
// TODO(srdjan): If we could allow GC, we could print the line where
|
||||
|
|
|
@ -56,17 +56,17 @@ DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
|
|||
}
|
||||
|
||||
|
||||
// Returns an array indexed by computation id, containing the extracted ICData.
|
||||
// Returns an array indexed by deopt id, containing the extracted ICData.
|
||||
static RawArray* ExtractTypeFeedbackArray(const Code& code) {
|
||||
ASSERT(!code.IsNull() && !code.is_optimized());
|
||||
GrowableArray<intptr_t> computation_ids;
|
||||
GrowableArray<intptr_t> deopt_ids;
|
||||
const GrowableObjectArray& ic_data_objs =
|
||||
GrowableObjectArray::Handle(GrowableObjectArray::New());
|
||||
const intptr_t max_id =
|
||||
code.ExtractIcDataArraysAtCalls(&computation_ids, ic_data_objs);
|
||||
code.ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs);
|
||||
const Array& result = Array::Handle(Array::New(max_id + 1));
|
||||
for (intptr_t i = 0; i < computation_ids.length(); i++) {
|
||||
intptr_t result_index = computation_ids[i];
|
||||
for (intptr_t i = 0; i < deopt_ids.length(); i++) {
|
||||
intptr_t result_index = deopt_ids[i];
|
||||
ASSERT(result.At(result_index) == Object::null());
|
||||
result.SetAt(result_index, Object::Handle(ic_data_objs.At(i)));
|
||||
}
|
||||
|
@ -129,8 +129,8 @@ static bool CompileParsedFunctionHelper(
|
|||
bool is_compiled = false;
|
||||
Isolate* isolate = Isolate::Current();
|
||||
ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null.
|
||||
const intptr_t prev_cid = isolate->computation_id();
|
||||
isolate->set_computation_id(0);
|
||||
const intptr_t prev_deopt_id = isolate->deopt_id();
|
||||
isolate->set_deopt_id(0);
|
||||
LongJump* old_base = isolate->long_jump_base();
|
||||
LongJump bailout_jump;
|
||||
isolate->set_long_jump_base(&bailout_jump);
|
||||
|
@ -250,7 +250,7 @@ static bool CompileParsedFunctionHelper(
|
|||
// Reset global isolate state.
|
||||
isolate->set_ic_data_array(Array::null());
|
||||
isolate->set_long_jump_base(old_base);
|
||||
isolate->set_computation_id(prev_cid);
|
||||
isolate->set_deopt_id(prev_deopt_id);
|
||||
return is_compiled;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,13 +193,13 @@ void ActivationFrame::GetPcDescriptors() {
|
|||
|
||||
|
||||
// Compute token_pos_ and pc_desc_index_.
|
||||
intptr_t ActivationFrame::TokenIndex() {
|
||||
intptr_t ActivationFrame::TokenPos() {
|
||||
if (token_pos_ < 0) {
|
||||
GetPcDescriptors();
|
||||
for (int i = 0; i < pc_desc_.Length(); i++) {
|
||||
if (pc_desc_.PC(i) == pc_) {
|
||||
pc_desc_index_ = i;
|
||||
token_pos_ = pc_desc_.TokenIndex(i);
|
||||
token_pos_ = pc_desc_.TokenPos(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ intptr_t ActivationFrame::TokenIndex() {
|
|||
|
||||
intptr_t ActivationFrame::PcDescIndex() {
|
||||
if (pc_desc_index_ < 0) {
|
||||
TokenIndex();
|
||||
TokenPos();
|
||||
ASSERT(pc_desc_index_ >= 0);
|
||||
}
|
||||
return pc_desc_index_;
|
||||
|
@ -223,7 +223,7 @@ intptr_t ActivationFrame::LineNumber() {
|
|||
if (line_number_ < 0) {
|
||||
const Script& script = Script::Handle(SourceScript());
|
||||
intptr_t ignore_column;
|
||||
script.GetTokenLocation(TokenIndex(), &line_number_, &ignore_column);
|
||||
script.GetTokenLocation(TokenPos(), &line_number_, &ignore_column);
|
||||
}
|
||||
return line_number_;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ intptr_t ActivationFrame::ContextLevel() {
|
|||
return context_level_;
|
||||
}
|
||||
intptr_t innermost_begin_pos = 0;
|
||||
intptr_t activation_token_pos = TokenIndex();
|
||||
intptr_t activation_token_pos = TokenPos();
|
||||
GetVarDescriptors();
|
||||
intptr_t var_desc_len = var_descriptors_.Length();
|
||||
for (int cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
|
||||
|
@ -298,7 +298,7 @@ void ActivationFrame::GetDescIndices() {
|
|||
GetVarDescriptors();
|
||||
// TODO(hausner): Consider replacing this GrowableArray.
|
||||
GrowableArray<String*> var_names(8);
|
||||
intptr_t activation_token_pos = TokenIndex();
|
||||
intptr_t activation_token_pos = TokenPos();
|
||||
intptr_t var_desc_len = var_descriptors_.Length();
|
||||
for (int cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
|
||||
ASSERT(var_names.length() == desc_indices_.length());
|
||||
|
@ -461,7 +461,7 @@ CodeBreakpoint::CodeBreakpoint(const Function& func, intptr_t pc_desc_index)
|
|||
ASSERT(!code.IsNull()); // Function must be compiled.
|
||||
PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors());
|
||||
ASSERT(pc_desc_index < desc.Length());
|
||||
token_pos_ = desc.TokenIndex(pc_desc_index);
|
||||
token_pos_ = desc.TokenPos(pc_desc_index);
|
||||
ASSERT(token_pos_ >= 0);
|
||||
pc_ = desc.PC(pc_desc_index);
|
||||
ASSERT(pc_ != 0);
|
||||
|
@ -837,7 +837,7 @@ CodeBreakpoint* Debugger::MakeCodeBreakpoint(const Function& func,
|
|||
uword lowest_pc = kUwordMax;
|
||||
intptr_t lowest_pc_index = -1;
|
||||
for (int i = 0; i < desc.Length(); i++) {
|
||||
intptr_t desc_token_pos = desc.TokenIndex(i);
|
||||
intptr_t desc_token_pos = desc.TokenPos(i);
|
||||
if (desc_token_pos < first_token_pos) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class ActivationFrame : public ZoneAllocated {
|
|||
RawString* SourceUrl();
|
||||
RawScript* SourceScript();
|
||||
RawLibrary* Library();
|
||||
intptr_t TokenIndex();
|
||||
intptr_t TokenPos();
|
||||
intptr_t LineNumber();
|
||||
|
||||
// The context level of a frame is the context level at the
|
||||
|
|
|
@ -178,14 +178,14 @@ void FlowGraphCompiler::AddExceptionHandler(intptr_t try_index,
|
|||
|
||||
// Uses current pc position and try-index.
|
||||
void FlowGraphCompiler::AddCurrentDescriptor(PcDescriptors::Kind kind,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
ASSERT((kind != PcDescriptors::kDeopt) ||
|
||||
frame_register_allocator()->IsSpilled());
|
||||
pc_descriptors_list()->AddDescriptor(kind,
|
||||
assembler()->CodeSize(),
|
||||
cid,
|
||||
deopt_id,
|
||||
token_pos,
|
||||
try_index);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ bool FlowGraphCompiler::TryIntrinsify() {
|
|||
|
||||
|
||||
void FlowGraphCompiler::GenerateInstanceCall(
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const String& function_name,
|
||||
|
@ -311,7 +311,7 @@ void FlowGraphCompiler::GenerateInstanceCall(
|
|||
ICData& ic_data =
|
||||
ICData::ZoneHandle(ICData::New(parsed_function().function(),
|
||||
function_name,
|
||||
cid,
|
||||
deopt_id,
|
||||
checked_argument_count));
|
||||
const Array& arguments_descriptor =
|
||||
DartEntry::ArgumentsDescriptor(argument_count, argument_names);
|
||||
|
@ -334,13 +334,13 @@ void FlowGraphCompiler::GenerateInstanceCall(
|
|||
argument_count);
|
||||
pc_descriptors_list()->AddDescriptor(PcDescriptors::kIcCall,
|
||||
descr_offset,
|
||||
cid,
|
||||
deopt_id,
|
||||
token_pos,
|
||||
try_index);
|
||||
}
|
||||
|
||||
|
||||
void FlowGraphCompiler::GenerateStaticCall(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const Function& function,
|
||||
|
@ -355,7 +355,7 @@ void FlowGraphCompiler::GenerateStaticCall(intptr_t cid,
|
|||
argument_count);
|
||||
pc_descriptors_list()->AddDescriptor(PcDescriptors::kFuncCall,
|
||||
descr_offset,
|
||||
cid,
|
||||
deopt_id,
|
||||
token_pos,
|
||||
try_index);
|
||||
}
|
||||
|
@ -419,13 +419,13 @@ void FlowGraphCompiler::EmitLoadIndexedGeneric(LoadIndexedComp* comp) {
|
|||
String::ZoneHandle(Symbols::New(Token::Str(Token::kINDEX)));
|
||||
|
||||
AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
|
||||
const intptr_t kNumArguments = 2;
|
||||
const intptr_t kNumArgsChecked = 1; // Type-feedback.
|
||||
GenerateInstanceCall(comp->cid(),
|
||||
GenerateInstanceCall(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
function_name,
|
||||
|
@ -441,7 +441,7 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
|||
const Array& arg_names,
|
||||
Label* deopt,
|
||||
Label* done,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t try_index) {
|
||||
ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0));
|
||||
|
@ -456,7 +456,7 @@ void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
|
|||
assembler()->j(NOT_EQUAL, &next_test);
|
||||
}
|
||||
const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(i));
|
||||
GenerateStaticCall(cid,
|
||||
GenerateStaticCall(deopt_id,
|
||||
token_index,
|
||||
try_index,
|
||||
target,
|
||||
|
|
|
@ -170,7 +170,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub(
|
|||
// Clobbers ECX, EDI.
|
||||
RawSubtypeTestCache*
|
||||
FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -199,7 +198,7 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
|
|||
GenerateListTypeCheck(kClassIdReg, is_instance_lbl);
|
||||
}
|
||||
return GenerateSubtype1TestCacheLookup(
|
||||
cid, token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
}
|
||||
// If one type argument only, check if type argument is Object or Dynamic.
|
||||
if (type_arguments.Length() == 1) {
|
||||
|
@ -213,7 +212,7 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
|
|||
if (object_type.IsSubtypeOf(tp_argument, NULL)) {
|
||||
// Instance class test only necessary.
|
||||
return GenerateSubtype1TestCacheLookup(
|
||||
cid, token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +246,6 @@ void FlowGraphCompiler::CheckClassIds(Register class_id_reg,
|
|||
// Clobbers ECX, EDI.
|
||||
// Returns true if there is a fallthrough.
|
||||
bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -322,7 +320,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
|
|||
// arrays can grow too high, but they may be useful when optimizing
|
||||
// code (type-feedback).
|
||||
RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const Class& type_class,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -351,7 +348,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup(
|
|||
// EAX: instance (preserved).
|
||||
// Clobbers EDX, EDI, ECX.
|
||||
RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -443,7 +439,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
|||
// may fall through to it. Otherwise, this inline code will jump to the label
|
||||
// is_instance or to the label is_not_instance.
|
||||
RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -459,16 +454,14 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
|||
// A class equality check is only applicable with a dst type of a
|
||||
// non-parameterized class or with a raw dst type of a parameterized class.
|
||||
if (type_class.HasTypeArguments()) {
|
||||
return GenerateInstantiatedTypeWithArgumentsTest(cid,
|
||||
token_pos,
|
||||
return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
|
||||
type,
|
||||
is_instance_lbl,
|
||||
is_not_instance_lbl);
|
||||
// Fall through to runtime call.
|
||||
}
|
||||
const bool has_fall_through =
|
||||
GenerateInstantiatedTypeNoArgumentsTest(cid,
|
||||
token_pos,
|
||||
GenerateInstantiatedTypeNoArgumentsTest(token_pos,
|
||||
type,
|
||||
is_instance_lbl,
|
||||
is_not_instance_lbl);
|
||||
|
@ -476,14 +469,12 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
|||
// If test non-conclusive so far, try the inlined type-test cache.
|
||||
// 'type' is known at compile time.
|
||||
return GenerateSubtype1TestCacheLookup(
|
||||
cid, token_pos, type_class,
|
||||
is_instance_lbl, is_not_instance_lbl);
|
||||
token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
} else {
|
||||
return SubtypeTestCache::null();
|
||||
}
|
||||
}
|
||||
return GenerateUninstantiatedTypeTest(cid,
|
||||
token_pos,
|
||||
return GenerateUninstantiatedTypeTest(token_pos,
|
||||
type,
|
||||
is_instance_lbl,
|
||||
is_not_instance_lbl);
|
||||
|
@ -502,7 +493,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
|||
// Clobbers ECX and EDX.
|
||||
// Returns:
|
||||
// - true or false in EAX.
|
||||
void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateInstanceOf(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& type,
|
||||
|
@ -530,7 +521,7 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
|||
|
||||
// Generate inline instanceof test.
|
||||
SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
|
||||
test_cache = GenerateInlineInstanceof(cid, token_pos, type,
|
||||
test_cache = GenerateInlineInstanceof(token_pos, type,
|
||||
&is_instance, &is_not_instance);
|
||||
|
||||
// test_cache is null if there is no fall-through.
|
||||
|
@ -540,17 +531,17 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
|||
__ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments.
|
||||
__ movl(ECX, Address(ESP, kWordSize)); // Get instantiator.
|
||||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ pushl(Immediate(Smi::RawValue(cid))); // Computation id.
|
||||
__ pushl(EAX); // Push the instance.
|
||||
__ PushObject(type); // Push the type.
|
||||
__ pushl(ECX); // Instantiator.
|
||||
__ pushl(EDX); // Instantiator type arguments.
|
||||
__ LoadObject(EAX, test_cache);
|
||||
__ pushl(EAX);
|
||||
GenerateCallRuntime(cid, token_pos, try_index, kInstanceofRuntimeEntry);
|
||||
GenerateCallRuntime(deopt_id, token_pos, try_index,
|
||||
kInstanceofRuntimeEntry);
|
||||
// Pop the parameters supplied to the runtime entry. The result of the
|
||||
// instanceof runtime call will be left as the result of the operation.
|
||||
__ Drop(6);
|
||||
__ Drop(5);
|
||||
if (negate_result) {
|
||||
__ popl(EDX);
|
||||
__ LoadObject(EAX, bool_true());
|
||||
|
@ -586,7 +577,7 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
|||
// - object in EAX for successful assignable check (or throws TypeError).
|
||||
// Performance notes: positive checks must be quick, negative checks can be slow
|
||||
// as they throw an exception.
|
||||
void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateAssertAssignable(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& dst_type,
|
||||
|
@ -615,7 +606,7 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
|||
__ pushl(EAX); // Push the source object.
|
||||
__ PushObject(dst_name); // Push the name of the destination.
|
||||
__ PushObject(error_message);
|
||||
GenerateCallRuntime(cid,
|
||||
GenerateCallRuntime(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kMalformedTypeErrorRuntimeEntry);
|
||||
|
@ -628,14 +619,13 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
|||
|
||||
// Generate inline type check, linking to runtime call if not assignable.
|
||||
SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
|
||||
test_cache = GenerateInlineInstanceof(cid, token_pos, dst_type,
|
||||
test_cache = GenerateInlineInstanceof(token_pos, dst_type,
|
||||
&is_assignable, &runtime_call);
|
||||
|
||||
__ Bind(&runtime_call);
|
||||
__ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments.
|
||||
__ movl(ECX, Address(ESP, kWordSize)); // Get instantiator.
|
||||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ pushl(Immediate(Smi::RawValue(cid))); // Computation id.
|
||||
__ pushl(EAX); // Push the source object.
|
||||
__ PushObject(dst_type); // Push the type of the destination.
|
||||
__ pushl(ECX); // Instantiator.
|
||||
|
@ -643,13 +633,13 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
|||
__ PushObject(dst_name); // Push the name of the destination.
|
||||
__ LoadObject(EAX, test_cache);
|
||||
__ pushl(EAX);
|
||||
GenerateCallRuntime(cid,
|
||||
GenerateCallRuntime(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kTypeCheckRuntimeEntry);
|
||||
// Pop the parameters supplied to the runtime entry. The result of the
|
||||
// type check runtime call is the checked value.
|
||||
__ Drop(7);
|
||||
__ Drop(6);
|
||||
__ popl(EAX);
|
||||
|
||||
__ Bind(&is_assignable);
|
||||
|
@ -822,7 +812,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|||
__ addl(ESP, Immediate(StackSize() * kWordSize));
|
||||
}
|
||||
if (function.IsClosureFunction()) {
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
0,
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kClosureArgumentMismatchRuntimeEntry);
|
||||
|
@ -833,7 +823,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|||
ICData& ic_data = ICData::ZoneHandle();
|
||||
ic_data = ICData::New(function,
|
||||
String::Handle(function.name()),
|
||||
AstNode::kNoId,
|
||||
Isolate::kNoDeoptId,
|
||||
kNumArgsChecked);
|
||||
__ LoadObject(ECX, ic_data);
|
||||
// EBP - 4 : PC marker, allows easy identification of RawInstruction obj.
|
||||
|
@ -849,7 +839,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|||
if (FLAG_trace_functions) {
|
||||
__ pushl(EAX); // Preserve result.
|
||||
__ PushObject(Function::ZoneHandle(function.raw()));
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
0,
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kTraceFunctionExitRuntimeEntry);
|
||||
|
@ -970,7 +960,7 @@ void FlowGraphCompiler::CompileGraph() {
|
|||
__ cmpl(EAX, Immediate(Smi::RawValue(parameter_count)));
|
||||
__ j(EQUAL, &argc_in_range, Assembler::kNearJump);
|
||||
if (function.IsClosureFunction()) {
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
function.token_pos(),
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kClosureArgumentMismatchRuntimeEntry);
|
||||
|
@ -1008,7 +998,7 @@ void FlowGraphCompiler::CompileGraph() {
|
|||
Address::Absolute(Isolate::Current()->stack_limit_address()));
|
||||
Label no_stack_overflow;
|
||||
__ j(ABOVE, &no_stack_overflow, Assembler::kNearJump);
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
function.token_pos(),
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kStackOverflowRuntimeEntry);
|
||||
|
@ -1032,7 +1022,7 @@ void FlowGraphCompiler::CompileGraph() {
|
|||
// at entry point.
|
||||
pc_descriptors_list()->AddDescriptor(PcDescriptors::kPatchCode,
|
||||
assembler()->CodeSize(),
|
||||
AstNode::kNoId,
|
||||
Isolate::kNoDeoptId,
|
||||
0,
|
||||
-1);
|
||||
__ jmp(&StubCode::FixCallersTargetLabel());
|
||||
|
@ -1046,18 +1036,18 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
|||
ASSERT(!IsLeaf());
|
||||
ASSERT(frame_register_allocator()->IsSpilled());
|
||||
__ call(label);
|
||||
AddCurrentDescriptor(kind, AstNode::kNoId, token_pos, try_index);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos, try_index);
|
||||
}
|
||||
|
||||
|
||||
void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const RuntimeEntry& entry) {
|
||||
ASSERT(!IsLeaf());
|
||||
ASSERT(frame_register_allocator()->IsSpilled());
|
||||
__ CallRuntime(entry);
|
||||
AddCurrentDescriptor(PcDescriptors::kOther, cid, token_pos, try_index);
|
||||
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos, try_index);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
// no fall-through to regular code is needed.
|
||||
bool TryIntrinsify();
|
||||
|
||||
void GenerateCallRuntime(intptr_t cid,
|
||||
void GenerateCallRuntime(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const RuntimeEntry& entry);
|
||||
|
@ -87,19 +87,19 @@ class FlowGraphCompiler : public ValueObject {
|
|||
const ExternalLabel* label,
|
||||
PcDescriptors::Kind kind);
|
||||
|
||||
void GenerateAssertAssignable(intptr_t cid,
|
||||
void GenerateAssertAssignable(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& dst_type,
|
||||
const String& dst_name);
|
||||
|
||||
void GenerateInstanceOf(intptr_t cid,
|
||||
void GenerateInstanceOf(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& type,
|
||||
bool negate_result);
|
||||
|
||||
void GenerateInstanceCall(intptr_t cid,
|
||||
void GenerateInstanceCall(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const String& function_name,
|
||||
|
@ -107,7 +107,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
const Array& argument_names,
|
||||
intptr_t checked_argument_count);
|
||||
|
||||
void GenerateStaticCall(intptr_t cid,
|
||||
void GenerateStaticCall(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const Function& function,
|
||||
|
@ -147,7 +147,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
const Array& arg_names,
|
||||
Label* deopt,
|
||||
Label* done, // Can be NULL, which means fallthrough.
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t try_index);
|
||||
|
||||
|
@ -171,7 +171,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
|
||||
void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset);
|
||||
void AddCurrentDescriptor(PcDescriptors::Kind kind,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index);
|
||||
Label* AddDeoptStub(intptr_t deopt_id,
|
||||
|
@ -220,34 +220,29 @@ class FlowGraphCompiler : public ValueObject {
|
|||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
RawSubtypeTestCache* GenerateInstantiatedTypeWithArgumentsTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& dst_type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
bool GenerateInstantiatedTypeNoArgumentsTest(intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
bool GenerateInstantiatedTypeNoArgumentsTest(intptr_t token_pos,
|
||||
const AbstractType& dst_type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
RawSubtypeTestCache* GenerateUninstantiatedTypeTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& dst_type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_label);
|
||||
|
||||
RawSubtypeTestCache* GenerateSubtype1TestCacheLookup(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const Class& type_class,
|
||||
Label* is_instance_lbl,
|
||||
|
|
|
@ -149,7 +149,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub(
|
|||
// Clobbers R10.
|
||||
RawSubtypeTestCache*
|
||||
FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -178,7 +177,7 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
|
|||
GenerateListTypeCheck(kClassIdReg, is_instance_lbl);
|
||||
}
|
||||
return GenerateSubtype1TestCacheLookup(
|
||||
cid, token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
}
|
||||
// If one type argument only, check if type argument is Object or Dynamic.
|
||||
if (type_arguments.Length() == 1) {
|
||||
|
@ -192,7 +191,7 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
|
|||
if (object_type.IsSubtypeOf(tp_argument, NULL)) {
|
||||
// Instance class test only necessary.
|
||||
return GenerateSubtype1TestCacheLookup(
|
||||
cid, token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +225,6 @@ void FlowGraphCompiler::CheckClassIds(Register class_id_reg,
|
|||
// Clobbers R10, R13.
|
||||
// Returns true if there is a fallthrough.
|
||||
bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -301,7 +299,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
|
|||
// arrays can grow too high, but they may be useful when optimizing
|
||||
// code (type-feedback).
|
||||
RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const Class& type_class,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -330,7 +327,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup(
|
|||
// RAX: instance (preserved).
|
||||
// Clobbers RDI, RDX, R10.
|
||||
RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -422,7 +418,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateUninstantiatedTypeTest(
|
|||
// may fall through to it. Otherwise, this inline code will jump to the label
|
||||
// is_instance or to the label is_not_instance.
|
||||
RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
|
@ -438,16 +433,14 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
|||
// A class equality check is only applicable with a dst type of a
|
||||
// non-parameterized class or with a raw dst type of a parameterized class.
|
||||
if (type_class.HasTypeArguments()) {
|
||||
return GenerateInstantiatedTypeWithArgumentsTest(cid,
|
||||
token_pos,
|
||||
return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
|
||||
type,
|
||||
is_instance_lbl,
|
||||
is_not_instance_lbl);
|
||||
// Fall through to runtime call.
|
||||
}
|
||||
const bool has_fall_through =
|
||||
GenerateInstantiatedTypeNoArgumentsTest(cid,
|
||||
token_pos,
|
||||
GenerateInstantiatedTypeNoArgumentsTest(token_pos,
|
||||
type,
|
||||
is_instance_lbl,
|
||||
is_not_instance_lbl);
|
||||
|
@ -455,14 +448,12 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
|||
// If test non-conclusive so far, try the inlined type-test cache.
|
||||
// 'type' is known at compile time.
|
||||
return GenerateSubtype1TestCacheLookup(
|
||||
cid, token_pos, type_class,
|
||||
is_instance_lbl, is_not_instance_lbl);
|
||||
token_pos, type_class, is_instance_lbl, is_not_instance_lbl);
|
||||
} else {
|
||||
return SubtypeTestCache::null();
|
||||
}
|
||||
}
|
||||
return GenerateUninstantiatedTypeTest(cid,
|
||||
token_pos,
|
||||
return GenerateUninstantiatedTypeTest(token_pos,
|
||||
type,
|
||||
is_instance_lbl,
|
||||
is_not_instance_lbl);
|
||||
|
@ -481,7 +472,7 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
|
|||
// Clobbers RCX and RDX.
|
||||
// Returns:
|
||||
// - true or false in RAX.
|
||||
void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateInstanceOf(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& type,
|
||||
|
@ -509,7 +500,7 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
|||
|
||||
// Generate inline instanceof test.
|
||||
SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
|
||||
test_cache = GenerateInlineInstanceof(cid, token_pos, type,
|
||||
test_cache = GenerateInlineInstanceof(token_pos, type,
|
||||
&is_instance, &is_not_instance);
|
||||
|
||||
// test_cache is null if there is no fall-through.
|
||||
|
@ -519,17 +510,17 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
|||
__ movq(RDX, Address(RSP, 0)); // Get instantiator type arguments.
|
||||
__ movq(RCX, Address(RSP, kWordSize)); // Get instantiator.
|
||||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ pushq(Immediate(Smi::RawValue(cid))); // Computation id.
|
||||
__ pushq(RAX); // Push the instance.
|
||||
__ PushObject(type); // Push the type.
|
||||
__ pushq(RCX); // TODO(srdjan): Pass instantiator instead of null.
|
||||
__ pushq(RDX); // Instantiator type arguments.
|
||||
__ LoadObject(RAX, test_cache);
|
||||
__ pushq(RAX);
|
||||
GenerateCallRuntime(cid, token_pos, try_index, kInstanceofRuntimeEntry);
|
||||
GenerateCallRuntime(deopt_id, token_pos, try_index,
|
||||
kInstanceofRuntimeEntry);
|
||||
// Pop the parameters supplied to the runtime entry. The result of the
|
||||
// instanceof runtime call will be left as the result of the operation.
|
||||
__ Drop(6);
|
||||
__ Drop(5);
|
||||
if (negate_result) {
|
||||
__ popq(RDX);
|
||||
__ LoadObject(RAX, bool_true());
|
||||
|
@ -565,7 +556,7 @@ void FlowGraphCompiler::GenerateInstanceOf(intptr_t cid,
|
|||
// - object in RAX for successful assignable check (or throws TypeError).
|
||||
// Performance notes: positive checks must be quick, negative checks can be slow
|
||||
// as they throw an exception.
|
||||
void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateAssertAssignable(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& dst_type,
|
||||
|
@ -594,7 +585,7 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
|||
__ pushq(RAX); // Push the source object.
|
||||
__ PushObject(dst_name); // Push the name of the destination.
|
||||
__ PushObject(error_message);
|
||||
GenerateCallRuntime(cid,
|
||||
GenerateCallRuntime(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kMalformedTypeErrorRuntimeEntry);
|
||||
|
@ -607,14 +598,13 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
|||
|
||||
// Generate inline type check, linking to runtime call if not assignable.
|
||||
SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
|
||||
test_cache = GenerateInlineInstanceof(cid, token_pos, dst_type,
|
||||
test_cache = GenerateInlineInstanceof(token_pos, dst_type,
|
||||
&is_assignable, &runtime_call);
|
||||
|
||||
__ Bind(&runtime_call);
|
||||
__ movq(RDX, Address(RSP, 0)); // Get instantiator type arguments.
|
||||
__ movq(RCX, Address(RSP, kWordSize)); // Get instantiator.
|
||||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ pushq(Immediate(Smi::RawValue(cid))); // Computation id.
|
||||
__ pushq(RAX); // Push the source object.
|
||||
__ PushObject(dst_type); // Push the type of the destination.
|
||||
__ pushq(RCX); // Instantiator.
|
||||
|
@ -622,13 +612,13 @@ void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid,
|
|||
__ PushObject(dst_name); // Push the name of the destination.
|
||||
__ LoadObject(RAX, test_cache);
|
||||
__ pushq(RAX);
|
||||
GenerateCallRuntime(cid,
|
||||
GenerateCallRuntime(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kTypeCheckRuntimeEntry);
|
||||
// Pop the parameters supplied to the runtime entry. The result of the
|
||||
// type check runtime call is the checked value.
|
||||
__ Drop(7);
|
||||
__ Drop(6);
|
||||
__ popq(RAX);
|
||||
|
||||
__ Bind(&is_assignable);
|
||||
|
@ -803,7 +793,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|||
__ addq(RSP, Immediate(StackSize() * kWordSize));
|
||||
}
|
||||
if (function.IsClosureFunction()) {
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
0,
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kClosureArgumentMismatchRuntimeEntry);
|
||||
|
@ -814,7 +804,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|||
ICData& ic_data = ICData::ZoneHandle();
|
||||
ic_data = ICData::New(function,
|
||||
String::Handle(function.name()),
|
||||
AstNode::kNoId,
|
||||
Isolate::kNoDeoptId,
|
||||
kNumArgsChecked);
|
||||
__ LoadObject(RBX, ic_data);
|
||||
// RBP - 8 : PC marker, allows easy identification of RawInstruction obj.
|
||||
|
@ -830,7 +820,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|||
if (FLAG_trace_functions) {
|
||||
__ pushq(RAX); // Preserve result.
|
||||
__ PushObject(Function::ZoneHandle(function.raw()));
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
0,
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kTraceFunctionExitRuntimeEntry);
|
||||
|
@ -952,7 +942,7 @@ void FlowGraphCompiler::CompileGraph() {
|
|||
__ cmpq(RAX, Immediate(Smi::RawValue(parameter_count)));
|
||||
__ j(EQUAL, &argc_in_range, Assembler::kNearJump);
|
||||
if (function.IsClosureFunction()) {
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
function.token_pos(),
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kClosureArgumentMismatchRuntimeEntry);
|
||||
|
@ -990,7 +980,7 @@ void FlowGraphCompiler::CompileGraph() {
|
|||
__ cmpq(RSP, Address(RDI, 0));
|
||||
Label no_stack_overflow;
|
||||
__ j(ABOVE, &no_stack_overflow, Assembler::kNearJump);
|
||||
GenerateCallRuntime(AstNode::kNoId,
|
||||
GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
function.token_pos(),
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kStackOverflowRuntimeEntry);
|
||||
|
@ -1014,7 +1004,7 @@ void FlowGraphCompiler::CompileGraph() {
|
|||
// at entry point.
|
||||
pc_descriptors_list()->AddDescriptor(PcDescriptors::kPatchCode,
|
||||
assembler()->CodeSize(),
|
||||
AstNode::kNoId,
|
||||
Isolate::kNoDeoptId,
|
||||
0,
|
||||
-1);
|
||||
__ jmp(&StubCode::FixCallersTargetLabel());
|
||||
|
@ -1028,18 +1018,18 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
|||
ASSERT(!IsLeaf());
|
||||
ASSERT(frame_register_allocator()->IsSpilled());
|
||||
__ call(label);
|
||||
AddCurrentDescriptor(kind, AstNode::kNoId, token_pos, try_index);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos, try_index);
|
||||
}
|
||||
|
||||
|
||||
void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid,
|
||||
void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const RuntimeEntry& entry) {
|
||||
ASSERT(!IsLeaf());
|
||||
ASSERT(frame_register_allocator()->IsSpilled());
|
||||
__ CallRuntime(entry);
|
||||
AddCurrentDescriptor(PcDescriptors::kOther, cid, token_pos, try_index);
|
||||
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos, try_index);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
// no fall-through to regular code is needed.
|
||||
bool TryIntrinsify();
|
||||
|
||||
void GenerateCallRuntime(intptr_t cid,
|
||||
void GenerateCallRuntime(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const RuntimeEntry& entry);
|
||||
|
@ -87,19 +87,19 @@ class FlowGraphCompiler : public ValueObject {
|
|||
const ExternalLabel* label,
|
||||
PcDescriptors::Kind kind);
|
||||
|
||||
void GenerateAssertAssignable(intptr_t cid,
|
||||
void GenerateAssertAssignable(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& dst_type,
|
||||
const String& dst_name);
|
||||
|
||||
void GenerateInstanceOf(intptr_t cid,
|
||||
void GenerateInstanceOf(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const AbstractType& type,
|
||||
bool negate_result);
|
||||
|
||||
void GenerateInstanceCall(intptr_t cid,
|
||||
void GenerateInstanceCall(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const String& function_name,
|
||||
|
@ -107,7 +107,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
const Array& argument_names,
|
||||
intptr_t checked_argument_count);
|
||||
|
||||
void GenerateStaticCall(intptr_t cid,
|
||||
void GenerateStaticCall(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index,
|
||||
const Function& function,
|
||||
|
@ -146,8 +146,8 @@ class FlowGraphCompiler : public ValueObject {
|
|||
intptr_t arg_count,
|
||||
const Array& arg_names,
|
||||
Label* deopt,
|
||||
Label* done,
|
||||
intptr_t cid,
|
||||
Label* done, // Can be NULL, which means fallthrough.
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_index,
|
||||
intptr_t try_index);
|
||||
|
||||
|
@ -171,7 +171,7 @@ class FlowGraphCompiler : public ValueObject {
|
|||
|
||||
void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset);
|
||||
void AddCurrentDescriptor(PcDescriptors::Kind kind,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index);
|
||||
Label* AddDeoptStub(intptr_t deopt_id,
|
||||
|
@ -220,34 +220,29 @@ class FlowGraphCompiler : public ValueObject {
|
|||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t token_pos,
|
||||
const AbstractType& type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
RawSubtypeTestCache* GenerateInstantiatedTypeWithArgumentsTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& dst_type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
bool GenerateInstantiatedTypeNoArgumentsTest(intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
bool GenerateInstantiatedTypeNoArgumentsTest(intptr_t token_pos,
|
||||
const AbstractType& dst_type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_lbl);
|
||||
|
||||
RawSubtypeTestCache* GenerateUninstantiatedTypeTest(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const AbstractType& dst_type,
|
||||
Label* is_instance_lbl,
|
||||
Label* is_not_instance_label);
|
||||
|
||||
RawSubtypeTestCache* GenerateSubtype1TestCacheLookup(
|
||||
intptr_t cid,
|
||||
intptr_t token_pos,
|
||||
const Class& type_class,
|
||||
Label* is_instance_lbl,
|
||||
|
|
|
@ -130,7 +130,7 @@ static void PrintICData(BufferFormatter* f, const ICData& ic_data) {
|
|||
|
||||
|
||||
void Computation::PrintTo(BufferFormatter* f) const {
|
||||
f->Print("%s:%d(", DebugName(), cid());
|
||||
f->Print("%s:%d(", DebugName(), deopt_id());
|
||||
PrintOperandsTo(f);
|
||||
f->Print(")");
|
||||
if (HasICData()) {
|
||||
|
@ -468,18 +468,18 @@ void PushArgumentInstr::PrintTo(BufferFormatter* f) const {
|
|||
|
||||
|
||||
void ReturnInstr::PrintTo(BufferFormatter* f) const {
|
||||
f->Print(" %s:%d ", DebugName(), cid());
|
||||
f->Print(" %s:%d ", DebugName(), deopt_id());
|
||||
value()->PrintTo(f);
|
||||
}
|
||||
|
||||
|
||||
void ThrowInstr::PrintTo(BufferFormatter* f) const {
|
||||
f->Print(" %s:%d ", DebugName(), cid());
|
||||
f->Print(" %s:%d ", DebugName(), deopt_id());
|
||||
}
|
||||
|
||||
|
||||
void ReThrowInstr::PrintTo(BufferFormatter* f) const {
|
||||
f->Print(" %s:%d ", DebugName(), cid());
|
||||
f->Print(" %s:%d ", DebugName(), deopt_id());
|
||||
}
|
||||
|
||||
|
||||
|
@ -494,7 +494,7 @@ void GotoInstr::PrintTo(BufferFormatter* f) const {
|
|||
|
||||
|
||||
void BranchInstr::PrintTo(BufferFormatter* f) const {
|
||||
f->Print(" %s:%d ", DebugName(), cid());
|
||||
f->Print(" %s:%d ", DebugName(), deopt_id());
|
||||
f->Print("if ");
|
||||
left()->PrintTo(f);
|
||||
f-> Print(" %s ", Token::Str(kind()));
|
||||
|
@ -733,18 +733,18 @@ void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const {
|
|||
|
||||
|
||||
void ReturnInstr::PrintToVisualizer(BufferFormatter* f) const {
|
||||
f->Print("_ %s:%d ", DebugName(), cid());
|
||||
f->Print("_ %s:%d ", DebugName(), deopt_id());
|
||||
value()->PrintTo(f);
|
||||
}
|
||||
|
||||
|
||||
void ThrowInstr::PrintToVisualizer(BufferFormatter* f) const {
|
||||
f->Print("_ %s:%d ", DebugName(), cid());
|
||||
f->Print("_ %s:%d ", DebugName(), deopt_id());
|
||||
}
|
||||
|
||||
|
||||
void ReThrowInstr::PrintToVisualizer(BufferFormatter* f) const {
|
||||
f->Print("_ %s:%d ", DebugName(), cid());
|
||||
f->Print("_ %s:%d ", DebugName(), deopt_id());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -993,7 +993,7 @@ void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
if (HasICData()) {
|
||||
ASSERT(original() != NULL);
|
||||
Label* deopt = compiler->AddDeoptStub(original()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(original()->deopt_id(),
|
||||
original()->token_pos(),
|
||||
original()->try_index(),
|
||||
kDeoptInstanceGetterSameTarget,
|
||||
|
@ -1018,7 +1018,7 @@ LocationSummary* ThrowInstr::MakeLocationSummary() const {
|
|||
|
||||
|
||||
void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kThrowRuntimeEntry);
|
||||
|
@ -1032,7 +1032,7 @@ LocationSummary* ReThrowInstr::MakeLocationSummary() const {
|
|||
|
||||
|
||||
void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kReThrowRuntimeEntry);
|
||||
|
@ -1173,10 +1173,10 @@ LocationSummary* InstanceCallComp::MakeLocationSummary() const {
|
|||
|
||||
void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
compiler->GenerateInstanceCall(cid(),
|
||||
compiler->GenerateInstanceCall(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
function_name(),
|
||||
|
@ -1197,7 +1197,7 @@ void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
compiler->GenerateInlinedMathSqrt(&done);
|
||||
// Falls through to static call when operand type is not double or smi.
|
||||
}
|
||||
compiler->GenerateStaticCall(cid(),
|
||||
compiler->GenerateStaticCall(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
function(),
|
||||
|
@ -1218,7 +1218,7 @@ void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
|
||||
void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
compiler->GenerateAssertAssignable(cid(),
|
||||
compiler->GenerateAssertAssignable(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
dst_type(),
|
||||
|
|
|
@ -117,16 +117,14 @@ class Value;
|
|||
|
||||
class Computation : public ZoneAllocated {
|
||||
public:
|
||||
static const intptr_t kNoCid = -1;
|
||||
|
||||
Computation() : cid_(kNoCid), ic_data_(NULL), locs_(NULL) {
|
||||
Computation() : deopt_id_(Isolate::kNoDeoptId), ic_data_(NULL), locs_(NULL) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
cid_ = isolate->GetNextCid();
|
||||
ic_data_ = isolate->GetICDataForCid(cid_);
|
||||
deopt_id_ = isolate->GetNextDeoptId();
|
||||
ic_data_ = isolate->GetICDataForDeoptId(deopt_id_);
|
||||
}
|
||||
|
||||
// Unique computation/instruction id, used for deoptimization.
|
||||
intptr_t cid() const { return cid_; }
|
||||
// Unique id used for deoptimization.
|
||||
intptr_t deopt_id() const { return deopt_id_; }
|
||||
|
||||
ICData* ic_data() const { return ic_data_; }
|
||||
void set_ic_data(ICData* value) { ic_data_ = value; }
|
||||
|
@ -204,7 +202,7 @@ FOR_EACH_COMPUTATION(DECLARE_PREDICATE)
|
|||
#undef DECLARE_PREDICATE
|
||||
|
||||
private:
|
||||
intptr_t cid_;
|
||||
intptr_t deopt_id_;
|
||||
ICData* ic_data_;
|
||||
LocationSummary* locs_;
|
||||
|
||||
|
@ -2441,7 +2439,7 @@ class ReturnInstr : public InstructionWithInputs {
|
|||
public:
|
||||
ReturnInstr(intptr_t token_pos, Value* value)
|
||||
: InstructionWithInputs(),
|
||||
cid_(Isolate::Current()->GetNextCid()),
|
||||
deopt_id_(Isolate::Current()->GetNextDeoptId()),
|
||||
token_pos_(token_pos),
|
||||
value_(value) {
|
||||
ASSERT(value_ != NULL);
|
||||
|
@ -2451,7 +2449,7 @@ class ReturnInstr : public InstructionWithInputs {
|
|||
|
||||
virtual intptr_t ArgumentCount() const { return 0; }
|
||||
|
||||
intptr_t cid() const { return cid_; }
|
||||
intptr_t deopt_id() const { return deopt_id_; }
|
||||
intptr_t token_pos() const { return token_pos_; }
|
||||
Value* value() const { return value_; }
|
||||
|
||||
|
@ -2462,7 +2460,7 @@ class ReturnInstr : public InstructionWithInputs {
|
|||
virtual bool CanDeoptimize() const { return false; }
|
||||
|
||||
private:
|
||||
const intptr_t cid_; // Computation/instruction id.
|
||||
const intptr_t deopt_id_;
|
||||
const intptr_t token_pos_;
|
||||
Value* value_;
|
||||
|
||||
|
@ -2474,7 +2472,7 @@ class ThrowInstr : public InstructionWithInputs {
|
|||
public:
|
||||
ThrowInstr(intptr_t token_pos, intptr_t try_index)
|
||||
: InstructionWithInputs(),
|
||||
cid_(Isolate::Current()->GetNextCid()),
|
||||
deopt_id_(Isolate::Current()->GetNextDeoptId()),
|
||||
token_pos_(token_pos),
|
||||
try_index_(try_index) { }
|
||||
|
||||
|
@ -2482,7 +2480,7 @@ class ThrowInstr : public InstructionWithInputs {
|
|||
|
||||
virtual intptr_t ArgumentCount() const { return 1; }
|
||||
|
||||
intptr_t cid() const { return cid_; }
|
||||
intptr_t deopt_id() const { return deopt_id_; }
|
||||
intptr_t token_pos() const { return token_pos_; }
|
||||
intptr_t try_index() const { return try_index_; }
|
||||
|
||||
|
@ -2493,7 +2491,7 @@ class ThrowInstr : public InstructionWithInputs {
|
|||
virtual bool CanDeoptimize() const { return false; }
|
||||
|
||||
private:
|
||||
const intptr_t cid_; // Computation/instruction id.
|
||||
const intptr_t deopt_id_;
|
||||
const intptr_t token_pos_;
|
||||
const intptr_t try_index_;
|
||||
|
||||
|
@ -2506,7 +2504,7 @@ class ReThrowInstr : public InstructionWithInputs {
|
|||
ReThrowInstr(intptr_t token_pos,
|
||||
intptr_t try_index)
|
||||
: InstructionWithInputs(),
|
||||
cid_(Isolate::Current()->GetNextCid()),
|
||||
deopt_id_(Isolate::Current()->GetNextDeoptId()),
|
||||
token_pos_(token_pos),
|
||||
try_index_(try_index) { }
|
||||
|
||||
|
@ -2514,7 +2512,7 @@ class ReThrowInstr : public InstructionWithInputs {
|
|||
|
||||
virtual intptr_t ArgumentCount() const { return 2; }
|
||||
|
||||
intptr_t cid() const { return cid_; }
|
||||
intptr_t deopt_id() const { return deopt_id_; }
|
||||
intptr_t token_pos() const { return token_pos_; }
|
||||
intptr_t try_index() const { return try_index_; }
|
||||
|
||||
|
@ -2525,7 +2523,7 @@ class ReThrowInstr : public InstructionWithInputs {
|
|||
virtual bool CanDeoptimize() const { return false; }
|
||||
|
||||
private:
|
||||
const intptr_t cid_; // Computation/instruction id.
|
||||
const intptr_t deopt_id_;
|
||||
const intptr_t token_pos_;
|
||||
const intptr_t try_index_;
|
||||
|
||||
|
@ -2587,7 +2585,7 @@ class BranchInstr : public InstructionWithInputs {
|
|||
Value* right,
|
||||
Token::Kind kind)
|
||||
: InstructionWithInputs(),
|
||||
cid_(Computation::kNoCid),
|
||||
deopt_id_(Isolate::kNoDeoptId),
|
||||
ic_data_(NULL),
|
||||
token_pos_(token_pos),
|
||||
try_index_(try_index),
|
||||
|
@ -2602,8 +2600,8 @@ class BranchInstr : public InstructionWithInputs {
|
|||
Token::IsRelationalOperator(kind) ||
|
||||
Token::IsTypeTestOperator(kind));
|
||||
Isolate* isolate = Isolate::Current();
|
||||
cid_ = isolate->GetNextCid();
|
||||
ic_data_ = isolate->GetICDataForCid(cid_);
|
||||
deopt_id_ = isolate->GetNextDeoptId();
|
||||
ic_data_ = isolate->GetICDataForDeoptId(deopt_id_);
|
||||
}
|
||||
|
||||
DECLARE_INSTRUCTION(Branch)
|
||||
|
@ -2620,7 +2618,7 @@ class BranchInstr : public InstructionWithInputs {
|
|||
kind_ = kind;
|
||||
}
|
||||
|
||||
intptr_t cid() const { return cid_; }
|
||||
intptr_t deopt_id() const { return deopt_id_; }
|
||||
|
||||
const ICData* ic_data() const { return ic_data_; }
|
||||
bool HasICData() const {
|
||||
|
@ -2658,7 +2656,7 @@ class BranchInstr : public InstructionWithInputs {
|
|||
virtual bool CanDeoptimize() const { return true; }
|
||||
|
||||
private:
|
||||
intptr_t cid_; // Computation/instruction id.
|
||||
intptr_t deopt_id_;
|
||||
ICData* ic_data_;
|
||||
const intptr_t token_pos_;
|
||||
const intptr_t try_index_;
|
||||
|
|
|
@ -88,7 +88,7 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ LoadObject(temp, function);
|
||||
__ pushl(result); // Preserve result.
|
||||
__ pushl(temp);
|
||||
compiler->GenerateCallRuntime(AstNode::kNoId,
|
||||
compiler->GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
0,
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kTraceFunctionExitRuntimeEntry);
|
||||
|
@ -102,7 +102,7 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
// return pattern with a call to the debug stub.
|
||||
__ nop(1);
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kReturn,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
CatchClauseNode::kInvalidTryIndex);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ j(EQUAL, &done, Assembler::kNearJump);
|
||||
|
||||
__ pushl(obj); // Push the source object.
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kConditionTypeErrorRuntimeEntry);
|
||||
|
@ -264,7 +264,7 @@ static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler,
|
|||
Register left = comp->locs()->in(0).reg();
|
||||
Register right = comp->locs()->in(1).reg();
|
||||
Register temp = comp->locs()->temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptSmiCompareSmi,
|
||||
|
@ -293,7 +293,7 @@ static void EmitDoubleEqualityCompare(FlowGraphCompiler* compiler,
|
|||
Register left = comp->locs()->in(0).reg();
|
||||
Register right = comp->locs()->in(1).reg();
|
||||
Register temp = comp->locs()->temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptDoubleCompareDouble,
|
||||
|
@ -315,7 +315,7 @@ static void EmitDoubleEqualityCompare(FlowGraphCompiler* compiler,
|
|||
static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler,
|
||||
EqualityCompareComp* comp) {
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
const String& operator_name = String::ZoneHandle(Symbols::New("=="));
|
||||
|
@ -323,7 +323,7 @@ static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler,
|
|||
const Array& kNoArgumentNames = Array::Handle();
|
||||
const int kNumArgumentsChecked = 2;
|
||||
|
||||
compiler->GenerateInstanceCall(comp->cid(),
|
||||
compiler->GenerateInstanceCall(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
operator_name,
|
||||
|
@ -349,14 +349,14 @@ static void EmitEqualityAsPolymorphicCall(FlowGraphCompiler* compiler,
|
|||
const LocationSummary& locs,
|
||||
BranchInstr* branch,
|
||||
Token::Kind kind,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
|
||||
const ICData& ic_data = ICData::Handle(orig_ic_data.AsUnaryClassChecks());
|
||||
ASSERT(ic_data.NumberOfChecks() > 0);
|
||||
ASSERT(ic_data.num_args_tested() == 1);
|
||||
Label* deopt = compiler->AddDeoptStub(cid,
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kDeoptEquality);
|
||||
|
@ -404,7 +404,7 @@ static void EmitEqualityAsPolymorphicCall(FlowGraphCompiler* compiler,
|
|||
} else {
|
||||
const int kNumberOfArguments = 2;
|
||||
const Array& kNoArgumentNames = Array::Handle();
|
||||
compiler->GenerateStaticCall(cid,
|
||||
compiler->GenerateStaticCall(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
target,
|
||||
|
@ -443,7 +443,7 @@ static void EmitGenericEqualityCompare(FlowGraphCompiler* compiler,
|
|||
Token::Kind kind,
|
||||
BranchInstr* branch,
|
||||
const ICData& ic_data,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
|
||||
|
@ -474,7 +474,7 @@ static void EmitGenericEqualityCompare(FlowGraphCompiler* compiler,
|
|||
__ pushl(left);
|
||||
__ pushl(right);
|
||||
EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind,
|
||||
cid, token_pos, try_index);
|
||||
deopt_id, token_pos, try_index);
|
||||
__ Bind(&done);
|
||||
}
|
||||
|
||||
|
@ -489,8 +489,8 @@ void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
return;
|
||||
}
|
||||
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
||||
EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL,
|
||||
*ic_data(), cid(), token_pos(), try_index());
|
||||
EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(),
|
||||
deopt_id(), token_pos(), try_index());
|
||||
} else {
|
||||
Register left = locs()->in(0).reg();
|
||||
Register right = locs()->in(1).reg();
|
||||
|
@ -522,13 +522,13 @@ static void EmitSmiComparisonOp(FlowGraphCompiler* compiler,
|
|||
const LocationSummary& locs,
|
||||
Token::Kind kind,
|
||||
BranchInstr* branch,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
Register left = locs.in(0).reg();
|
||||
Register right = locs.in(1).reg();
|
||||
Register temp = locs.temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(cid,
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kDeoptSmiCompareSmi,
|
||||
|
@ -576,14 +576,14 @@ static void EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
|
|||
const LocationSummary& locs,
|
||||
Token::Kind kind,
|
||||
BranchInstr* branch,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
Register left = locs.in(0).reg();
|
||||
Register right = locs.in(1).reg();
|
||||
// TODO(srdjan): temp is only needed if a conversion Smi->Double occurs.
|
||||
Register temp = locs.temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(cid,
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kDeoptDoubleComparison,
|
||||
|
@ -606,16 +606,16 @@ static void EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
|
|||
void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
if (operands_class_id() == kSmi) {
|
||||
EmitSmiComparisonOp(compiler, *locs(), kind(), NULL,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
if (operands_class_id() == kDouble) {
|
||||
EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
||||
Label* deopt = compiler->AddDeoptStub(cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kDeoptRelationalOp);
|
||||
|
@ -634,7 +634,7 @@ void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Array::Handle(), // No named arguments.
|
||||
deopt, // Deoptimize target.
|
||||
NULL, // Fallthrough when done.
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
return;
|
||||
|
@ -642,12 +642,12 @@ void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
const String& function_name =
|
||||
String::ZoneHandle(Symbols::New(Token::Str(kind())));
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
const intptr_t kNumArguments = 2;
|
||||
const intptr_t kNumArgsChecked = 2; // Type-feedback.
|
||||
compiler->GenerateInstanceCall(cid(),
|
||||
compiler->GenerateInstanceCall(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
function_name,
|
||||
|
@ -722,7 +722,7 @@ LocationSummary* LoadIndexedComp::MakeLocationSummary() const {
|
|||
|
||||
static void EmitLoadIndexedPolymorphic(FlowGraphCompiler* compiler,
|
||||
LoadIndexedComp* comp) {
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptLoadIndexedPolymorphic);
|
||||
|
@ -744,7 +744,7 @@ static void EmitLoadIndexedPolymorphic(FlowGraphCompiler* compiler,
|
|||
Array::Handle(), // No named arguments.
|
||||
deopt, // Deoptimize target.
|
||||
NULL, // Fallthrough when done.
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
const DeoptReasonId deopt_reason = (receiver_type() == kGrowableObjectArray) ?
|
||||
kDeoptLoadIndexedGrowableArray : kDeoptLoadIndexedFixedArray;
|
||||
|
||||
Label* deopt = compiler->AddDeoptStub(cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
deopt_reason,
|
||||
|
@ -840,13 +840,13 @@ static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler,
|
|||
String::ZoneHandle(Symbols::New(Token::Str(Token::kASSIGN_INDEX)));
|
||||
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
|
||||
const intptr_t kNumArguments = 3;
|
||||
const intptr_t kNumArgsChecked = 1; // Type-feedback.
|
||||
compiler->GenerateInstanceCall(comp->cid(),
|
||||
compiler->GenerateInstanceCall(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
function_name,
|
||||
|
@ -858,7 +858,7 @@ static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler,
|
|||
|
||||
static void EmitStoreIndexedPolymorphic(FlowGraphCompiler* compiler,
|
||||
StoreIndexedComp* comp) {
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptStoreIndexedPolymorphic);
|
||||
|
@ -880,7 +880,7 @@ static void EmitStoreIndexedPolymorphic(FlowGraphCompiler* compiler,
|
|||
Array::Handle(), // No named arguments.
|
||||
deopt, // Deoptimize target.
|
||||
NULL, // Fallthrough when done.
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register value = locs()->in(2).reg();
|
||||
Register temp = locs()->temp(0).reg();
|
||||
|
||||
Label* deopt = compiler->AddDeoptStub(cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kDeoptStoreIndexed,
|
||||
|
@ -966,7 +966,7 @@ void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
if (HasICData()) {
|
||||
ASSERT(original() != NULL);
|
||||
Label* deopt = compiler->AddDeoptStub(original()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(original()->deopt_id(),
|
||||
original()->token_pos(),
|
||||
original()->try_index(),
|
||||
kDeoptInstanceGetterSameTarget,
|
||||
|
@ -1013,7 +1013,7 @@ void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
ASSERT(locs()->in(1).reg() == ECX); // Instantiator.
|
||||
ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments.
|
||||
|
||||
compiler->GenerateInstanceOf(cid(),
|
||||
compiler->GenerateInstanceOf(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
type(),
|
||||
|
@ -1072,7 +1072,7 @@ void AllocateObjectWithBoundsCheckComp::EmitNativeCode(
|
|||
__ PushObject(cls);
|
||||
__ pushl(type_arguments);
|
||||
__ pushl(instantiator_type_arguments);
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kAllocateObjectWithBoundsCheckRuntimeEntry);
|
||||
|
@ -1095,7 +1095,7 @@ void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register result_reg = locs()->out().reg();
|
||||
if (HasICData()) {
|
||||
ASSERT(original() != NULL);
|
||||
Label* deopt = compiler->AddDeoptStub(original()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(original()->deopt_id(),
|
||||
original()->token_pos(),
|
||||
original()->try_index(),
|
||||
kDeoptInstanceGetterSameTarget,
|
||||
|
@ -1161,7 +1161,7 @@ void InstantiateTypeArgumentsComp::EmitNativeCode(
|
|||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ PushObject(type_arguments());
|
||||
__ pushl(instantiator_reg); // Push instantiator type arguments.
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kInstantiateTypeArgumentsRuntimeEntry);
|
||||
|
@ -1341,7 +1341,7 @@ void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ pushl(context_value);
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kCloneContextRuntimeEntry);
|
||||
|
@ -1392,7 +1392,7 @@ void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Address::Absolute(Isolate::Current()->stack_limit_address()));
|
||||
Label no_stack_overflow;
|
||||
__ j(ABOVE, &no_stack_overflow);
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kStackOverflowRuntimeEntry);
|
||||
|
@ -1471,7 +1471,7 @@ static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
Register result = comp->locs()->out().reg();
|
||||
Register temp = comp->locs()->temp(0).reg();
|
||||
ASSERT(left == result);
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
kDeoptSmiBinaryOp,
|
||||
|
@ -1582,7 +1582,7 @@ static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
const intptr_t kArgumentCount = 2;
|
||||
__ pushl(temp);
|
||||
__ pushl(right);
|
||||
compiler->GenerateStaticCall(comp->instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -1629,7 +1629,7 @@ static void EmitMintBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
Register temp = comp->locs()->temp(0).reg();
|
||||
ASSERT(left == result);
|
||||
ASSERT(comp->op_kind() == Token::kBIT_AND);
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
kDeoptMintBinaryOp,
|
||||
|
@ -1677,7 +1677,7 @@ static void EmitMintBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
} else {
|
||||
__ pushl(left);
|
||||
__ pushl(right);
|
||||
compiler->GenerateStaticCall(comp->instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -1697,7 +1697,7 @@ static void EmitMintBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
} else {
|
||||
__ pushl(left);
|
||||
__ pushl(right);
|
||||
compiler->GenerateStaticCall(comp->instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -1750,7 +1750,7 @@ void DoubleBinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ popl(right);
|
||||
__ popl(left);
|
||||
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptDoubleBinaryOp,
|
||||
|
@ -1796,7 +1796,7 @@ void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register value = locs()->in(0).reg();
|
||||
Register result = locs()->out().reg();
|
||||
ASSERT(value == result);
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptUnaryOp,
|
||||
|
@ -1848,7 +1848,7 @@ void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register value = locs()->in(0).reg();
|
||||
Register result = locs()->out().reg();
|
||||
ASSERT(value == result);
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptUnaryOp,
|
||||
|
@ -1906,7 +1906,7 @@ void ToDoubleComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
const DeoptReasonId deopt_reason = (from() == kDouble) ?
|
||||
kDeoptDoubleToDouble : kDeoptIntegerToDouble;
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
deopt_reason,
|
||||
|
@ -1951,7 +1951,7 @@ LocationSummary* PolymorphicInstanceCallComp::MakeLocationSummary() const {
|
|||
|
||||
|
||||
void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptPolymorphicInstanceCallTestFail);
|
||||
|
@ -1978,14 +1978,14 @@ void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
instance_call()->argument_names(),
|
||||
deopt,
|
||||
(is_smi_label == &handle_smi) ? &done : NULL,
|
||||
instance_call()->cid(),
|
||||
instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index());
|
||||
if (is_smi_label == &handle_smi) {
|
||||
__ Bind(&handle_smi);
|
||||
ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi);
|
||||
const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0));
|
||||
compiler->GenerateStaticCall(instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -2059,18 +2059,18 @@ void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
||||
if (ICDataWithBothClassIds(*ic_data(), kSmi)) {
|
||||
EmitSmiComparisonOp(compiler, *locs(), kind(), this,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
if (ICDataWithBothClassIds(*ic_data(), kDouble)) {
|
||||
EmitDoubleComparisonOp(compiler, *locs(), kind(), this,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
// TODO(srdjan): Add Smi/Double, Double/Smi comparisons.
|
||||
if ((kind() == Token::kEQ) || (kind() == Token::kNE)) {
|
||||
EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(),
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
// Otherwise polymorphic dispatch?
|
||||
|
@ -2081,12 +2081,12 @@ void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
const String& function_name =
|
||||
String::ZoneHandle(Symbols::New(Token::Str(call_kind)));
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
const intptr_t kNumArguments = 2;
|
||||
const intptr_t kNumArgsChecked = 2; // Type-feedback.
|
||||
compiler->GenerateInstanceCall(cid(),
|
||||
compiler->GenerateInstanceCall(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
function_name,
|
||||
|
|
|
@ -88,7 +88,7 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ LoadObject(temp, function);
|
||||
__ pushq(result); // Preserve result.
|
||||
__ pushq(temp);
|
||||
compiler->GenerateCallRuntime(AstNode::kNoId,
|
||||
compiler->GenerateCallRuntime(Isolate::kNoDeoptId,
|
||||
0,
|
||||
CatchClauseNode::kInvalidTryIndex,
|
||||
kTraceFunctionExitRuntimeEntry);
|
||||
|
@ -110,7 +110,7 @@ void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ nop(1);
|
||||
__ nop(1);
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kReturn,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
CatchClauseNode::kInvalidTryIndex);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ j(EQUAL, &done, Assembler::kNearJump);
|
||||
|
||||
__ pushq(obj); // Push the source object.
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kConditionTypeErrorRuntimeEntry);
|
||||
|
@ -275,7 +275,7 @@ static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler,
|
|||
Register left = comp->locs()->in(0).reg();
|
||||
Register right = comp->locs()->in(1).reg();
|
||||
Register temp = comp->locs()->temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptSmiCompareSmi,
|
||||
|
@ -303,7 +303,7 @@ static void EmitDoubleEqualityCompare(FlowGraphCompiler* compiler,
|
|||
EqualityCompareComp* comp) {
|
||||
Register left = comp->locs()->in(0).reg();
|
||||
Register right = comp->locs()->in(1).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptDoubleCompareDouble,
|
||||
|
@ -324,7 +324,7 @@ static void EmitDoubleEqualityCompare(FlowGraphCompiler* compiler,
|
|||
static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler,
|
||||
EqualityCompareComp* comp) {
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
const String& operator_name = String::ZoneHandle(Symbols::New("=="));
|
||||
|
@ -332,7 +332,7 @@ static void EmitEqualityAsInstanceCall(FlowGraphCompiler* compiler,
|
|||
const Array& kNoArgumentNames = Array::Handle();
|
||||
const int kNumArgumentsChecked = 2;
|
||||
|
||||
compiler->GenerateInstanceCall(comp->cid(),
|
||||
compiler->GenerateInstanceCall(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
operator_name,
|
||||
|
@ -358,14 +358,14 @@ static void EmitEqualityAsPolymorphicCall(FlowGraphCompiler* compiler,
|
|||
const LocationSummary& locs,
|
||||
BranchInstr* branch,
|
||||
Token::Kind kind,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
|
||||
const ICData& ic_data = ICData::Handle(orig_ic_data.AsUnaryClassChecks());
|
||||
ASSERT(ic_data.NumberOfChecks() > 0);
|
||||
ASSERT(ic_data.num_args_tested() == 1);
|
||||
Label* deopt = compiler->AddDeoptStub(cid,
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kDeoptEquality);
|
||||
|
@ -413,7 +413,7 @@ static void EmitEqualityAsPolymorphicCall(FlowGraphCompiler* compiler,
|
|||
} else {
|
||||
const int kNumberOfArguments = 2;
|
||||
const Array& kNoArgumentNames = Array::Handle();
|
||||
compiler->GenerateStaticCall(cid,
|
||||
compiler->GenerateStaticCall(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
target,
|
||||
|
@ -452,7 +452,7 @@ static void EmitGenericEqualityCompare(FlowGraphCompiler* compiler,
|
|||
Token::Kind kind,
|
||||
BranchInstr* branch,
|
||||
const ICData& ic_data,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
|
||||
|
@ -483,7 +483,7 @@ static void EmitGenericEqualityCompare(FlowGraphCompiler* compiler,
|
|||
__ pushq(left);
|
||||
__ pushq(right);
|
||||
EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind,
|
||||
cid, token_pos, try_index);
|
||||
deopt_id, token_pos, try_index);
|
||||
__ Bind(&done);
|
||||
}
|
||||
|
||||
|
@ -498,8 +498,8 @@ void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
return;
|
||||
}
|
||||
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
||||
EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL,
|
||||
*ic_data(), cid(), token_pos(), try_index());
|
||||
EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(),
|
||||
deopt_id(), token_pos(), try_index());
|
||||
} else {
|
||||
Register left = locs()->in(0).reg();
|
||||
Register right = locs()->in(1).reg();
|
||||
|
@ -531,13 +531,13 @@ static void EmitSmiComparisonOp(FlowGraphCompiler* compiler,
|
|||
const LocationSummary& locs,
|
||||
Token::Kind kind,
|
||||
BranchInstr* branch,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
Register left = locs.in(0).reg();
|
||||
Register right = locs.in(1).reg();
|
||||
Register temp = locs.temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(cid,
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kDeoptSmiCompareSmi,
|
||||
|
@ -585,14 +585,14 @@ static void EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
|
|||
const LocationSummary& locs,
|
||||
Token::Kind kind,
|
||||
BranchInstr* branch,
|
||||
intptr_t cid,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) {
|
||||
Register left = locs.in(0).reg();
|
||||
Register right = locs.in(1).reg();
|
||||
// TODO(srdjan): temp is only needed if a conversion Smi->Double occurs.
|
||||
Register temp = locs.temp(0).reg();
|
||||
Label* deopt = compiler->AddDeoptStub(cid,
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id,
|
||||
token_pos,
|
||||
try_index,
|
||||
kDeoptDoubleComparison,
|
||||
|
@ -615,16 +615,16 @@ static void EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
|
|||
void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
if (operands_class_id() == kSmi) {
|
||||
EmitSmiComparisonOp(compiler, *locs(), kind(), NULL,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
if (operands_class_id() == kDouble) {
|
||||
EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
||||
Label* deopt = compiler->AddDeoptStub(cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kDeoptRelationalOp);
|
||||
|
@ -643,7 +643,7 @@ void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Array::Handle(), // No named arguments.
|
||||
deopt, // Deoptimize target.
|
||||
NULL, // Fallthrough when done.
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
return;
|
||||
|
@ -651,12 +651,12 @@ void RelationalOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
const String& function_name =
|
||||
String::ZoneHandle(Symbols::New(Token::Str(kind())));
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
const intptr_t kNumArguments = 2;
|
||||
const intptr_t kNumArgsChecked = 2; // Type-feedback.
|
||||
compiler->GenerateInstanceCall(cid(),
|
||||
compiler->GenerateInstanceCall(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
function_name,
|
||||
|
@ -734,7 +734,7 @@ LocationSummary* LoadIndexedComp::MakeLocationSummary() const {
|
|||
|
||||
static void EmitLoadIndexedPolymorphic(FlowGraphCompiler* compiler,
|
||||
LoadIndexedComp* comp) {
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptLoadIndexedPolymorphic);
|
||||
|
@ -756,7 +756,7 @@ static void EmitLoadIndexedPolymorphic(FlowGraphCompiler* compiler,
|
|||
Array::Handle(), // No named arguments.
|
||||
deopt, // Deoptimize target.
|
||||
NULL, // Fallthrough when done.
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
const DeoptReasonId deopt_reason = (receiver_type() == kGrowableObjectArray) ?
|
||||
kDeoptLoadIndexedGrowableArray : kDeoptLoadIndexedFixedArray;
|
||||
|
||||
Label* deopt = compiler->AddDeoptStub(cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
deopt_reason,
|
||||
|
@ -854,13 +854,13 @@ static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler,
|
|||
String::ZoneHandle(Symbols::New(Token::Str(Token::kASSIGN_INDEX)));
|
||||
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
|
||||
const intptr_t kNumArguments = 3;
|
||||
const intptr_t kNumArgsChecked = 1; // Type-feedback.
|
||||
compiler->GenerateInstanceCall(comp->cid(),
|
||||
compiler->GenerateInstanceCall(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
function_name,
|
||||
|
@ -872,7 +872,7 @@ static void EmitStoreIndexedGeneric(FlowGraphCompiler* compiler,
|
|||
|
||||
static void EmitStoreIndexedPolymorphic(FlowGraphCompiler* compiler,
|
||||
StoreIndexedComp* comp) {
|
||||
Label* deopt = compiler->AddDeoptStub(comp->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index(),
|
||||
kDeoptStoreIndexedPolymorphic);
|
||||
|
@ -894,7 +894,7 @@ static void EmitStoreIndexedPolymorphic(FlowGraphCompiler* compiler,
|
|||
Array::Handle(), // No named arguments.
|
||||
deopt, // deoptimize label.
|
||||
NULL, // fallthrough when done.
|
||||
comp->cid(),
|
||||
comp->deopt_id(),
|
||||
comp->token_pos(),
|
||||
comp->try_index());
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register index = locs()->in(1).reg();
|
||||
Register value = locs()->in(2).reg();
|
||||
|
||||
Label* deopt = compiler->AddDeoptStub(cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kDeoptStoreIndexed,
|
||||
|
@ -980,7 +980,7 @@ void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
if (HasICData()) {
|
||||
ASSERT(original() != NULL);
|
||||
Label* deopt = compiler->AddDeoptStub(original()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(original()->deopt_id(),
|
||||
original()->token_pos(),
|
||||
original()->try_index(),
|
||||
kDeoptInstanceGetterSameTarget,
|
||||
|
@ -1027,7 +1027,7 @@ void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
ASSERT(locs()->in(1).reg() == RCX); // Instantiator.
|
||||
ASSERT(locs()->in(2).reg() == RDX); // Instantiator type arguments.
|
||||
|
||||
compiler->GenerateInstanceOf(cid(),
|
||||
compiler->GenerateInstanceOf(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
type(),
|
||||
|
@ -1086,7 +1086,7 @@ void AllocateObjectWithBoundsCheckComp::EmitNativeCode(
|
|||
__ PushObject(cls);
|
||||
__ pushq(type_arguments);
|
||||
__ pushq(instantiator_type_arguments);
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kAllocateObjectWithBoundsCheckRuntimeEntry);
|
||||
|
@ -1108,7 +1108,7 @@ void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register result_reg = locs()->out().reg();
|
||||
if (HasICData()) {
|
||||
ASSERT(original() != NULL);
|
||||
Label* deopt = compiler->AddDeoptStub(original()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(original()->deopt_id(),
|
||||
original()->token_pos(),
|
||||
original()->try_index(),
|
||||
kDeoptInstanceGetterSameTarget,
|
||||
|
@ -1172,7 +1172,7 @@ void InstantiateTypeArgumentsComp::EmitNativeCode(
|
|||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ PushObject(type_arguments());
|
||||
__ pushq(instantiator_reg); // Push instantiator type arguments.
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kInstantiateTypeArgumentsRuntimeEntry);
|
||||
|
@ -1348,7 +1348,7 @@ void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
__ PushObject(Object::ZoneHandle()); // Make room for the result.
|
||||
__ pushq(context_value);
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kCloneContextRuntimeEntry);
|
||||
|
@ -1404,7 +1404,7 @@ void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ cmpq(RSP, Address(temp, 0));
|
||||
Label no_stack_overflow;
|
||||
__ j(ABOVE, &no_stack_overflow, Assembler::kNearJump);
|
||||
compiler->GenerateCallRuntime(cid(),
|
||||
compiler->GenerateCallRuntime(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
kStackOverflowRuntimeEntry);
|
||||
|
@ -1482,7 +1482,7 @@ static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
Register result = comp->locs()->out().reg();
|
||||
Register temp = comp->locs()->temp(0).reg();
|
||||
ASSERT(left == result);
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
kDeoptSmiBinaryOp,
|
||||
|
@ -1593,7 +1593,7 @@ static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
const intptr_t kArgumentCount = 2;
|
||||
__ pushq(temp);
|
||||
__ pushq(right);
|
||||
compiler->GenerateStaticCall(comp->instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -1639,7 +1639,7 @@ static void EmitMintBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
Register result = comp->locs()->out().reg();
|
||||
ASSERT(left == result);
|
||||
ASSERT(comp->op_kind() == Token::kBIT_AND);
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
kDeoptMintBinaryOp,
|
||||
|
@ -1687,7 +1687,7 @@ static void EmitMintBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
} else {
|
||||
__ pushq(left);
|
||||
__ pushq(right);
|
||||
compiler->GenerateStaticCall(comp->instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -1707,7 +1707,7 @@ static void EmitMintBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
|
|||
} else {
|
||||
__ pushq(left);
|
||||
__ pushq(right);
|
||||
compiler->GenerateStaticCall(comp->instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(comp->instance_call()->deopt_id(),
|
||||
comp->instance_call()->token_pos(),
|
||||
comp->instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -1760,7 +1760,7 @@ void DoubleBinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
__ popq(right);
|
||||
__ popq(left);
|
||||
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptDoubleBinaryOp,
|
||||
|
@ -1806,7 +1806,7 @@ void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register value = locs()->in(0).reg();
|
||||
Register result = locs()->out().reg();
|
||||
ASSERT(value == result);
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptUnaryOp,
|
||||
|
@ -1858,7 +1858,7 @@ void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
Register value = locs()->in(0).reg();
|
||||
Register result = locs()->out().reg();
|
||||
ASSERT(value == result);
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptUnaryOp,
|
||||
|
@ -1914,7 +1914,7 @@ void ToDoubleComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
|
||||
const DeoptReasonId deopt_reason = (from() == kDouble) ?
|
||||
kDeoptDoubleToDouble : kDeoptIntegerToDouble;
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
deopt_reason,
|
||||
|
@ -1958,7 +1958,7 @@ LocationSummary* PolymorphicInstanceCallComp::MakeLocationSummary() const {
|
|||
|
||||
|
||||
void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
|
||||
Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
kDeoptPolymorphicInstanceCallTestFail);
|
||||
|
@ -1985,14 +1985,14 @@ void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
instance_call()->argument_names(),
|
||||
deopt,
|
||||
(is_smi_label == &handle_smi) ? &done : NULL,
|
||||
instance_call()->cid(),
|
||||
instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index());
|
||||
if (is_smi_label == &handle_smi) {
|
||||
__ Bind(&handle_smi);
|
||||
ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi);
|
||||
const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0));
|
||||
compiler->GenerateStaticCall(instance_call()->cid(),
|
||||
compiler->GenerateStaticCall(instance_call()->deopt_id(),
|
||||
instance_call()->token_pos(),
|
||||
instance_call()->try_index(),
|
||||
target,
|
||||
|
@ -2066,18 +2066,18 @@ void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
|
||||
if (ICDataWithBothClassIds(*ic_data(), kSmi)) {
|
||||
EmitSmiComparisonOp(compiler, *locs(), kind(), this,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
if (ICDataWithBothClassIds(*ic_data(), kDouble)) {
|
||||
EmitDoubleComparisonOp(compiler, *locs(), kind(), this,
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
// TODO(srdjan): Add Smi/Double, Double/Smi comparisons.
|
||||
if ((kind() == Token::kEQ) || (kind() == Token::kNE)) {
|
||||
EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(),
|
||||
cid(), token_pos(), try_index());
|
||||
deopt_id(), token_pos(), try_index());
|
||||
return;
|
||||
}
|
||||
// Otherwise polymorphic dispatch?
|
||||
|
@ -2088,12 +2088,12 @@ void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
|||
const String& function_name =
|
||||
String::ZoneHandle(Symbols::New(Token::Str(call_kind)));
|
||||
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
|
||||
cid(),
|
||||
deopt_id(),
|
||||
token_pos(),
|
||||
try_index());
|
||||
const intptr_t kNumArguments = 2;
|
||||
const intptr_t kNumArgsChecked = 2; // Type-feedback.
|
||||
compiler->GenerateInstanceCall(cid(),
|
||||
compiler->GenerateInstanceCall(deopt_id(),
|
||||
token_pos(),
|
||||
try_index(),
|
||||
function_name,
|
||||
|
|
|
@ -157,8 +157,7 @@ Isolate::Isolate()
|
|||
debugger_(NULL),
|
||||
long_jump_base_(NULL),
|
||||
timer_list_(),
|
||||
ast_node_id_(AstNode::kNoId),
|
||||
computation_id_(AstNode::kNoId),
|
||||
deopt_id_(0),
|
||||
ic_data_array_(Array::null()),
|
||||
mutex_(new Mutex()),
|
||||
stack_limit_(0),
|
||||
|
@ -305,17 +304,17 @@ uword Isolate::GetAndClearInterrupts() {
|
|||
}
|
||||
|
||||
|
||||
ICData* Isolate::GetICDataForCid(intptr_t cid) const {
|
||||
ICData* Isolate::GetICDataForDeoptId(intptr_t deopt_id) const {
|
||||
if (ic_data_array() == Array::null()) {
|
||||
return NULL;
|
||||
}
|
||||
const Array& array_handle = Array::Handle(ic_data_array());
|
||||
if (cid >= array_handle.Length()) {
|
||||
if (deopt_id >= array_handle.Length()) {
|
||||
// For computations being added in the optimizing compiler.
|
||||
return NULL;
|
||||
}
|
||||
ICData& ic_data_handle = ICData::ZoneHandle();
|
||||
ic_data_handle ^= array_handle.At(cid);
|
||||
ic_data_handle ^= array_handle.At(deopt_id);
|
||||
return &ic_data_handle;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,17 +174,20 @@ class Isolate : public BaseIsolate {
|
|||
uword spawn_data() const { return spawn_data_; }
|
||||
void set_spawn_data(uword value) { spawn_data_ = value; }
|
||||
|
||||
// Deprecate.
|
||||
intptr_t ast_node_id() const { return ast_node_id_; }
|
||||
void set_ast_node_id(int value) { ast_node_id_ = value; }
|
||||
|
||||
intptr_t computation_id() const { return computation_id_; }
|
||||
void set_computation_id(int value) { computation_id_ = value; }
|
||||
intptr_t GetNextCid() { return computation_id_++; }
|
||||
static const intptr_t kNoDeoptId = -1;
|
||||
intptr_t deopt_id() const { return deopt_id_; }
|
||||
void set_deopt_id(int value) {
|
||||
ASSERT(value >= 0);
|
||||
deopt_id_ = value;
|
||||
}
|
||||
intptr_t GetNextDeoptId() {
|
||||
ASSERT(deopt_id_ != kNoDeoptId);
|
||||
return deopt_id_++;
|
||||
}
|
||||
|
||||
RawArray* ic_data_array() const { return ic_data_array_; }
|
||||
void set_ic_data_array(RawArray* value) { ic_data_array_ = value; }
|
||||
ICData* GetICDataForCid(intptr_t cid) const;
|
||||
ICData* GetICDataForDeoptId(intptr_t deopt_id) const;
|
||||
|
||||
Debugger* debugger() const { return debugger_; }
|
||||
|
||||
|
@ -258,8 +261,7 @@ class Isolate : public BaseIsolate {
|
|||
Debugger* debugger_;
|
||||
LongJump* long_jump_base_;
|
||||
TimerList timer_list_;
|
||||
intptr_t ast_node_id_; // Deprecate.
|
||||
intptr_t computation_id_;
|
||||
intptr_t deopt_id_;
|
||||
RawArray* ic_data_array_;
|
||||
Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_.
|
||||
uword stack_limit_;
|
||||
|
|
|
@ -6539,23 +6539,23 @@ void PcDescriptors::SetKind(intptr_t index, PcDescriptors::Kind value) const {
|
|||
}
|
||||
|
||||
|
||||
intptr_t PcDescriptors::NodeId(intptr_t index) const {
|
||||
return Smi::Value(*SmiAddr(index, kNodeIdEntry));
|
||||
intptr_t PcDescriptors::DeoptId(intptr_t index) const {
|
||||
return Smi::Value(*SmiAddr(index, kDeoptIdEntry));
|
||||
}
|
||||
|
||||
|
||||
void PcDescriptors::SetNodeId(intptr_t index, intptr_t value) const {
|
||||
*SmiAddr(index, kNodeIdEntry) = Smi::New(value);
|
||||
void PcDescriptors::SetDeoptId(intptr_t index, intptr_t value) const {
|
||||
*SmiAddr(index, kDeoptIdEntry) = Smi::New(value);
|
||||
}
|
||||
|
||||
|
||||
intptr_t PcDescriptors::TokenIndex(intptr_t index) const {
|
||||
return Smi::Value(*SmiAddr(index, kTokenIndexEntry));
|
||||
intptr_t PcDescriptors::TokenPos(intptr_t index) const {
|
||||
return Smi::Value(*SmiAddr(index, kTokenPosEntry));
|
||||
}
|
||||
|
||||
|
||||
void PcDescriptors::SetTokenIndex(intptr_t index, intptr_t value) const {
|
||||
*SmiAddr(index, kTokenIndexEntry) = Smi::New(value);
|
||||
void PcDescriptors::SetTokenPos(intptr_t index, intptr_t value) const {
|
||||
*SmiAddr(index, kTokenPosEntry) = Smi::New(value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6624,7 +6624,7 @@ const char* PcDescriptors::ToCString() const {
|
|||
const intptr_t multi_purpose_index = DescriptorKind(i) == kDeoptIndex ?
|
||||
DeoptIndex(i) : TryIndex(i);
|
||||
len += OS::SNPrint(NULL, 0, kFormat,
|
||||
PC(i), KindAsStr(i), NodeId(i), TokenIndex(i), multi_purpose_index);
|
||||
PC(i), KindAsStr(i), DeoptId(i), TokenPos(i), multi_purpose_index);
|
||||
}
|
||||
// Allocate the buffer.
|
||||
char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len);
|
||||
|
@ -6634,15 +6634,15 @@ const char* PcDescriptors::ToCString() const {
|
|||
const intptr_t multi_purpose_index = DescriptorKind(i) == kDeoptIndex ?
|
||||
DeoptIndex(i) : TryIndex(i);
|
||||
index += OS::SNPrint((buffer + index), (len - index), kFormat,
|
||||
PC(i), KindAsStr(i), NodeId(i), TokenIndex(i), multi_purpose_index);
|
||||
PC(i), KindAsStr(i), DeoptId(i), TokenPos(i), multi_purpose_index);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
// Verify assumptions (in debug mode only).
|
||||
// - No two deopt descriptors have the same node id (deoptimization).
|
||||
// - No two ic-call descriptors have the same node id (type feedback).
|
||||
// - No two deopt descriptors have the same deoptimization id.
|
||||
// - No two ic-call descriptors have the same deoptimization id (type feedback).
|
||||
// - No two descriptors of same kind have the same PC.
|
||||
// A function without unique ids is marked as non-optimizable (e.g., because of
|
||||
// finally blocks).
|
||||
|
@ -6659,18 +6659,18 @@ void PcDescriptors::Verify(bool check_ids) const {
|
|||
for (intptr_t i = 0; i < Length(); i++) {
|
||||
uword pc = PC(i);
|
||||
PcDescriptors::Kind kind = DescriptorKind(i);
|
||||
// 'node_id' is set for kDeopt and kIcCall and must be unique for one kind.
|
||||
intptr_t node_id = AstNode::kNoId;
|
||||
// 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind.
|
||||
intptr_t deopt_id = Isolate::kNoDeoptId;
|
||||
if (check_ids) {
|
||||
if ((DescriptorKind(i) == PcDescriptors::kDeopt) ||
|
||||
(DescriptorKind(i) == PcDescriptors::kIcCall)) {
|
||||
node_id = NodeId(i);
|
||||
deopt_id = DeoptId(i);
|
||||
}
|
||||
}
|
||||
for (intptr_t k = i + 1; k < Length(); k++) {
|
||||
if (kind == DescriptorKind(k)) {
|
||||
if (node_id != AstNode::kNoId) {
|
||||
ASSERT(NodeId(k) != node_id);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
ASSERT(DeoptId(k) != deopt_id);
|
||||
}
|
||||
ASSERT(pc != PC(k));
|
||||
}
|
||||
|
@ -7197,7 +7197,7 @@ intptr_t Code::GetTokenIndexOfPC(uword pc) const {
|
|||
const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
|
||||
for (intptr_t i = 0; i < descriptors.Length(); i++) {
|
||||
if (descriptors.PC(i) == pc) {
|
||||
token_pos = descriptors.TokenIndex(i);
|
||||
token_pos = descriptors.TokenPos(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7205,10 +7205,10 @@ intptr_t Code::GetTokenIndexOfPC(uword pc) const {
|
|||
}
|
||||
|
||||
|
||||
uword Code::GetDeoptPcAtNodeId(intptr_t node_id) const {
|
||||
uword Code::GetDeoptPcAtDeoptId(intptr_t deopt_id) const {
|
||||
const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
|
||||
for (intptr_t i = 0; i < descriptors.Length(); i++) {
|
||||
if ((descriptors.NodeId(i) == node_id) &&
|
||||
if ((descriptors.DeoptId(i) == deopt_id) &&
|
||||
(descriptors.DescriptorKind(i) == PcDescriptors::kDeopt)) {
|
||||
return descriptors.PC(i);
|
||||
}
|
||||
|
@ -7260,11 +7260,11 @@ intptr_t Code::ExtractIcDataArraysAtCalls(
|
|||
intptr_t max_id = -1;
|
||||
for (intptr_t i = 0; i < descriptors.Length(); i++) {
|
||||
if (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) {
|
||||
intptr_t node_id = descriptors.NodeId(i);
|
||||
if (node_id > max_id) {
|
||||
max_id = node_id;
|
||||
intptr_t deopt_id = descriptors.DeoptId(i);
|
||||
if (deopt_id > max_id) {
|
||||
max_id = deopt_id;
|
||||
}
|
||||
node_ids->Add(node_id);
|
||||
node_ids->Add(deopt_id);
|
||||
ic_data_obj = CodePatcher::GetInstanceCallIcDataAt(descriptors.PC(i));
|
||||
ic_data_objs.Add(ic_data_obj);
|
||||
}
|
||||
|
@ -7437,8 +7437,8 @@ void ICData::set_target_name(const String& value) const {
|
|||
}
|
||||
|
||||
|
||||
void ICData::set_id(intptr_t value) const {
|
||||
raw_ptr()->id_ = value;
|
||||
void ICData::set_deopt_id(intptr_t value) const {
|
||||
raw_ptr()->deopt_id_ = value;
|
||||
}
|
||||
|
||||
|
||||
|
@ -7590,7 +7590,7 @@ RawICData* ICData::AsUnaryClassChecks() const {
|
|||
ICData& result = ICData::Handle(ICData::New(
|
||||
Function::Handle(function()),
|
||||
String::Handle(target_name()),
|
||||
id(),
|
||||
deopt_id(),
|
||||
kNumArgsTested));
|
||||
for (intptr_t i = 0; i < NumberOfChecks(); i++) {
|
||||
const intptr_t class_id = GetReceiverClassIdAt(i);
|
||||
|
@ -7615,7 +7615,7 @@ RawICData* ICData::AsUnaryClassChecks() const {
|
|||
|
||||
RawICData* ICData::New(const Function& function,
|
||||
const String& target_name,
|
||||
intptr_t id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t num_args_tested) {
|
||||
ASSERT(Object::icdata_class() != Class::null());
|
||||
ASSERT(num_args_tested > 0);
|
||||
|
@ -7630,7 +7630,7 @@ RawICData* ICData::New(const Function& function,
|
|||
}
|
||||
result.set_function(function);
|
||||
result.set_target_name(target_name);
|
||||
result.set_id(id);
|
||||
result.set_deopt_id(deopt_id);
|
||||
result.set_num_args_tested(num_args_tested);
|
||||
// Number of array elements in one test entry (num_args_tested + 1)
|
||||
intptr_t len = result.TestEntryLength();
|
||||
|
|
|
@ -2202,8 +2202,8 @@ class PcDescriptors : public Object {
|
|||
enum {
|
||||
kPcEntry = 0, // PC value of the descriptor, unique.
|
||||
kKindEntry,
|
||||
kNodeIdEntry, // AST node id.
|
||||
kTokenIndexEntry, // Token position in source of PC.
|
||||
kDeoptIdEntry, // Deopt id.
|
||||
kTokenPosEntry, // Token position in source of PC.
|
||||
kTryIndexEntry, // Try block index of PC.
|
||||
// We would potentially be adding other objects here like
|
||||
// pointer maps for optimized functions, local variables information etc.
|
||||
|
@ -2212,7 +2212,7 @@ class PcDescriptors : public Object {
|
|||
|
||||
public:
|
||||
enum Kind {
|
||||
kDeopt = 0, // Deoptimization cotinuation point.
|
||||
kDeopt = 0, // Deoptimization continuation point.
|
||||
kDeoptIndex, // Index into deopt info array.
|
||||
kPatchCode, // Buffer for patching code entry.
|
||||
kIcCall, // IC call.
|
||||
|
@ -2226,8 +2226,8 @@ class PcDescriptors : public Object {
|
|||
uword PC(intptr_t index) const;
|
||||
PcDescriptors::Kind DescriptorKind(intptr_t index) const;
|
||||
const char* KindAsStr(intptr_t index) const;
|
||||
intptr_t NodeId(intptr_t index) const;
|
||||
intptr_t TokenIndex(intptr_t index) const;
|
||||
intptr_t DeoptId(intptr_t index) const;
|
||||
intptr_t TokenPos(intptr_t index) const;
|
||||
intptr_t TryIndex(intptr_t index) const;
|
||||
// Index into the deopt-info array of Code object.
|
||||
intptr_t DeoptIndex(intptr_t index) const;
|
||||
|
@ -2235,13 +2235,13 @@ class PcDescriptors : public Object {
|
|||
void AddDescriptor(intptr_t index,
|
||||
uword pc,
|
||||
PcDescriptors::Kind kind,
|
||||
intptr_t node_id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t try_index) const {
|
||||
SetPC(index, pc);
|
||||
SetKind(index, kind);
|
||||
SetNodeId(index, node_id);
|
||||
SetTokenIndex(index, token_pos);
|
||||
SetDeoptId(index, deopt_id);
|
||||
SetTokenPos(index, token_pos);
|
||||
SetTryIndex(index, try_index);
|
||||
}
|
||||
|
||||
|
@ -2269,8 +2269,8 @@ class PcDescriptors : public Object {
|
|||
private:
|
||||
void SetPC(intptr_t index, uword value) const;
|
||||
void SetKind(intptr_t index, PcDescriptors::Kind kind) const;
|
||||
void SetNodeId(intptr_t index, intptr_t value) const;
|
||||
void SetTokenIndex(intptr_t index, intptr_t value) const;
|
||||
void SetDeoptId(intptr_t index, intptr_t value) const;
|
||||
void SetTokenPos(intptr_t index, intptr_t value) const;
|
||||
void SetTryIndex(intptr_t index, intptr_t value) const;
|
||||
|
||||
void SetLength(intptr_t value) const;
|
||||
|
@ -2590,8 +2590,7 @@ class Code : public Object {
|
|||
// Find pc of patch code buffer. Return 0 if not found.
|
||||
uword GetPatchCodePc() const;
|
||||
|
||||
uword GetDeoptPcAtNodeId(intptr_t node_id) const;
|
||||
uword GetTypeTestAtNodeId(intptr_t node_id) const;
|
||||
uword GetDeoptPcAtDeoptId(intptr_t deopt_id) const;
|
||||
|
||||
// Returns true if there is an object in the code between 'start_offset'
|
||||
// (inclusive) and 'end_offset' (exclusive).
|
||||
|
@ -2793,8 +2792,8 @@ class ICData : public Object {
|
|||
return raw_ptr()->num_args_tested_;
|
||||
}
|
||||
|
||||
intptr_t id() const {
|
||||
return raw_ptr()->id_;
|
||||
intptr_t deopt_id() const {
|
||||
return raw_ptr()->deopt_id_;
|
||||
}
|
||||
|
||||
intptr_t NumberOfChecks() const;
|
||||
|
@ -2843,7 +2842,7 @@ class ICData : public Object {
|
|||
|
||||
static RawICData* New(const Function& caller_function,
|
||||
const String& target_name,
|
||||
intptr_t id,
|
||||
intptr_t deopt_id,
|
||||
intptr_t num_args_tested);
|
||||
|
||||
private:
|
||||
|
@ -2853,7 +2852,7 @@ class ICData : public Object {
|
|||
|
||||
void set_function(const Function& value) const;
|
||||
void set_target_name(const String& value) const;
|
||||
void set_id(intptr_t value) const;
|
||||
void set_deopt_id(intptr_t value) const;
|
||||
void set_num_args_tested(intptr_t value) const;
|
||||
void set_ic_data(const Array& value) const;
|
||||
|
||||
|
|
|
@ -2536,11 +2536,11 @@ TEST_CASE(PcDescriptors) {
|
|||
EXPECT_EQ(kNumEntries, pc_descs.Length());
|
||||
EXPECT_EQ(1, pc_descs.TryIndex(0));
|
||||
EXPECT_EQ(static_cast<uword>(10), pc_descs.PC(0));
|
||||
EXPECT_EQ(1, pc_descs.NodeId(0));
|
||||
EXPECT_EQ(20, pc_descs.TokenIndex(0));
|
||||
EXPECT_EQ(1, pc_descs.DeoptId(0));
|
||||
EXPECT_EQ(20, pc_descs.TokenPos(0));
|
||||
EXPECT_EQ(3, pc_descs.TryIndex(5));
|
||||
EXPECT_EQ(static_cast<uword>(80), pc_descs.PC(5));
|
||||
EXPECT_EQ(150, pc_descs.TokenIndex(5));
|
||||
EXPECT_EQ(150, pc_descs.TokenPos(5));
|
||||
EXPECT_EQ(PcDescriptors::kOther, pc_descs.DescriptorKind(0));
|
||||
EXPECT_EQ(PcDescriptors::kDeopt, pc_descs.DescriptorKind(1));
|
||||
}
|
||||
|
@ -2613,7 +2613,7 @@ TEST_CASE(ICData) {
|
|||
ICData& o1 = ICData::Handle();
|
||||
o1 = ICData::New(function, target_name, id, num_args_tested);
|
||||
EXPECT_EQ(1, o1.num_args_tested());
|
||||
EXPECT_EQ(id, o1.id());
|
||||
EXPECT_EQ(id, o1.deopt_id());
|
||||
EXPECT_EQ(function.raw(), o1.function());
|
||||
EXPECT_EQ(0, o1.NumberOfChecks());
|
||||
EXPECT_EQ(target_name.raw(), o1.target_name());
|
||||
|
@ -2642,7 +2642,7 @@ TEST_CASE(ICData) {
|
|||
ICData& o2 = ICData::Handle();
|
||||
o2 = ICData::New(function, target_name, 57, 2);
|
||||
EXPECT_EQ(2, o2.num_args_tested());
|
||||
EXPECT_EQ(57, o2.id());
|
||||
EXPECT_EQ(57, o2.deopt_id());
|
||||
EXPECT_EQ(function.raw(), o2.function());
|
||||
EXPECT_EQ(0, o2.NumberOfChecks());
|
||||
GrowableArray<intptr_t> classes;
|
||||
|
|
|
@ -113,17 +113,6 @@ void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) {
|
|||
ASSERT(node_sequence_ == NULL);
|
||||
ASSERT(node_sequence != NULL);
|
||||
node_sequence_ = node_sequence;
|
||||
const int num_fixed_params = function().num_fixed_parameters();
|
||||
const int num_opt_params = function().num_optional_parameters();
|
||||
// Allocated ids for parameters.
|
||||
intptr_t parameter_id = AstNode::kNoId;
|
||||
for (intptr_t i = 0; i < num_fixed_params + num_opt_params; i++) {
|
||||
parameter_id = AstNode::GetNextId();
|
||||
if (i == 0) {
|
||||
node_sequence_->set_first_parameter_id(parameter_id);
|
||||
}
|
||||
}
|
||||
node_sequence_->set_last_parameter_id(parameter_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -662,9 +651,6 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
|||
TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
|
||||
Isolate* isolate = Isolate::Current();
|
||||
ASSERT(isolate->long_jump_base()->IsSafeToJump());
|
||||
// Compilation can be nested, preserve the ast node id.
|
||||
const intptr_t prev_ast_node_id = isolate->ast_node_id();
|
||||
isolate->set_ast_node_id(0);
|
||||
ASSERT(parsed_function != NULL);
|
||||
const Function& func = parsed_function->function();
|
||||
const Class& cls = Class::Handle(isolate, func.owner());
|
||||
|
@ -728,7 +714,6 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
|||
}
|
||||
|
||||
parsed_function->set_default_parameter_values(default_parameter_values);
|
||||
isolate->set_ast_node_id(prev_ast_node_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1340,7 +1325,7 @@ AstNode* Parser::ParseSuperOperator() {
|
|||
// literal, evaluate and save in a temporary local.
|
||||
if (!IsSimpleLocalOrLiteralNode(index_expr)) {
|
||||
LocalVariable* temp =
|
||||
CreateTempConstVariable(operator_pos, index_expr->id(), "lix");
|
||||
CreateTempConstVariable(operator_pos, "lix");
|
||||
AstNode* save =
|
||||
new StoreLocalNode(operator_pos, *temp, index_expr);
|
||||
current_block_->statements->Add(save);
|
||||
|
@ -2037,7 +2022,7 @@ SequenceNode* Parser::ParseConstructor(const Function& func,
|
|||
AstNode* arg = ctor_args->NodeAt(i);
|
||||
if (!IsSimpleLocalOrLiteralNode(arg)) {
|
||||
LocalVariable* temp =
|
||||
CreateTempConstVariable(arg->token_pos(), arg->id(), "sca");
|
||||
CreateTempConstVariable(arg->token_pos(), "sca");
|
||||
AstNode* save_temp =
|
||||
new StoreLocalNode(arg->token_pos(), *temp, arg);
|
||||
ctor_args->SetNodeAt(i, save_temp);
|
||||
|
@ -6309,10 +6294,9 @@ void Parser::EnsureExpressionTemp() {
|
|||
|
||||
|
||||
LocalVariable* Parser::CreateTempConstVariable(intptr_t token_pos,
|
||||
intptr_t token_id,
|
||||
const char* s) {
|
||||
char name[64];
|
||||
OS::SNPrint(name, 64, ":%s%d", s, token_id);
|
||||
OS::SNPrint(name, 64, ":%s%d", s, token_pos);
|
||||
LocalVariable* temp =
|
||||
new LocalVariable(token_pos,
|
||||
String::ZoneHandle(Symbols::New(name)),
|
||||
|
@ -6412,12 +6396,11 @@ AstNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) {
|
|||
if (node->IsLoadIndexedNode()) {
|
||||
LoadIndexedNode* left_node = node->AsLoadIndexedNode();
|
||||
LoadIndexedNode* right_node = left_node;
|
||||
intptr_t node_id = node->id();
|
||||
intptr_t token_pos = node->token_pos();
|
||||
node = NULL; // Do not use it.
|
||||
if (!IsSimpleLocalOrLiteralNode(left_node->array())) {
|
||||
LocalVariable* temp =
|
||||
CreateTempConstVariable(token_pos, node_id, "lia");
|
||||
CreateTempConstVariable(token_pos, "lia");
|
||||
StoreLocalNode* save =
|
||||
new StoreLocalNode(token_pos, *temp, left_node->array());
|
||||
left_node =
|
||||
|
@ -6428,7 +6411,7 @@ AstNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) {
|
|||
}
|
||||
if (!IsSimpleLocalOrLiteralNode(left_node->index_expr())) {
|
||||
LocalVariable* temp =
|
||||
CreateTempConstVariable(token_pos, node_id, "lix");
|
||||
CreateTempConstVariable(token_pos, "lix");
|
||||
StoreLocalNode* save =
|
||||
new StoreLocalNode(token_pos, *temp, left_node->index_expr());
|
||||
left_node = new LoadIndexedNode(token_pos,
|
||||
|
@ -6444,12 +6427,11 @@ AstNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) {
|
|||
if (node->IsInstanceGetterNode()) {
|
||||
InstanceGetterNode* left_node = node->AsInstanceGetterNode();
|
||||
InstanceGetterNode* right_node = left_node;
|
||||
intptr_t node_id = node->id();
|
||||
intptr_t token_pos = node->token_pos();
|
||||
node = NULL; // Do not use it.
|
||||
if (!IsSimpleLocalOrLiteralNode(left_node->receiver())) {
|
||||
LocalVariable* temp =
|
||||
CreateTempConstVariable(token_pos, node_id, "igr");
|
||||
CreateTempConstVariable(token_pos, "igr");
|
||||
StoreLocalNode* save =
|
||||
new StoreLocalNode(token_pos, *temp, left_node->receiver());
|
||||
left_node = new InstanceGetterNode(token_pos,
|
||||
|
@ -6482,7 +6464,7 @@ AstNode* Parser::CreateAssignmentNode(AstNode* original, AstNode* rhs) {
|
|||
AstNode* Parser::ParseCascades(AstNode* expr) {
|
||||
intptr_t cascade_pos = TokenPos();
|
||||
LocalVariable* cascade_receiver_var =
|
||||
CreateTempConstVariable(cascade_pos, expr->id(), "casc");
|
||||
CreateTempConstVariable(cascade_pos, "casc");
|
||||
StoreLocalNode* save_cascade =
|
||||
new StoreLocalNode(cascade_pos, *cascade_receiver_var, expr);
|
||||
current_block_->statements->Add(save_cascade);
|
||||
|
@ -7897,7 +7879,7 @@ ConstructorCallNode* Parser::CreateConstructorCallNode(
|
|||
EnsureExpressionTemp();
|
||||
}
|
||||
LocalVariable* allocated =
|
||||
CreateTempConstVariable(token_pos, token_pos, "alloc");
|
||||
CreateTempConstVariable(token_pos, "alloc");
|
||||
return new ConstructorCallNode(token_pos,
|
||||
type_arguments,
|
||||
constructor,
|
||||
|
|
|
@ -494,9 +494,7 @@ class Parser : ValueObject {
|
|||
AstNode* lhs,
|
||||
AstNode* rhs);
|
||||
AstNode* PrepareCompoundAssignmentNodes(AstNode** expr);
|
||||
LocalVariable* CreateTempConstVariable(intptr_t token_pos,
|
||||
intptr_t token_id,
|
||||
const char* s);
|
||||
LocalVariable* CreateTempConstVariable(intptr_t token_pos, const char* s);
|
||||
|
||||
static bool IsAssignableExpr(AstNode* expr);
|
||||
|
||||
|
|
|
@ -970,7 +970,7 @@ class RawICData : public RawObject {
|
|||
RawObject** to() {
|
||||
return reinterpret_cast<RawObject**>(&ptr()->ic_data_);
|
||||
}
|
||||
intptr_t id_; // Parser node id corresponding to this IC.
|
||||
intptr_t deopt_id_; // Deoptimization id corresponding to this IC.
|
||||
intptr_t num_args_tested_; // Number of arguments tested in IC.
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue