Reviewers: Yang,

Message:
PTAL #4

Description:
*NumberDictionary::AtNumberPut() handlified.

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

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

Affected files (+29, -43 lines):
  M src/code-stubs.cc
  M src/factory.h
  M src/factory.cc
  M src/objects.h
  M src/objects.cc
  M src/runtime.cc
  M src/type-info.cc


Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 0840f6c21f4dd966a66ed94f65075be37a8814eb..c0ff6c56c2617cc19f9d6ac34ccb3ff0b30e3d76 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -135,7 +135,6 @@ void CodeStub::VerifyPlatformFeatures(Isolate* isolate) {


 Handle<Code> CodeStub::GetCode(Isolate* isolate) {
-  Factory* factory = isolate->factory();
   Heap* heap = isolate->heap();
   Code* code;
   if (UseSpecialCache()
@@ -170,7 +169,7 @@ Handle<Code> CodeStub::GetCode(Isolate* isolate) {
     } else {
       // Update the dictionary and the root in Heap.
       Handle<UnseededNumberDictionary> dict =
-          factory->DictionaryAtNumberPut(
+          UnseededNumberDictionary::AtNumberPut(
               Handle<UnseededNumberDictionary>(heap->code_stubs()),
               GetKey(),
               new_object);
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 2f5d1bd939cf20ef8ab666b5e08fa8d3f1646676..66b7fc614f35c01584344fb21b034cf338779d66 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1959,26 +1959,6 @@ Handle<String> Factory::NumberToString(Handle<Object> number,
 }


-Handle<SeededNumberDictionary> Factory::DictionaryAtNumberPut(
-    Handle<SeededNumberDictionary> dictionary,
-    uint32_t key,
-    Handle<Object> value) {
-  CALL_HEAP_FUNCTION(isolate(),
-                     dictionary->AtNumberPut(key, *value),
-                     SeededNumberDictionary);
-}
-
-
-Handle<UnseededNumberDictionary> Factory::DictionaryAtNumberPut(
-    Handle<UnseededNumberDictionary> dictionary,
-    uint32_t key,
-    Handle<Object> value) {
-  CALL_HEAP_FUNCTION(isolate(),
-                     dictionary->AtNumberPut(key, *value),
-                     UnseededNumberDictionary);
-}
-
-
 void Factory::InitializeFunction(Handle<JSFunction> function,
                                  Handle<SharedFunctionInfo> info,
                                  Handle<Context> context,
Index: src/factory.h
diff --git a/src/factory.h b/src/factory.h
index a19f297c00f1b859491a15406ab5040aac28bf05..11928e684a1020eb6a44054782f378f9b5da5281 100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -605,16 +605,6 @@ class Factory V8_FINAL {
       Handle<Object> script,
       Handle<Object> stack_frames);

-  Handle<SeededNumberDictionary> DictionaryAtNumberPut(
-      Handle<SeededNumberDictionary>,
-      uint32_t key,
-      Handle<Object> value);
-
-  Handle<UnseededNumberDictionary> DictionaryAtNumberPut(
-      Handle<UnseededNumberDictionary>,
-      uint32_t key,
-      Handle<Object> value);
-
 #ifdef ENABLE_DEBUGGER_SUPPORT
   Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
 #endif
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 7e768d90c19b07cbf25e1cb543f3257e65c50840..0df564b9eaf5ced4671579b9d8fa196a3e43daef 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -16058,15 +16058,26 @@ Handle<UnseededNumberDictionary> UnseededNumberDictionary::AddNumberEntry(
 }


-MaybeObject* SeededNumberDictionary::AtNumberPut(uint32_t key, Object* value) {
-  UpdateMaxNumberKey(key);
-  return AtPut(key, value);
+Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut(
+    Handle<SeededNumberDictionary> dictionary,
+    uint32_t key,
+    Handle<Object> value) {
+  dictionary->UpdateMaxNumberKey(key);
+  CALL_HEAP_FUNCTION(
+      dictionary->GetIsolate(),
+      dictionary->AtPut(key, *value),
+      SeededNumberDictionary);
 }


-MaybeObject* UnseededNumberDictionary::AtNumberPut(uint32_t key,
-                                                   Object* value) {
-  return AtPut(key, value);
+Handle<UnseededNumberDictionary> UnseededNumberDictionary::AtNumberPut(
+    Handle<UnseededNumberDictionary> dictionary,
+    uint32_t key,
+    Handle<Object> value) {
+  CALL_HEAP_FUNCTION(
+      dictionary->GetIsolate(),
+      dictionary->AtPut(key, *value),
+      UnseededNumberDictionary);
 }


Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index dc8aa7a4a17ce58ffe99573bdfc169040bdfc185..85807ee34629df866445e9e7c0163706367a88c3 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4193,7 +4193,10 @@ class SeededNumberDictionary
   }

   // Type specific at put (default NONE attributes is used when adding).
-  MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
+  MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut(
+      Handle<SeededNumberDictionary> dictionary,
+      uint32_t key,
+      Handle<Object> value);
   MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry(
       Handle<SeededNumberDictionary> dictionary,
       uint32_t key,
@@ -4245,7 +4248,10 @@ class UnseededNumberDictionary
   }

   // Type specific at put (default NONE attributes is used when adding).
-  MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
+  MUST_USE_RESULT static Handle<UnseededNumberDictionary> AtNumberPut(
+      Handle<UnseededNumberDictionary> dictionary,
+      uint32_t key,
+      Handle<Object> value);
   MUST_USE_RESULT static Handle<UnseededNumberDictionary> AddNumberEntry(
       Handle<UnseededNumberDictionary> dictionary,
       uint32_t key,
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index ef7a74857deb6bf2a999b4b745c3028cd933f489..3e84da98cb4115cc499e650aed5e00d9658f0cf2 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -9979,7 +9979,7 @@ class ArrayConcatVisitor {
     Handle<SeededNumberDictionary> dict(
         SeededNumberDictionary::cast(*storage_));
     Handle<SeededNumberDictionary> result =
-        isolate_->factory()->DictionaryAtNumberPut(dict, index, elm);
+        SeededNumberDictionary::AtNumberPut(dict, index, elm);
     if (!result.is_identical_to(dict)) {
       // Dictionary needed to grow.
       clear_storage();
@@ -10029,7 +10029,7 @@ class ArrayConcatVisitor {
       Handle<Object> element(current_storage->get(i), isolate_);
       if (!element->IsTheHole()) {
         Handle<SeededNumberDictionary> new_storage =
- isolate_->factory()->DictionaryAtNumberPut(slow_storage, i, element);
+            SeededNumberDictionary::AtNumberPut(slow_storage, i, element);
         if (!new_storage.is_identical_to(slow_storage)) {
           slow_storage = loop_scope.CloseAndEscape(new_storage);
         }
Index: src/type-info.cc
diff --git a/src/type-info.cc b/src/type-info.cc
index ce54504152874e31344449284c294519fe9a9059..0dd23b08d6c1a42aec46419766a613e91a59a85b 100644
--- a/src/type-info.cc
+++ b/src/type-info.cc
@@ -495,7 +495,7 @@ void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) {
   // Dictionary has been allocated with sufficient size for all elements.
   DisallowHeapAllocation no_need_to_resize_dictionary;
   HandleScope scope(isolate());
-  isolate()->factory()->DictionaryAtNumberPut(
+  UnseededNumberDictionary::AtNumberPut(
       dictionary_, IdToKey(ast_id), handle(target, isolate()));
 }



--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to