MIPS: Reland "Track field types.".
authorplind44@gmail.com <plind44@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 15 Apr 2014 15:11:36 +0000 (15:11 +0000)
committerplind44@gmail.com <plind44@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 15 Apr 2014 15:11:36 +0000 (15:11 +0000)
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=
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/238943002

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20774 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/mips/lithium-codegen-mips.cc
src/mips/stub-cache-mips.cc

index dd05f7d..f157f8b 100644 (file)
@@ -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 153a816..45aadc8 100644 (file)
@@ -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) {