Reviewers: danno, Benedikt Meurer, Paul Lind, kisg, palfia, dusmil,

Description:
MIPS: Reland "Track field types.".

Port r20746 (09f9176)

Original commit message:
This is an initial step towards tracking the exact types instead of just
the representations of fields. It adds support to track up to one map of
heap object field values, eliminating various map checks on values
loaded from such fields, at the cost of making stores to such fields
slightly more expensive.

Issues with transitioning stores and fast object literals in Crankshaft
fixed.

TEST=mjsunit/field-type-tracking
BUG=

Please review this at https://codereview.chromium.org/238943002/

SVN Base: https://github.com/v8/v8.git@gbl

Affected files (+17, -3 lines):
  M src/mips/lithium-codegen-mips.cc
  M src/mips/stub-cache-mips.cc


Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index dd05f7de3782ab65282bf130b92eb3a5b4e3d71e..f157f8b22d1e0ad192349aa655f21090061cd243 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -4085,7 +4085,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
       __ SmiTst(value, scratch);
       DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));

-      // We know that value is a smi now, so we can omit the check below.
+ // We know now that value is not a smi, so we can omit the check below.
       check_needed = OMIT_SMI_CHECK;
     }
   } else if (representation.IsDouble()) {
Index: src/mips/stub-cache-mips.cc
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc
index 153a8168207121389892de1ec307edc1a6211e65..45aadc85a30b2ac470a95e23892af0f63d894bba 100644
--- a/src/mips/stub-cache-mips.cc
+++ b/src/mips/stub-cache-mips.cc
@@ -415,7 +415,14 @@ void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
   } else if (representation.IsSmi()) {
     __ JumpIfNotSmi(value_reg, miss_label);
   } else if (representation.IsHeapObject()) {
-    __ JumpIfSmi(value_reg, miss_label);
+    HeapType* field_type = descriptors->GetFieldType(descriptor);
+    if (field_type->IsClass()) {
+      __ CheckMap(value_reg, scratch1, field_type->AsClass(),
+                  miss_label, DO_SMI_CHECK);
+    } else {
+      ASSERT(HeapType::Any()->Is(field_type));
+      __ JumpIfSmi(value_reg, miss_label);
+    }
   } else if (representation.IsDouble()) {
     Label do_store, heap_number;
     __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex);
@@ -578,7 +585,14 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm,
   if (representation.IsSmi()) {
     __ JumpIfNotSmi(value_reg, miss_label);
   } else if (representation.IsHeapObject()) {
-    __ JumpIfSmi(value_reg, miss_label);
+    HeapType* field_type = lookup->GetFieldType();
+    if (field_type->IsClass()) {
+      __ CheckMap(value_reg, scratch1, field_type->AsClass(),
+                  miss_label, DO_SMI_CHECK);
+    } else {
+      ASSERT(HeapType::Any()->Is(field_type));
+      __ JumpIfSmi(value_reg, miss_label);
+    }
   } else if (representation.IsDouble()) {
     // Load the double storage.
     if (index < 0) {


--
--
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.

Reply via email to