Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 5bbba49381b35968cdfe1bb4f29c7bcdbfef901a..7a5d65de028974f1ba15eb01cf3c7d6b51a396a7 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -3277,14 +3277,20 @@ MaybeObject* NormalizedMapCache::Get(JSObject* obj, |
Map::cast(result)->SharedMapVerify(); |
} |
if (FLAG_enable_slow_asserts) { |
- // The cached map should match newly created normalized map bit-by-bit. |
+ // The cached map should match newly created normalized map bit-by-bit, |
+ // except for the code cache, which can contain some ics which can be |
+ // applied to the shared map. |
Object* fresh; |
{ MaybeObject* maybe_fresh = |
fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); |
if (maybe_fresh->ToObject(&fresh)) { |
ASSERT(memcmp(Map::cast(fresh)->address(), |
Map::cast(result)->address(), |
- Map::kSize) == 0); |
+ Map::kCodeCacheOffset) == 0); |
+ int offset = Map::kCodeCacheOffset + kPointerSize; |
+ ASSERT(memcmp(Map::cast(fresh)->address() + offset, |
+ Map::cast(result)->address() + offset, |
+ Map::kSize - offset) == 0); |
} |
} |
} |
@@ -5015,6 +5021,7 @@ MaybeObject* Map::CopyNormalized(PropertyNormalizationMode mode, |
Map::cast(result)->set_bit_field(bit_field()); |
Map::cast(result)->set_bit_field2(bit_field2()); |
Map::cast(result)->set_bit_field3(bit_field3()); |
+ Map::cast(result)->set_code_cache(code_cache()); |
Map::cast(result)->set_is_shared(sharing == SHARED_NORMALIZED_MAP); |
@@ -5052,6 +5059,8 @@ void Map::UpdateCodeCache(Handle<Map> map, |
} |
MaybeObject* Map::UpdateCodeCache(String* name, Code* code) { |
+ ASSERT(!is_shared() || code->allowed_in_shared_map_code_cache()); |
+ |
// Allocate the code cache if not present. |
if (code_cache()->IsFixedArray()) { |
Object* result; |
@@ -8378,6 +8387,11 @@ void Code::ClearTypeFeedbackCells(Heap* heap) { |
} |
+bool Code::allowed_in_shared_map_code_cache() { |
+ return is_keyed_load_stub() || is_keyed_store_stub(); |
+} |
+ |
+ |
#ifdef ENABLE_DISASSEMBLER |
void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |