Reviewers: ishell,

Message:
PTAL, if it looks all right, I'll upload other ports.

Description:
Do not embed constant functions in StoreTransition stub.

BUG=v8:3629
LOG=N

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+24, -2 lines):
  M src/ic/handler-compiler.h
  M src/ic/handler-compiler.cc
  M src/ic/x64/handler-compiler-x64.cc


Index: src/ic/handler-compiler.cc
diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc
index 9915ed11dcb302c238104f6b23883edf30c0d90c..41105b565eb08687bc6eec1b137d210ea4721e9e 100644
--- a/src/ic/handler-compiler.cc
+++ b/src/ic/handler-compiler.cc
@@ -340,9 +340,14 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition(

   // Call to respective StoreTransitionStub.
   if (details.type() == CONSTANT) {
- GenerateConstantCheck(descriptors->GetValue(descriptor), value(), &miss);
-
     GenerateRestoreMap(transition, scratch2(), &miss);
+    Object* expected_value = descriptors->GetValue(descriptor);
+    if (expected_value->IsJSObject()) {
+      Register map_reg = StoreTransitionDescriptor::MapRegister();
+ GenerateConstantCheck(map_reg, descriptor, value(), scratch2(), &miss);
+    } else {
+      GenerateConstantCheck(expected_value, value(), &miss);
+    }
     GenerateRestoreName(name);
     StoreTransitionStub stub(isolate());
     GenerateTailCall(masm(), stub.GetCode());
Index: src/ic/handler-compiler.h
diff --git a/src/ic/handler-compiler.h b/src/ic/handler-compiler.h
index ec07572fe563d82a9198990914dfb13f17f822b1..0ed847f7d01d8aeef35eb178f017fecab220e9e7 100644
--- a/src/ic/handler-compiler.h
+++ b/src/ic/handler-compiler.h
@@ -236,6 +236,9 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {

   void GenerateConstantCheck(Object* constant, Register value_reg,
                              Label* miss_label);
+  void GenerateConstantCheck(Register map_reg, int descriptor,
+                             Register value_reg, Register scratch,
+                             Label* miss_label);

   void GenerateFieldTypeChecks(HeapType* field_type, Register value_reg,
                                Label* miss_label);
Index: src/ic/x64/handler-compiler-x64.cc
diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc index 2e19fb5abab47a437d8d9a0a8eeadb760cfd20a0..432b302cf69a2a9125eda90e4a5470cc58920e78 100644
--- a/src/ic/x64/handler-compiler-x64.cc
+++ b/src/ic/x64/handler-compiler-x64.cc
@@ -335,6 +335,7 @@ void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
   }
 }

+
 void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant,
                                                       Register value_reg,
                                                       Label* miss_label) {
@@ -343,6 +344,19 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant,
 }


+void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
+                                                      int descriptor,
+                                                      Register value_reg,
+                                                      Register scratch,
+                                                      Label* miss_label) {
+  __ LoadInstanceDescriptors(map_reg, scratch);
+  __ movp(scratch,
+ FieldOperand(scratch, DescriptorArray::GetValueOffset(descriptor)));
+  __ cmpp(value_reg, scratch);
+  __ j(not_equal, miss_label);
+}
+
+
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
                                                         Register value_reg,
Label* miss_label) {


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