Handlify AddDependentCode(), AddDependentCompilationInfo() and AddDependentIC().
R=ishell@chromium.org Review URL: https://codereview.chromium.org/236193014 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20756 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
6a3e92b9a2
commit
b5cec2b72f
@ -3407,8 +3407,8 @@ HCheckMaps* HCheckMaps::New(Zone* zone,
|
||||
// TODO(titzer): collect dependent map checks into a list.
|
||||
check_map->omit_ = true;
|
||||
if (map->CanTransition()) {
|
||||
map->AddDependentCompilationInfo(
|
||||
DependentCode::kPrototypeCheckGroup, info);
|
||||
Map::AddDependentCompilationInfo(
|
||||
map, DependentCode::kPrototypeCheckGroup, info);
|
||||
}
|
||||
}
|
||||
return check_map;
|
||||
|
@ -6601,7 +6601,8 @@ class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
|
||||
ASSERT(!has_transition()); // Only set once.
|
||||
Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate()));
|
||||
if (map->CanBeDeprecated()) {
|
||||
map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info);
|
||||
Map::AddDependentCompilationInfo(
|
||||
map, DependentCode::kTransitionGroup, info);
|
||||
}
|
||||
SetOperandAt(2, map_constant);
|
||||
has_transition_ = true;
|
||||
|
@ -4925,7 +4925,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
|
||||
Handle<GlobalObject> global(current_info()->global_object());
|
||||
Handle<PropertyCell> cell(global->GetPropertyCell(&lookup));
|
||||
if (cell->type()->IsConstant()) {
|
||||
cell->AddDependentCompilationInfo(top_info());
|
||||
PropertyCell::AddDependentCompilationInfo(cell, top_info());
|
||||
Handle<Object> constant_object = cell->type()->AsConstant();
|
||||
if (constant_object->IsConsString()) {
|
||||
constant_object =
|
||||
@ -5552,11 +5552,12 @@ void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMap(Handle<Map> map) {
|
||||
Handle<Map> field_map = field_type->AsClass();
|
||||
if (field_map->is_stable()) {
|
||||
field_map_ = field_map;
|
||||
field_map_->AddDependentCompilationInfo(
|
||||
DependentCode::kPrototypeCheckGroup, top_info());
|
||||
Map::AddDependentCompilationInfo(
|
||||
field_map_, DependentCode::kPrototypeCheckGroup, top_info());
|
||||
|
||||
// Add dependency on the map that introduced the field.
|
||||
lookup_.GetFieldOwnerFromMap(*map)->AddDependentCompilationInfo(
|
||||
Map::AddDependentCompilationInfo(
|
||||
handle(lookup_.GetFieldOwnerFromMap(*map), isolate()),
|
||||
DependentCode::kFieldTypeGroup, top_info());
|
||||
}
|
||||
}
|
||||
@ -6826,16 +6827,16 @@ void HOptimizedGraphBuilder::VisitProperty(Property* expr) {
|
||||
HInstruction* HGraphBuilder::BuildConstantMapCheck(Handle<JSObject> constant,
|
||||
CompilationInfo* info) {
|
||||
HConstant* constant_value = New<HConstant>(constant);
|
||||
Handle<Map> map(constant->map(), info->isolate());
|
||||
|
||||
if (constant->map()->CanOmitMapChecks()) {
|
||||
constant->map()->AddDependentCompilationInfo(
|
||||
DependentCode::kPrototypeCheckGroup, info);
|
||||
Map::AddDependentCompilationInfo(
|
||||
map, DependentCode::kPrototypeCheckGroup, info);
|
||||
return constant_value;
|
||||
}
|
||||
|
||||
AddInstruction(constant_value);
|
||||
HCheckMaps* check =
|
||||
Add<HCheckMaps>(constant_value, handle(constant->map()), info);
|
||||
HCheckMaps* check = Add<HCheckMaps>(constant_value, map, info);
|
||||
check->ClearDependsOnFlag(kElementsKind);
|
||||
return check;
|
||||
}
|
||||
|
@ -438,9 +438,11 @@ class HGraph V8_FINAL : public ZoneObject {
|
||||
void MarkDependsOnEmptyArrayProtoElements() {
|
||||
// Add map dependency if not already added.
|
||||
if (depends_on_empty_array_proto_elements_) return;
|
||||
isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo(
|
||||
Map::AddDependentCompilationInfo(
|
||||
handle(isolate()->initial_object_prototype()->map()),
|
||||
DependentCode::kElementsCantBeAddedGroup, info());
|
||||
isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo(
|
||||
Map::AddDependentCompilationInfo(
|
||||
handle(isolate()->initial_array_prototype()->map()),
|
||||
DependentCode::kElementsCantBeAddedGroup, info());
|
||||
depends_on_empty_array_proto_elements_ = true;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ void IC::RegisterWeakMapDependency(Handle<Code> stub) {
|
||||
MapHandleList maps;
|
||||
stub->FindAllMaps(&maps);
|
||||
if (maps.length() == 1 && stub->IsWeakObjectInIC(*maps.at(0))) {
|
||||
maps.at(0)->AddDependentIC(stub);
|
||||
Map::AddDependentIC(maps.at(0), stub);
|
||||
stub->mark_as_weak_stub();
|
||||
if (FLAG_enable_ool_constant_pool) {
|
||||
stub->constant_pool()->set_weak_object_state(
|
||||
|
@ -211,7 +211,7 @@ void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) {
|
||||
NoWeakObjectVerificationScope disable_verification_of_embedded_objects;
|
||||
#endif
|
||||
for (int i = 0; i < maps.length(); i++) {
|
||||
maps.at(i)->AddDependentCode(DependentCode::kWeakCodeGroup, code);
|
||||
Map::AddDependentCode(maps.at(i), DependentCode::kWeakCodeGroup, code);
|
||||
}
|
||||
for (int i = 0; i < objects.length(); i++) {
|
||||
AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code);
|
||||
|
@ -11689,35 +11689,41 @@ void Map::ZapPrototypeTransitions() {
|
||||
}
|
||||
|
||||
|
||||
void Map::AddDependentCompilationInfo(DependentCode::DependencyGroup group,
|
||||
// static
|
||||
void Map::AddDependentCompilationInfo(Handle<Map> map,
|
||||
DependentCode::DependencyGroup group,
|
||||
CompilationInfo* info) {
|
||||
Handle<DependentCode> dep(dependent_code());
|
||||
Handle<DependentCode> codes =
|
||||
DependentCode::Insert(dep, group, info->object_wrapper());
|
||||
if (*codes != dependent_code()) set_dependent_code(*codes);
|
||||
info->dependencies(group)->Add(Handle<HeapObject>(this), info->zone());
|
||||
DependentCode::Insert(handle(map->dependent_code(), info->isolate()),
|
||||
group, info->object_wrapper());
|
||||
if (*codes != map->dependent_code()) map->set_dependent_code(*codes);
|
||||
info->dependencies(group)->Add(map, info->zone());
|
||||
}
|
||||
|
||||
|
||||
void Map::AddDependentCode(DependentCode::DependencyGroup group,
|
||||
// static
|
||||
void Map::AddDependentCode(Handle<Map> map,
|
||||
DependentCode::DependencyGroup group,
|
||||
Handle<Code> code) {
|
||||
Handle<DependentCode> codes = DependentCode::Insert(
|
||||
Handle<DependentCode>(dependent_code()), group, code);
|
||||
if (*codes != dependent_code()) set_dependent_code(*codes);
|
||||
Handle<DependentCode>(map->dependent_code()), group, code);
|
||||
if (*codes != map->dependent_code()) map->set_dependent_code(*codes);
|
||||
}
|
||||
|
||||
|
||||
void Map::AddDependentIC(Handle<Code> stub) {
|
||||
// static
|
||||
void Map::AddDependentIC(Handle<Map> map,
|
||||
Handle<Code> stub) {
|
||||
ASSERT(stub->next_code_link()->IsUndefined());
|
||||
int n = dependent_code()->number_of_entries(DependentCode::kWeakICGroup);
|
||||
int n = map->dependent_code()->number_of_entries(DependentCode::kWeakICGroup);
|
||||
if (n == 0) {
|
||||
// Slow path: insert the head of the list with possible heap allocation.
|
||||
AddDependentCode(DependentCode::kWeakICGroup, stub);
|
||||
Map::AddDependentCode(map, DependentCode::kWeakICGroup, stub);
|
||||
} else {
|
||||
// Fast path: link the stub to the existing head of the list without any
|
||||
// heap allocation.
|
||||
ASSERT(n == 1);
|
||||
dependent_code()->AddToDependentICList(stub);
|
||||
map->dependent_code()->AddToDependentICList(stub);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16604,14 +16610,16 @@ void PropertyCell::SetValueInferType(Handle<PropertyCell> cell,
|
||||
}
|
||||
|
||||
|
||||
void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) {
|
||||
Handle<DependentCode> dep(dependent_code());
|
||||
// static
|
||||
void PropertyCell::AddDependentCompilationInfo(Handle<PropertyCell> cell,
|
||||
CompilationInfo* info) {
|
||||
Handle<DependentCode> codes =
|
||||
DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup,
|
||||
DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
|
||||
DependentCode::kPropertyCellChangedGroup,
|
||||
info->object_wrapper());
|
||||
if (*codes != dependent_code()) set_dependent_code(*codes);
|
||||
if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
|
||||
info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
|
||||
Handle<HeapObject>(this), info->zone());
|
||||
cell, info->zone());
|
||||
}
|
||||
|
||||
|
||||
|
@ -6558,12 +6558,15 @@ class Map: public HeapObject {
|
||||
|
||||
inline bool CanOmitMapChecks();
|
||||
|
||||
void AddDependentCompilationInfo(DependentCode::DependencyGroup group,
|
||||
CompilationInfo* info);
|
||||
static void AddDependentCompilationInfo(Handle<Map> map,
|
||||
DependentCode::DependencyGroup group,
|
||||
CompilationInfo* info);
|
||||
|
||||
void AddDependentCode(DependentCode::DependencyGroup group,
|
||||
Handle<Code> code);
|
||||
void AddDependentIC(Handle<Code> stub);
|
||||
static void AddDependentCode(Handle<Map> map,
|
||||
DependentCode::DependencyGroup group,
|
||||
Handle<Code> code);
|
||||
static void AddDependentIC(Handle<Map> map,
|
||||
Handle<Code> stub);
|
||||
|
||||
bool IsMapInArrayPrototypeChain();
|
||||
|
||||
@ -9806,9 +9809,8 @@ class PropertyCell: public Cell {
|
||||
static Handle<HeapType> UpdatedType(Handle<PropertyCell> cell,
|
||||
Handle<Object> value);
|
||||
|
||||
void AddDependentCompilationInfo(CompilationInfo* info);
|
||||
|
||||
void AddDependentCode(Handle<Code> code);
|
||||
static void AddDependentCompilationInfo(Handle<PropertyCell> cell,
|
||||
CompilationInfo* info);
|
||||
|
||||
// Casting.
|
||||
static inline PropertyCell* cast(Object* obj);
|
||||
|
Loading…
Reference in New Issue
Block a user