Revision: 23048
Author:   [email protected]
Date:     Mon Aug 11 14:54:15 2014 UTC
Log:      Change the type of the cache so we can check whether it is there

BUG=
[email protected]

Review URL: https://codereview.chromium.org/457333003
http://code.google.com/p/v8/source/detail?r=23048

Modified:
 /branches/bleeding_edge/src/contexts.h
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/contexts.h      Wed Aug  6 15:50:40 2014 UTC
+++ /branches/bleeding_edge/src/contexts.h      Mon Aug 11 14:54:15 2014 UTC
@@ -160,7 +160,7 @@
V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ - V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \ + V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \ V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \
=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Aug 11 14:04:37 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Mon Aug 11 14:54:15 2014 UTC
@@ -4441,8 +4441,6 @@

 MaybeHandle<Map> NormalizedMapCache::Get(Handle<Map> fast_map,
                                          PropertyNormalizationMode mode) {
-  // Only use the cache once it is initialized.
-  if (!IsNormalizedMapCache(this)) return MaybeHandle<Map>();
   DisallowHeapAllocation no_gc;
   Object* value = FixedArray::get(GetIndex(fast_map));
   if (!value->IsMap() ||
@@ -4455,8 +4453,6 @@

 void NormalizedMapCache::Set(Handle<Map> fast_map,
                              Handle<Map> normalized_map) {
-  // Only use the cache once it is initialized.
-  if (!IsNormalizedMapCache(this)) return;
   DisallowHeapAllocation no_gc;
   DCHECK(normalized_map->is_dictionary_map());
   FixedArray::set(GetIndex(fast_map), *normalized_map);
@@ -6980,11 +6976,14 @@
   DCHECK(!fast_map->is_dictionary_map());

   Isolate* isolate = fast_map->GetIsolate();
-  Handle<NormalizedMapCache> cache(
-      isolate->context()->native_context()->normalized_map_cache());
+ Handle<Object> maybe_cache(isolate->native_context()->normalized_map_cache(),
+                             isolate);
+  bool use_cache = !maybe_cache->IsUndefined();
+  Handle<NormalizedMapCache> cache;
+  if (use_cache) cache = Handle<NormalizedMapCache>::cast(maybe_cache);

   Handle<Map> new_map;
-  if (cache->Get(fast_map, mode).ToHandle(&new_map)) {
+  if (use_cache && cache->Get(fast_map, mode).ToHandle(&new_map)) {
 #ifdef VERIFY_HEAP
     if (FLAG_verify_heap) new_map->DictionaryMapVerify();
 #endif
@@ -7008,8 +7007,10 @@
 #endif
   } else {
     new_map = Map::CopyNormalized(fast_map, mode);
-    cache->Set(fast_map, new_map);
-    isolate->counters()->normalized_maps()->Increment();
+    if (use_cache) {
+      cache->Set(fast_map, new_map);
+      isolate->counters()->normalized_maps()->Increment();
+    }
   }
   fast_map->NotifyLeafMapLayoutChange();
   return new_map;

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