Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 163683006: Simplify generated code for object allocation with type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 32653)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -5548,18 +5548,6 @@
}
-static bool HasSimpleTypeArguments(AllocateObjectInstr* alloc) {
- if (alloc->ArgumentCount() == 0) return true;
- ASSERT(alloc->ArgumentCount() == 2);
- Value* arg1 = alloc->PushArgumentAt(1)->value();
- if (!arg1->BindsToConstant()) return false;
-
- const Object& obj = arg1->BoundConstant();
- return obj.IsSmi()
- && (Smi::Cast(obj).Value() == StubCode::kNoInstantiator);
-}
-
-
class LoadOptimizer : public ValueObject {
public:
LoadOptimizer(FlowGraph* graph,
@@ -5723,8 +5711,7 @@
// escaping object.
AllocateObjectInstr* alloc = instr->AsAllocateObject();
if ((alloc != NULL) &&
- !AliasedSet::CanBeAliased(alloc) &&
- HasSimpleTypeArguments(alloc)) {
+ !AliasedSet::CanBeAliased(alloc)) {
regis 2014/02/13 19:07:50 single line
Florian Schneider 2014/02/14 11:36:34 Done.
for (Value* use = alloc->input_use_list();
use != NULL;
use = use->next_use()) {
@@ -5741,7 +5728,7 @@
if (out_values == NULL) out_values = CreateBlockOutValues();
if (alloc->ArgumentCount() > 0) {
- ASSERT(alloc->ArgumentCount() == 2);
+ ASSERT(alloc->ArgumentCount() == 1);
intptr_t type_args_offset =
alloc->cls().type_arguments_field_offset();
if (load->offset_in_bytes() == type_args_offset) {
@@ -7230,38 +7217,6 @@
}
-void ConstantPropagator::VisitExtractConstructorTypeArguments(
- ExtractConstructorTypeArgumentsInstr* instr) {
- CompileType* type = instr->instantiator()->Type();
- if (type->HasDecidableNullability()) {
- if (!type->is_nullable()) {
- SetValue(instr, instr->type_arguments());
- return;
- }
- ASSERT(type->IsNull());
- SetValue(instr, instr->instantiator()->definition()->constant_value());
- return;
- }
- SetValue(instr, non_constant_);
-}
-
-
-void ConstantPropagator::VisitExtractConstructorInstantiator(
- ExtractConstructorInstantiatorInstr* instr) {
- CompileType* type = instr->instantiator()->Type();
- if (type->HasDecidableNullability()) {
- if (type->IsNull()) {
- SetValue(instr, Smi::ZoneHandle(Smi::New(StubCode::kNoInstantiator)));
- return;
- }
- ASSERT(!type->is_nullable());
- SetValue(instr, instr->instantiator()->definition()->constant_value());
- return;
- }
- SetValue(instr, non_constant_);
-}
-
-
void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) {
SetValue(instr, non_constant_);
}
@@ -8259,8 +8214,6 @@
// instructions that write into fields of the allocated object.
// We do not support materialization of the object that has type arguments.
static bool IsAllocationSinkingCandidate(AllocateObjectInstr* alloc) {
- if (!HasSimpleTypeArguments(alloc)) return false;
-
for (Value* use = alloc->input_use_list();
use != NULL;
use = use->next_use()) {
@@ -8298,7 +8251,7 @@
ASSERT(alloc->input_use_list() == NULL);
alloc->RemoveFromGraph();
if (alloc->ArgumentCount() > 0) {
- ASSERT(alloc->ArgumentCount() == 2);
+ ASSERT(alloc->ArgumentCount() == 1);
for (intptr_t i = 0; i < alloc->ArgumentCount(); ++i) {
alloc->PushArgumentAt(i)->RemoveFromGraph();
}
@@ -8473,7 +8426,7 @@
}
if (alloc->ArgumentCount() > 0) {
- ASSERT(alloc->ArgumentCount() == 2);
+ ASSERT(alloc->ArgumentCount() == 1);
const String& name = String::Handle(Symbols::New(":type_args"));
const Field& type_args_field =
Field::ZoneHandle(Field::New(

Powered by Google App Engine
This is Rietveld 408576698