Reviewers: Sven Panne,

Description:
Initialize interface descriptor for ToNumberStub.

[email protected]
BUG=

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+25, -11 lines):
  M src/code-stubs.h
  M src/code-stubs.cc
  M src/isolate.cc


Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index be14cf6e87ebe0d2374868e76e8d51e8de039128..fe7d77eaa26f870d70f6a75c5f88ce055c894b76 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -748,6 +748,14 @@ void FastNewContextStub::InstallDescriptors(Isolate* isolate) {


 // static
+void FastCloneShallowArrayStub::InstallDescriptors(Isolate* isolate) {
+  FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS,
+                                 DONT_TRACK_ALLOCATION_SITE, 0);
+  InstallDescriptor(isolate, &stub);
+}
+
+
+// static
 void BinaryOpICStub::InstallDescriptors(Isolate* isolate) {
   BinaryOpICStub stub(Token::ADD, NO_OVERWRITE);
   InstallDescriptor(isolate, &stub);
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 07e34be578b2a6533b5c2759b5281901af41043d..79043d5e0f6a0a956d08fe1dbdf0d74dcdf20b98 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -486,6 +486,13 @@ class ToNumberStub: public HydrogenCodeStub {
       Isolate* isolate,
       CodeStubInterfaceDescriptor* descriptor);

+  static void InstallDescriptors(Isolate* isolate) {
+    ToNumberStub stub;
+    stub.InitializeInterfaceDescriptor(
+        isolate,
+        isolate->code_stub_interface_descriptor(CodeStub::ToNumber));
+  }
+
  private:
   Major MajorKey() { return ToNumber; }
   int NotMissMinorKey() { return 0; }
@@ -624,6 +631,8 @@ class FastCloneShallowArrayStub : public HydrogenCodeStub {
       Isolate* isolate,
       CodeStubInterfaceDescriptor* descriptor);

+  static void InstallDescriptors(Isolate* isolate);
+
  private:
   Mode mode_;
   AllocationSiteMode allocation_site_mode_;
@@ -1375,7 +1384,7 @@ class CompareNilICStub : public HydrogenCodeStub  {
       Isolate* isolate,
       CodeStubInterfaceDescriptor* descriptor);

-  static void InitializeForIsolate(Isolate* isolate) {
+  static void InstallDescriptors(Isolate* isolate) {
     CompareNilICStub compare_stub(kNullValue, UNINITIALIZED);
     compare_stub.InitializeInterfaceDescriptor(
         isolate,
@@ -2332,7 +2341,7 @@ class ToBooleanStub: public HydrogenCodeStub {

   virtual bool SometimesSetsUpAFrame() { return false; }

-  static void InitializeForIsolate(Isolate* isolate) {
+  static void InstallDescriptors(Isolate* isolate) {
     ToBooleanStub stub;
     stub.InitializeInterfaceDescriptor(
         isolate,
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index ca324603f79bdbbab5b62972c72ab84f948fb31d..d81e50e2235399bec8a10a9eaa925f027b93c3c8 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2106,17 +2106,14 @@ bool Isolate::Init(Deserializer* des) {
     CodeStub::GenerateFPStubs(this);
     StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this);
     StubFailureTrampolineStub::GenerateAheadOfTime(this);
-    // TODO(mstarzinger): The following is an ugly hack to make sure the
-    // interface descriptor is initialized even when stubs have been
-    // deserialized out of the snapshot without the graph builder.
- FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS,
-                                   DONT_TRACK_ALLOCATION_SITE, 0);
-    stub.InitializeInterfaceDescriptor(
- this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray)); + // Ensure interface descriptors are initialized even when stubs have been
+    // deserialized out of the snapshot without using the graph builder.
+    FastCloneShallowArrayStub::InstallDescriptors(this);
     BinaryOpICStub::InstallDescriptors(this);
     BinaryOpWithAllocationSiteStub::InstallDescriptors(this);
-    CompareNilICStub::InitializeForIsolate(this);
-    ToBooleanStub::InitializeForIsolate(this);
+    CompareNilICStub::InstallDescriptors(this);
+    ToBooleanStub::InstallDescriptors(this);
+    ToNumberStub::InstallDescriptors(this);
     ArrayConstructorStubBase::InstallDescriptors(this);
     InternalArrayConstructorStubBase::InstallDescriptors(this);
     FastNewClosureStub::InstallDescriptors(this);


--
--
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/groups/opt_out.

Reply via email to