Reviewers: Yang,

Description:
Get rid of obsolete unchecked accessors.

[email protected]
BUG=v8:1490


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

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

Affected files:
  M src/compilation-cache.cc
  M src/elements.cc
  M src/frames.cc
  M src/heap-inl.h
  M src/heap.cc
  M src/json-parser.h
  M src/objects-inl.h
  M src/objects.cc
  M src/profile-generator.cc
  M src/serialize.cc
  M src/stub-cache.cc


Index: src/compilation-cache.cc
diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc
index c0645760b3f8655ff711944902e7809b57cd0811..904e84fd6cfe9c03889761df01d1bb978c4db6bb 100644
--- a/src/compilation-cache.cc
+++ b/src/compilation-cache.cc
@@ -98,7 +98,7 @@ void CompilationSubCache::Age() {


 void CompilationSubCache::IterateFunctions(ObjectVisitor* v) {
-  Object* undefined = isolate()->heap()->raw_unchecked_undefined_value();
+  Object* undefined = isolate()->heap()->undefined_value();
   for (int i = 0; i < generations_; i++) {
     if (tables_[i] != undefined) {
reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v);
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index 6afbcc0ee3c994d6055e0f5b6a12ad3dae1e28ed..72ad5096ee6eb31430fec1ebe32b88229619234d 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -503,8 +503,8 @@ class ElementsAccessorBase : public ElementsAccessor {
     Map* map = fixed_array_base->map();
     // Arrays that have been shifted in place can't be verified.
     Heap* heap = holder->GetHeap();
-    if (map == heap->raw_unchecked_one_pointer_filler_map() ||
-        map == heap->raw_unchecked_two_pointer_filler_map() ||
+    if (map == heap->one_pointer_filler_map() ||
+        map == heap->two_pointer_filler_map() ||
         map == heap->free_space_map()) {
       return;
     }
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index 18dc54164afc1a92bdefb7e5d837efd0b0850794..3b60fb59fa230537268533c6813d4c7cbe0575ae 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -484,7 +484,7 @@ Address StackFrame::UnpaddedFP() const {


 Code* EntryFrame::unchecked_code() const {
-  return HEAP->raw_unchecked_js_entry_code();
+  return HEAP->js_entry_code();
 }


@@ -507,7 +507,7 @@ StackFrame::Type EntryFrame::GetCallerState(State* state) const {


 Code* EntryConstructFrame::unchecked_code() const {
-  return HEAP->raw_unchecked_js_construct_entry_code();
+  return HEAP->js_construct_entry_code();
 }


Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index bace902d4dce87cc3b33c242e774c713acc08a27..e038453778504ab90d081e7a37bc8942f8c9caa5 100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -607,7 +607,7 @@ void ExternalStringTable::Verify() {
     Object* obj = Object::cast(new_space_strings_[i]);
     // TODO(yangguo): check that the object is indeed an external string.
     ASSERT(heap_->InNewSpace(obj));
-    ASSERT(obj != HEAP->raw_unchecked_the_hole_value());
+    ASSERT(obj != HEAP->the_hole_value());
     if (obj->IsExternalAsciiString()) {
       ExternalAsciiString* string = ExternalAsciiString::cast(obj);
       ASSERT(String::IsAscii(string->GetChars(), string->length()));
@@ -617,7 +617,7 @@ void ExternalStringTable::Verify() {
     Object* obj = Object::cast(old_space_strings_[i]);
     // TODO(yangguo): check that the object is indeed an external string.
     ASSERT(!heap_->InNewSpace(obj));
-    ASSERT(obj != HEAP->raw_unchecked_the_hole_value());
+    ASSERT(obj != HEAP->the_hole_value());
     if (obj->IsExternalAsciiString()) {
       ExternalAsciiString* string = ExternalAsciiString::cast(obj);
       ASSERT(String::IsAscii(string->GetChars(), string->length()));
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 0d2cc42402f4b3457b1d28340984069d452dbd7d..909e7605b0f3094bec5a69472e8a38ed7eed4f5b 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -7206,7 +7206,7 @@ void TranscendentalCache::Clear() {
 void ExternalStringTable::CleanUp() {
   int last = 0;
   for (int i = 0; i < new_space_strings_.length(); ++i) {
-    if (new_space_strings_[i] == heap_->raw_unchecked_the_hole_value()) {
+    if (new_space_strings_[i] == heap_->the_hole_value()) {
       continue;
     }
     if (heap_->InNewSpace(new_space_strings_[i])) {
@@ -7218,7 +7218,7 @@ void ExternalStringTable::CleanUp() {
   new_space_strings_.Rewind(last);
   last = 0;
   for (int i = 0; i < old_space_strings_.length(); ++i) {
-    if (old_space_strings_[i] == heap_->raw_unchecked_the_hole_value()) {
+    if (old_space_strings_[i] == heap_->the_hole_value()) {
       continue;
     }
     ASSERT(!heap_->InNewSpace(old_space_strings_[i]));
Index: src/json-parser.h
diff --git a/src/json-parser.h b/src/json-parser.h
index 0c26c184ee806e84ced0ff011d6e5a087770cc2d..9aa42013f9650fc070515f8c1d311c0976e4ea02 100644
--- a/src/json-parser.h
+++ b/src/json-parser.h
@@ -628,11 +628,11 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
     uint32_t count = 1;
     while (true) {
       Object* element = symbol_table->KeyAt(entry);
-      if (element == isolate()->heap()->raw_unchecked_undefined_value()) {
+      if (element == isolate()->heap()->undefined_value()) {
         // Lookup failure.
         break;
       }
-      if (element != isolate()->heap()->raw_unchecked_the_hole_value() &&
+      if (element != isolate()->heap()->the_hole_value() &&
           String::cast(element)->IsAsciiEqualTo(string_vector)) {
         // Lookup success, update the current position.
         position_ = position;
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index d2f996bae62fa44945af5a9528e09c54d4aa36eb..08358cb2939280c51d6c48fb20cf7296affeed9e 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -660,8 +660,8 @@ bool Object::IsDictionary() {


 bool Object::IsSymbolTable() {
-  return IsHashTable() && this ==
-         HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table();
+  return IsHashTable() &&
+ this == HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table();
 }


@@ -1850,7 +1850,7 @@ void FixedArray::set(int index,
 void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array,
                                               int index,
                                               Object* value) {
-  ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
+  ASSERT(array->map() != HEAP->fixed_cow_array_map());
   ASSERT(index >= 0 && index < array->length());
   int offset = kHeaderSize + index * kPointerSize;
   WRITE_FIELD(array, offset, value);
@@ -1864,7 +1864,7 @@ void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array,
 void FixedArray::NoWriteBarrierSet(FixedArray* array,
                                    int index,
                                    Object* value) {
-  ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
+  ASSERT(array->map() != HEAP->fixed_cow_array_map());
   ASSERT(index >= 0 && index < array->length());
   ASSERT(!HEAP->InNewSpace(value));
   WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
@@ -2291,8 +2291,8 @@ int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) {
   while (true) {
     Object* element = KeyAt(entry);
     // Empty entry.
-    if (element == isolate->heap()->raw_unchecked_undefined_value()) break;
-    if (element != isolate->heap()->raw_unchecked_the_hole_value() &&
+    if (element == isolate->heap()->undefined_value()) break;
+    if (element != isolate->heap()->the_hole_value() &&
         Shape::IsMatch(key, element)) return entry;
     entry = NextProbe(entry, count++, capacity);
   }
@@ -5252,8 +5252,8 @@ void Map::ClearCodeCache(Heap* heap) {
   // Please note this function is used during marking:
   //  - MarkCompactCollector::MarkUnmarkedObject
   //  - IncrementalMarking::Step
-  ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array()));
- WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array());
+  ASSERT(!heap->InNewSpace(heap->empty_fixed_array()));
+  WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array());
 }


@@ -5347,7 +5347,7 @@ Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) {


 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) {
-  return heap->raw_unchecked_the_hole_value();
+  return heap->the_hole_value();
 }


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 792b6d9843e6166799278518f99c4adde22c61b7..906f7feef6bb30f5bf9f3787e568f1b7f9405a30 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8105,7 +8105,7 @@ void SharedFunctionInfo::DetachInitialMap() {
   // constructor is called. The countdown will continue and (possibly after
// several more GCs) CompleteInobjectSlackTracking will eventually be called.
   Heap* heap = map->GetHeap();
-  set_initial_map(heap->raw_unchecked_undefined_value());
+  set_initial_map(heap->undefined_value());
   Builtins* builtins = heap->isolate()->builtins();
   ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubCountdown),
             *RawField(this, kConstructStubOffset));
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index b853f33cb19aa2a15405cbdca4f76fdf3d25382b..9839edf7e24fb56b713e02d8c85f3889a7a920b2 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -2443,19 +2443,17 @@ bool V8HeapExplorer::IterateAndExtractReferences(


 bool V8HeapExplorer::IsEssentialObject(Object* object) {
-  // We have to use raw_unchecked_* versions because checked versions
-  // would fail during iteration over object properties.
   return object->IsHeapObject()
       && !object->IsOddball()
-      && object != heap_->raw_unchecked_empty_byte_array()
-      && object != heap_->raw_unchecked_empty_fixed_array()
-      && object != heap_->raw_unchecked_empty_descriptor_array()
-      && object != heap_->raw_unchecked_fixed_array_map()
-      && object != heap_->raw_unchecked_global_property_cell_map()
-      && object != heap_->raw_unchecked_shared_function_info_map()
-      && object != heap_->raw_unchecked_free_space_map()
-      && object != heap_->raw_unchecked_one_pointer_filler_map()
-      && object != heap_->raw_unchecked_two_pointer_filler_map();
+      && object != heap_->empty_byte_array()
+      && object != heap_->empty_fixed_array()
+      && object != heap_->empty_descriptor_array()
+      && object != heap_->fixed_array_map()
+      && object != heap_->global_property_cell_map()
+      && object != heap_->shared_function_info_map()
+      && object != heap_->free_space_map()
+      && object != heap_->one_pointer_filler_map()
+      && object != heap_->two_pointer_filler_map();
 }


Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index 2ea09f89c33eba6ba8775bc0394086deeabe2f93..b1aa0edad43e894698ebfcaf2077ed905b6b9c2b 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -1297,7 +1297,7 @@ void PartialSerializer::SerializeObject(
     // The code-caches link to context-specific code objects, which
     // the startup and context serializes cannot currently handle.
     ASSERT(Map::cast(heap_object)->code_cache() ==
-           heap_object->GetHeap()->raw_unchecked_empty_fixed_array());
+           heap_object->GetHeap()->empty_fixed_array());
   }

   int root_index;
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 411914719ccccb13261fbda9b581e8c76d10a45b..5eb0cbaa1cb7158b182a241130de7081a082fd51 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -747,10 +747,8 @@ Code* StubCache::FindCallInitialize(int argc,
CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT);
   Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
-
-  // Use raw_unchecked... so we don't get assert failures during GC.
   UnseededNumberDictionary* dictionary =
-      isolate()->heap()->raw_unchecked_non_monomorphic_cache();
+      isolate()->heap()->non_monomorphic_cache();
   int entry = dictionary->FindEntry(isolate(), flags);
   ASSERT(entry != -1);
   Object* code = dictionary->ValueAt(entry);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to