Revision: 21110
Author: [email protected]
Date: Fri May 2 06:37:54 2014 UTC
Log: Don't add code dependencies on transitioning stores eagerly.
[email protected]
Review URL: https://codereview.chromium.org/256303007
http://code.google.com/p/v8/source/detail?r=21110
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/arm64/lithium-arm64.cc
/branches/bleeding_edge/src/arm64/lithium-arm64.h
/branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc
/branches/bleeding_edge/src/handles.h
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
/branches/bleeding_edge/src/lithium.cc
/branches/bleeding_edge/src/lithium.h
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.h
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Apr 30 09:50:58 2014
UTC
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Fri May 2 06:37:54 2014
UTC
@@ -427,6 +427,12 @@
info()->set_bailout_reason(reason);
status_ = ABORTED;
}
+
+
+void LChunkBuilder::AddDeprecationDependency(Handle<Map> map) {
+ if (map->is_deprecated()) return Abort(kMapBecameDeprecated);
+ chunk_->AddDeprecationDependency(map);
+}
LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
@@ -2299,6 +2305,11 @@
// We need a temporary register for write barrier of the map field.
LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL;
+
+ // Add a deprecation dependency on the transition target map.
+ if (instr->has_transition()) {
+ AddDeprecationDependency(instr->transition_map());
+ }
LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp);
if (!instr->access().IsExternalMemory() &&
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Wed Apr 30 10:24:03 2014
UTC
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Fri May 2 06:37:54 2014
UTC
@@ -2748,6 +2748,9 @@
void Abort(BailoutReason reason);
+ // Methods for code dependencies.
+ void AddDeprecationDependency(Handle<Map> map);
+
// Methods for getting operands for Use / Define / Temp.
LUnallocated* ToUnallocated(Register reg);
LUnallocated* ToUnallocated(DoubleRegister reg);
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Apr 30
14:33:35 2014 UTC
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri May 2
06:37:54 2014 UTC
@@ -63,7 +63,6 @@
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code);
PopulateDeoptimizationData(code);
- info()->CommitDependencies(code);
}
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-arm64.cc Wed Apr 30 13:38:00
2014 UTC
+++ /branches/bleeding_edge/src/arm64/lithium-arm64.cc Fri May 2 06:37:54
2014 UTC
@@ -358,6 +358,12 @@
info()->set_bailout_reason(reason);
status_ = ABORTED;
}
+
+
+void LChunkBuilder::AddDeprecationDependency(Handle<Map> map) {
+ if (map->is_deprecated()) return Abort(kMapBecameDeprecated);
+ chunk_->AddDeprecationDependency(map);
+}
LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
@@ -2249,6 +2255,11 @@
value = UseRegister(instr->value());
temp0 = TempRegister();
}
+
+ // Add a deprecation dependency on the transition target map.
+ if (instr->has_transition()) {
+ AddDeprecationDependency(instr->transition_map());
+ }
LStoreNamedField* result =
new(zone()) LStoreNamedField(object, value, temp0, temp1);
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-arm64.h Wed Apr 30 13:38:00
2014 UTC
+++ /branches/bleeding_edge/src/arm64/lithium-arm64.h Fri May 2 06:37:54
2014 UTC
@@ -2999,6 +2999,9 @@
void Abort(BailoutReason reason);
+ // Methods for code dependencies.
+ void AddDeprecationDependency(Handle<Map> map);
+
// Methods for getting operands for Use / Define / Temp.
LUnallocated* ToUnallocated(Register reg);
LUnallocated* ToUnallocated(DoubleRegister reg);
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Wed Apr 30
17:31:05 2014 UTC
+++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Fri May 2
06:37:54 2014 UTC
@@ -892,7 +892,6 @@
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code);
PopulateDeoptimizationData(code);
- info()->CommitDependencies(code);
}
=======================================
--- /branches/bleeding_edge/src/handles.h Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/handles.h Fri May 2 06:37:54 2014 UTC
@@ -153,6 +153,13 @@
inline Handle<T> handle(T* t) {
return Handle<T>(t, t->GetIsolate());
}
+
+
+// Key comparison function for Map handles.
+inline bool operator<(const Handle<Map>& lhs, const Handle<Map>& rhs) {
+ // This is safe because maps don't move.
+ return *lhs < *rhs;
+}
class DeferredHandles;
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri May 2 05:59:07
2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri May 2 06:37:54
2014 UTC
@@ -6611,14 +6611,9 @@
}
}
- void SetTransition(HConstant* map_constant, CompilationInfo* info) {
+ void SetTransition(HConstant* transition) {
ASSERT(!has_transition()); // Only set once.
- Handle<Map> map =
Handle<Map>::cast(map_constant->handle(info->isolate()));
- if (map->CanBeDeprecated()) {
- Map::AddDependentCompilationInfo(
- map, DependentCode::kTransitionGroup, info);
- }
- SetOperandAt(2, map_constant);
+ SetOperandAt(2, transition);
has_transition_ = true;
}
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Wed Apr 30 10:51:01 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Fri May 2 06:37:54 2014 UTC
@@ -5420,9 +5420,9 @@
}
if (transition_to_field) {
- HConstant* transition_constant = Add<HConstant>(info->transition());
- instr->SetTransition(transition_constant, top_info());
- instr->SetChangesFlag(kMaps);
+ Handle<Map> transition(info->transition());
+ ASSERT(!transition->is_deprecated());
+ instr->SetTransition(Add<HConstant>(transition));
}
return instr;
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Apr 30
14:33:35 2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri May 2
06:37:54 2014 UTC
@@ -86,7 +86,6 @@
if (!info()->IsStub()) {
Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
}
- info()->CommitDependencies(code);
}
@@ -4344,7 +4343,7 @@
void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
- Representation representation = instr->representation();
+ Representation representation =
instr->hydrogen()->field_representation();
HObjectAccess access = instr->hydrogen()->access();
int offset = access.offset();
@@ -4366,7 +4365,6 @@
}
Register object = ToRegister(instr->object());
- Handle<Map> transition = instr->transition();
SmiCheck check_needed =
instr->hydrogen()->value()->IsHeapObject()
? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
@@ -4391,8 +4389,8 @@
}
}
} else if (representation.IsDouble()) {
- ASSERT(transition.is_null());
ASSERT(access.IsInobject());
+ ASSERT(!instr->hydrogen()->has_transition());
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
if (CpuFeatures::IsSupported(SSE2)) {
CpuFeatureScope scope(masm(), SSE2);
@@ -4405,7 +4403,8 @@
return;
}
- if (!transition.is_null()) {
+ if (instr->hydrogen()->has_transition()) {
+ Handle<Map> transition = instr->hydrogen()->transition_map();
if (!instr->hydrogen()->NeedsWriteBarrierForMap()) {
__ mov(FieldOperand(object, HeapObject::kMapOffset), transition);
} else {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Apr 30 09:50:58
2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri May 2 06:37:54
2014 UTC
@@ -476,6 +476,12 @@
info()->set_bailout_reason(reason);
status_ = ABORTED;
}
+
+
+void LChunkBuilder::AddDeprecationDependency(Handle<Map> map) {
+ if (map->is_deprecated()) return Abort(kMapBecameDeprecated);
+ chunk_->AddDeprecationDependency(map);
+}
LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
@@ -2421,6 +2427,11 @@
// We need a temporary register for write barrier of the map field.
LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL;
+
+ // Add a deprecation dependency on the transition target map.
+ if (instr->has_transition()) {
+ AddDeprecationDependency(instr->transition_map());
+ }
LInstruction* result =
new(zone()) LStoreNamedField(obj, val, temp, temp_map);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Apr 30 10:24:03
2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Fri May 2 06:37:54
2014 UTC
@@ -2191,11 +2191,6 @@
DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
-
- Handle<Map> transition() const { return hydrogen()->transition_map(); }
- Representation representation() const {
- return hydrogen()->field_representation();
- }
};
@@ -2780,6 +2775,9 @@
void Abort(BailoutReason reason);
+ // Methods for code dependencies.
+ void AddDeprecationDependency(Handle<Map> map);
+
// Methods for getting operands for Use / Define / Temp.
LUnallocated* ToUnallocated(Register reg);
LUnallocated* ToUnallocated(XMMRegister reg);
=======================================
--- /branches/bleeding_edge/src/lithium.cc Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/lithium.cc Fri May 2 06:37:54 2014 UTC
@@ -233,7 +233,8 @@
graph_(graph),
instructions_(32, graph->zone()),
pointer_maps_(8, graph->zone()),
- inlined_closures_(1, graph->zone()) {
+ inlined_closures_(1, graph->zone()),
+ deprecation_dependencies_(MapLess(), MapAllocator(graph->zone())) {
}
@@ -370,6 +371,19 @@
LConstantOperand* operand) const {
return graph_->LookupValue(operand->index())->representation();
}
+
+
+void LChunk::CommitDependencies(Handle<Code> code) const {
+ for (MapSet::const_iterator it = deprecation_dependencies_.begin(),
+ iend = deprecation_dependencies_.end(); it != iend; ++it) {
+ Handle<Map> map = *it;
+ ASSERT(!map->is_deprecated());
+ ASSERT(map->CanBeDeprecated());
+ Map::AddDependentCode(map, DependentCode::kTransitionGroup, code);
+ }
+
+ info_->CommitDependencies(code);
+}
LChunk* LChunk::NewChunk(HGraph* graph) {
@@ -415,6 +429,7 @@
Handle<Code> code =
CodeGenerator::MakeCodeEpilogue(&assembler, flags, info());
generator.FinishCode(code);
+ CommitDependencies(code);
code->set_is_crankshafted(true);
void* jit_handler_data =
assembler.positions_recorder()->DetachJITHandlerData();
=======================================
--- /branches/bleeding_edge/src/lithium.h Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/lithium.h Fri May 2 06:37:54 2014 UTC
@@ -5,9 +5,12 @@
#ifndef V8_LITHIUM_H_
#define V8_LITHIUM_H_
+#include <set>
+
#include "allocation.h"
#include "hydrogen.h"
#include "safepoint-table.h"
+#include "zone-allocator.h"
namespace v8 {
namespace internal {
@@ -641,6 +644,13 @@
void AddInlinedClosure(Handle<JSFunction> closure) {
inlined_closures_.Add(closure, zone());
}
+
+ void AddDeprecationDependency(Handle<Map> map) {
+ ASSERT(!map->is_deprecated());
+ if (!map->CanBeDeprecated()) return;
+ ASSERT(!info_->IsStub());
+ deprecation_dependencies_.insert(map);
+ }
Zone* zone() const { return info_->zone(); }
@@ -657,12 +667,19 @@
int spill_slot_count_;
private:
+ typedef std::less<Handle<Map> > MapLess;
+ typedef zone_allocator<Handle<Map> > MapAllocator;
+ typedef std::set<Handle<Map>, MapLess, MapAllocator> MapSet;
+
+ void CommitDependencies(Handle<Code> code) const;
+
CompilationInfo* info_;
HGraph* const graph_;
BitVector* allocated_double_registers_;
ZoneList<LInstruction*> instructions_;
ZoneList<LPointerMap*> pointer_maps_;
ZoneList<Handle<JSFunction> > inlined_closures_;
+ MapSet deprecation_dependencies_;
};
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Apr 30
20:19:45 2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Fri May 2
06:37:54 2014 UTC
@@ -86,7 +86,6 @@
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code);
PopulateDeoptimizationData(code);
- info()->CommitDependencies(code);
}
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Apr 30 09:50:58
2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.cc Fri May 2 06:37:54
2014 UTC
@@ -432,6 +432,12 @@
info()->set_bailout_reason(reason);
status_ = ABORTED;
}
+
+
+void LChunkBuilder::AddDeprecationDependency(Handle<Map> map) {
+ if (map->is_deprecated()) return Abort(kMapBecameDeprecated);
+ chunk_->AddDeprecationDependency(map);
+}
LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
@@ -2250,6 +2256,11 @@
// We need a temporary register for write barrier of the map field.
LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL;
+
+ // Add a deprecation dependency on the transition target map.
+ if (instr->has_transition()) {
+ AddDeprecationDependency(instr->transition_map());
+ }
LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp);
if (!instr->access().IsExternalMemory() &&
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h Wed Apr 30 10:24:03
2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.h Fri May 2 06:37:54
2014 UTC
@@ -2703,6 +2703,9 @@
void Abort(BailoutReason reason);
+ // Methods for code dependencies.
+ void AddDeprecationDependency(Handle<Map> map);
+
// Methods for getting operands for Use / Define / Temp.
LUnallocated* ToUnallocated(Register reg);
LUnallocated* ToUnallocated(DoubleRegister reg);
=======================================
--- /branches/bleeding_edge/src/objects.h Fri May 2 06:02:00 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Fri May 2 06:37:54 2014 UTC
@@ -1156,6 +1156,7 @@
V(kLiveEdit, "LiveEdit")
\
V(kLookupVariableInCountOperation,
\
"Lookup variable in count
operation") \
+ V(kMapBecameDeprecated, "Map became
deprecated") \
V(kMapIsNoLongerInEax, "Map is no longer in
eax") \
V(kModuleDeclaration, "Module
declaration") \
V(kModuleLiteral, "Module
literal") \
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Apr 30
14:33:35 2014 UTC
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri May 2
06:37:54 2014 UTC
@@ -66,7 +66,6 @@
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code);
PopulateDeoptimizationData(code);
- info()->CommitDependencies(code);
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Apr 30 09:50:58 2014
UTC
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Fri May 2 06:37:54 2014
UTC
@@ -443,6 +443,12 @@
info()->set_bailout_reason(reason);
status_ = ABORTED;
}
+
+
+void LChunkBuilder::AddDeprecationDependency(Handle<Map> map) {
+ if (map->is_deprecated()) return Abort(kMapBecameDeprecated);
+ chunk_->AddDeprecationDependency(map);
+}
LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
@@ -2313,6 +2319,11 @@
// have a store into the properties array (not in-object-property).
LOperand* temp = (!is_in_object || needs_write_barrier ||
needs_write_barrier_for_map) ? TempRegister() : NULL;
+
+ // Add a deprecation dependency on the transition target map.
+ if (instr->has_transition()) {
+ AddDeprecationDependency(instr->transition_map());
+ }
LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp);
if (!instr->access().IsExternalMemory() &&
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Wed Apr 30 10:24:03 2014
UTC
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Fri May 2 06:37:54 2014
UTC
@@ -2710,6 +2710,9 @@
void Abort(BailoutReason reason);
+ // Methods for code dependencies.
+ void AddDeprecationDependency(Handle<Map> map);
+
// Methods for getting operands for Use / Define / Temp.
LUnallocated* ToUnallocated(Register reg);
LUnallocated* ToUnallocated(XMMRegister reg);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.