OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4442 for (int i = 0; i != entries; i++) { | 4442 for (int i = 0; i != entries; i++) { |
4443 set_undefined(i); | 4443 set_undefined(i); |
4444 } | 4444 } |
4445 } | 4445 } |
4446 | 4446 |
4447 | 4447 |
4448 void HeapObject::UpdateMapCodeCache(Handle<HeapObject> object, | 4448 void HeapObject::UpdateMapCodeCache(Handle<HeapObject> object, |
4449 Handle<Name> name, | 4449 Handle<Name> name, |
4450 Handle<Code> code) { | 4450 Handle<Code> code) { |
4451 Handle<Map> map(object->map()); | 4451 Handle<Map> map(object->map()); |
| 4452 if (map->is_shared()) { |
| 4453 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 4454 // Fast case maps are never marked as shared. |
| 4455 ASSERT(!receiver->HasFastProperties()); |
| 4456 // Replace the map with an identical copy that can be safely modified. |
| 4457 map = Map::CopyNormalized(map, KEEP_INOBJECT_PROPERTIES, |
| 4458 UNIQUE_NORMALIZED_MAP); |
| 4459 receiver->GetIsolate()->counters()->normalized_maps()->Increment(); |
| 4460 receiver->set_map(*map); |
| 4461 } |
4452 Map::UpdateCodeCache(map, name, code); | 4462 Map::UpdateCodeCache(map, name, code); |
4453 } | 4463 } |
4454 | 4464 |
4455 | 4465 |
4456 void JSObject::NormalizeProperties(Handle<JSObject> object, | 4466 void JSObject::NormalizeProperties(Handle<JSObject> object, |
4457 PropertyNormalizationMode mode, | 4467 PropertyNormalizationMode mode, |
4458 int expected_additional_properties) { | 4468 int expected_additional_properties) { |
4459 if (!object->HasFastProperties()) return; | 4469 if (!object->HasFastProperties()) return; |
4460 | 4470 |
4461 // The global object is always normalized. | 4471 // The global object is always normalized. |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7006 void Map::UpdateCodeCache(Handle<Map> map, | 7016 void Map::UpdateCodeCache(Handle<Map> map, |
7007 Handle<Name> name, | 7017 Handle<Name> name, |
7008 Handle<Code> code) { | 7018 Handle<Code> code) { |
7009 Isolate* isolate = map->GetIsolate(); | 7019 Isolate* isolate = map->GetIsolate(); |
7010 CALL_HEAP_FUNCTION_VOID(isolate, | 7020 CALL_HEAP_FUNCTION_VOID(isolate, |
7011 map->UpdateCodeCache(*name, *code)); | 7021 map->UpdateCodeCache(*name, *code)); |
7012 } | 7022 } |
7013 | 7023 |
7014 | 7024 |
7015 MaybeObject* Map::UpdateCodeCache(Name* name, Code* code) { | 7025 MaybeObject* Map::UpdateCodeCache(Name* name, Code* code) { |
| 7026 ASSERT(!is_shared() || code->allowed_in_shared_map_code_cache()); |
| 7027 |
7016 // Allocate the code cache if not present. | 7028 // Allocate the code cache if not present. |
7017 if (code_cache()->IsFixedArray()) { | 7029 if (code_cache()->IsFixedArray()) { |
7018 Object* result; | 7030 Object* result; |
7019 { MaybeObject* maybe_result = GetHeap()->AllocateCodeCache(); | 7031 { MaybeObject* maybe_result = GetHeap()->AllocateCodeCache(); |
7020 if (!maybe_result->ToObject(&result)) return maybe_result; | 7032 if (!maybe_result->ToObject(&result)) return maybe_result; |
7021 } | 7033 } |
7022 set_code_cache(result); | 7034 set_code_cache(result); |
7023 } | 7035 } |
7024 | 7036 |
7025 // Update the code cache. | 7037 // Update the code cache. |
(...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10448 DisallowHeapAllocation no_gc; | 10460 DisallowHeapAllocation no_gc; |
10449 ASSERT(kind() == FUNCTION); | 10461 ASSERT(kind() == FUNCTION); |
10450 BackEdgeTable back_edges(this, &no_gc); | 10462 BackEdgeTable back_edges(this, &no_gc); |
10451 for (uint32_t i = 0; i < back_edges.length(); i++) { | 10463 for (uint32_t i = 0; i < back_edges.length(); i++) { |
10452 if (back_edges.pc_offset(i) == pc_offset) return back_edges.ast_id(i); | 10464 if (back_edges.pc_offset(i) == pc_offset) return back_edges.ast_id(i); |
10453 } | 10465 } |
10454 return BailoutId::None(); | 10466 return BailoutId::None(); |
10455 } | 10467 } |
10456 | 10468 |
10457 | 10469 |
| 10470 bool Code::allowed_in_shared_map_code_cache() { |
| 10471 return is_keyed_load_stub() || is_keyed_store_stub() || |
| 10472 (is_compare_ic_stub() && |
| 10473 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); |
| 10474 } |
| 10475 |
| 10476 |
10458 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { | 10477 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { |
10459 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY); | 10478 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY); |
10460 } | 10479 } |
10461 | 10480 |
10462 | 10481 |
10463 void Code::MakeOlder(MarkingParity current_parity) { | 10482 void Code::MakeOlder(MarkingParity current_parity) { |
10464 byte* sequence = FindCodeAgeSequence(); | 10483 byte* sequence = FindCodeAgeSequence(); |
10465 if (sequence != NULL) { | 10484 if (sequence != NULL) { |
10466 Age age; | 10485 Age age; |
10467 MarkingParity code_parity; | 10486 MarkingParity code_parity; |
(...skipping 5702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16170 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16189 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16171 static const char* error_messages_[] = { | 16190 static const char* error_messages_[] = { |
16172 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16191 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16173 }; | 16192 }; |
16174 #undef ERROR_MESSAGES_TEXTS | 16193 #undef ERROR_MESSAGES_TEXTS |
16175 return error_messages_[reason]; | 16194 return error_messages_[reason]; |
16176 } | 16195 } |
16177 | 16196 |
16178 | 16197 |
16179 } } // namespace v8::internal | 16198 } } // namespace v8::internal |
OLD | NEW |