OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 Map* fast = obj->map(); | 3270 Map* fast = obj->map(); |
3271 int index = fast->Hash() % kEntries; | 3271 int index = fast->Hash() % kEntries; |
3272 Object* result = get(index); | 3272 Object* result = get(index); |
3273 if (result->IsMap() && | 3273 if (result->IsMap() && |
3274 Map::cast(result)->EquivalentToForNormalization(fast, mode)) { | 3274 Map::cast(result)->EquivalentToForNormalization(fast, mode)) { |
3275 #ifdef DEBUG | 3275 #ifdef DEBUG |
3276 if (FLAG_verify_heap) { | 3276 if (FLAG_verify_heap) { |
3277 Map::cast(result)->SharedMapVerify(); | 3277 Map::cast(result)->SharedMapVerify(); |
3278 } | 3278 } |
3279 if (FLAG_enable_slow_asserts) { | 3279 if (FLAG_enable_slow_asserts) { |
3280 // The cached map should match newly created normalized map bit-by-bit. | 3280 // The cached map should match newly created normalized map bit-by-bit, |
| 3281 // except for the code cache, which can contain some ics which can be |
| 3282 // applied to the shared map. |
3281 Object* fresh; | 3283 Object* fresh; |
3282 { MaybeObject* maybe_fresh = | 3284 { MaybeObject* maybe_fresh = |
3283 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); | 3285 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); |
3284 if (maybe_fresh->ToObject(&fresh)) { | 3286 if (maybe_fresh->ToObject(&fresh)) { |
3285 ASSERT(memcmp(Map::cast(fresh)->address(), | 3287 ASSERT(memcmp(Map::cast(fresh)->address(), |
3286 Map::cast(result)->address(), | 3288 Map::cast(result)->address(), |
3287 Map::kSize) == 0); | 3289 Map::kCodeCacheOffset) == 0); |
| 3290 int offset = Map::kCodeCacheOffset + kPointerSize; |
| 3291 ASSERT(memcmp(Map::cast(fresh)->address() + offset, |
| 3292 Map::cast(result)->address() + offset, |
| 3293 Map::kSize - offset) == 0); |
3288 } | 3294 } |
3289 } | 3295 } |
3290 } | 3296 } |
3291 #endif | 3297 #endif |
3292 return result; | 3298 return result; |
3293 } | 3299 } |
3294 | 3300 |
3295 { MaybeObject* maybe_result = | 3301 { MaybeObject* maybe_result = |
3296 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); | 3302 fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); |
3297 if (!maybe_result->ToObject(&result)) return maybe_result; | 3303 if (!maybe_result->ToObject(&result)) return maybe_result; |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5008 if (mode != CLEAR_INOBJECT_PROPERTIES) { | 5014 if (mode != CLEAR_INOBJECT_PROPERTIES) { |
5009 Map::cast(result)->set_inobject_properties(inobject_properties()); | 5015 Map::cast(result)->set_inobject_properties(inobject_properties()); |
5010 } | 5016 } |
5011 | 5017 |
5012 Map::cast(result)->set_prototype(prototype()); | 5018 Map::cast(result)->set_prototype(prototype()); |
5013 Map::cast(result)->set_constructor(constructor()); | 5019 Map::cast(result)->set_constructor(constructor()); |
5014 | 5020 |
5015 Map::cast(result)->set_bit_field(bit_field()); | 5021 Map::cast(result)->set_bit_field(bit_field()); |
5016 Map::cast(result)->set_bit_field2(bit_field2()); | 5022 Map::cast(result)->set_bit_field2(bit_field2()); |
5017 Map::cast(result)->set_bit_field3(bit_field3()); | 5023 Map::cast(result)->set_bit_field3(bit_field3()); |
| 5024 Map::cast(result)->set_code_cache(code_cache()); |
5018 | 5025 |
5019 Map::cast(result)->set_is_shared(sharing == SHARED_NORMALIZED_MAP); | 5026 Map::cast(result)->set_is_shared(sharing == SHARED_NORMALIZED_MAP); |
5020 | 5027 |
5021 #ifdef DEBUG | 5028 #ifdef DEBUG |
5022 if (FLAG_verify_heap && Map::cast(result)->is_shared()) { | 5029 if (FLAG_verify_heap && Map::cast(result)->is_shared()) { |
5023 Map::cast(result)->SharedMapVerify(); | 5030 Map::cast(result)->SharedMapVerify(); |
5024 } | 5031 } |
5025 #endif | 5032 #endif |
5026 | 5033 |
5027 return result; | 5034 return result; |
(...skipping 17 matching lines...) Expand all Loading... |
5045 | 5052 |
5046 void Map::UpdateCodeCache(Handle<Map> map, | 5053 void Map::UpdateCodeCache(Handle<Map> map, |
5047 Handle<String> name, | 5054 Handle<String> name, |
5048 Handle<Code> code) { | 5055 Handle<Code> code) { |
5049 Isolate* isolate = map->GetIsolate(); | 5056 Isolate* isolate = map->GetIsolate(); |
5050 CALL_HEAP_FUNCTION_VOID(isolate, | 5057 CALL_HEAP_FUNCTION_VOID(isolate, |
5051 map->UpdateCodeCache(*name, *code)); | 5058 map->UpdateCodeCache(*name, *code)); |
5052 } | 5059 } |
5053 | 5060 |
5054 MaybeObject* Map::UpdateCodeCache(String* name, Code* code) { | 5061 MaybeObject* Map::UpdateCodeCache(String* name, Code* code) { |
| 5062 ASSERT(!is_shared() || code->allowed_in_shared_map_code_cache()); |
| 5063 |
5055 // Allocate the code cache if not present. | 5064 // Allocate the code cache if not present. |
5056 if (code_cache()->IsFixedArray()) { | 5065 if (code_cache()->IsFixedArray()) { |
5057 Object* result; | 5066 Object* result; |
5058 { MaybeObject* maybe_result = GetHeap()->AllocateCodeCache(); | 5067 { MaybeObject* maybe_result = GetHeap()->AllocateCodeCache(); |
5059 if (!maybe_result->ToObject(&result)) return maybe_result; | 5068 if (!maybe_result->ToObject(&result)) return maybe_result; |
5060 } | 5069 } |
5061 set_code_cache(result); | 5070 set_code_cache(result); |
5062 } | 5071 } |
5063 | 5072 |
5064 // Update the code cache. | 5073 // Update the code cache. |
(...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8371 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells(); | 8380 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells(); |
8372 for (int i = 0; i < type_feedback_cells->CellCount(); i++) { | 8381 for (int i = 0; i < type_feedback_cells->CellCount(); i++) { |
8373 ASSERT(type_feedback_cells->AstId(i)->IsSmi()); | 8382 ASSERT(type_feedback_cells->AstId(i)->IsSmi()); |
8374 JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i); | 8383 JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i); |
8375 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap)); | 8384 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap)); |
8376 } | 8385 } |
8377 } | 8386 } |
8378 } | 8387 } |
8379 | 8388 |
8380 | 8389 |
| 8390 bool Code::allowed_in_shared_map_code_cache() { |
| 8391 return is_keyed_load_stub() || is_keyed_store_stub(); |
| 8392 } |
| 8393 |
| 8394 |
8381 #ifdef ENABLE_DISASSEMBLER | 8395 #ifdef ENABLE_DISASSEMBLER |
8382 | 8396 |
8383 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { | 8397 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |
8384 disasm::NameConverter converter; | 8398 disasm::NameConverter converter; |
8385 int deopt_count = DeoptCount(); | 8399 int deopt_count = DeoptCount(); |
8386 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); | 8400 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); |
8387 if (0 == deopt_count) return; | 8401 if (0 == deopt_count) return; |
8388 | 8402 |
8389 PrintF(out, "%6s %6s %6s %6s %12s\n", "index", "ast id", "argc", "pc", | 8403 PrintF(out, "%6s %6s %6s %6s %12s\n", "index", "ast id", "argc", "pc", |
8390 FLAG_print_code_verbose ? "commands" : ""); | 8404 FLAG_print_code_verbose ? "commands" : ""); |
(...skipping 4897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13288 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13302 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13289 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13303 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13290 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13304 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13291 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13305 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13292 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13306 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13293 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13307 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13294 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13308 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13295 } | 13309 } |
13296 | 13310 |
13297 } } // namespace v8::internal | 13311 } } // namespace v8::internal |
OLD | NEW |