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

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: addressed comments 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
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
@@ -5722,9 +5710,7 @@
// TODO(vegorov): record null-values at least for not final fields of
// escaping object.
AllocateObjectInstr* alloc = instr->AsAllocateObject();
- if ((alloc != NULL) &&
- !AliasedSet::CanBeAliased(alloc) &&
- HasSimpleTypeArguments(alloc)) {
+ if ((alloc != NULL) && !AliasedSet::CanBeAliased(alloc)) {
for (Value* use = alloc->input_use_list();
use != NULL;
use = use->next_use()) {
@@ -5741,7 +5727,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 +7216,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 +8213,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 +8250,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 +8425,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(
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698