| 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 } | |
| 4462 Map::UpdateCodeCache(map, name, code); | 4452 Map::UpdateCodeCache(map, name, code); |
| 4463 } | 4453 } |
| 4464 | 4454 |
| 4465 | 4455 |
| 4466 void JSObject::NormalizeProperties(Handle<JSObject> object, | 4456 void JSObject::NormalizeProperties(Handle<JSObject> object, |
| 4467 PropertyNormalizationMode mode, | 4457 PropertyNormalizationMode mode, |
| 4468 int expected_additional_properties) { | 4458 int expected_additional_properties) { |
| 4469 if (!object->HasFastProperties()) return; | 4459 if (!object->HasFastProperties()) return; |
| 4470 | 4460 |
| 4471 // The global object is always normalized. | 4461 // The global object is always normalized. |
| (...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6950 void Map::UpdateCodeCache(Handle<Map> map, | 6940 void Map::UpdateCodeCache(Handle<Map> map, |
| 6951 Handle<Name> name, | 6941 Handle<Name> name, |
| 6952 Handle<Code> code) { | 6942 Handle<Code> code) { |
| 6953 Isolate* isolate = map->GetIsolate(); | 6943 Isolate* isolate = map->GetIsolate(); |
| 6954 CALL_HEAP_FUNCTION_VOID(isolate, | 6944 CALL_HEAP_FUNCTION_VOID(isolate, |
| 6955 map->UpdateCodeCache(*name, *code)); | 6945 map->UpdateCodeCache(*name, *code)); |
| 6956 } | 6946 } |
| 6957 | 6947 |
| 6958 | 6948 |
| 6959 MaybeObject* Map::UpdateCodeCache(Name* name, Code* code) { | 6949 MaybeObject* Map::UpdateCodeCache(Name* name, Code* code) { |
| 6960 ASSERT(!is_shared() || code->allowed_in_shared_map_code_cache()); | |
| 6961 | |
| 6962 // Allocate the code cache if not present. | 6950 // Allocate the code cache if not present. |
| 6963 if (code_cache()->IsFixedArray()) { | 6951 if (code_cache()->IsFixedArray()) { |
| 6964 Object* result; | 6952 Object* result; |
| 6965 { MaybeObject* maybe_result = GetHeap()->AllocateCodeCache(); | 6953 { MaybeObject* maybe_result = GetHeap()->AllocateCodeCache(); |
| 6966 if (!maybe_result->ToObject(&result)) return maybe_result; | 6954 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 6967 } | 6955 } |
| 6968 set_code_cache(result); | 6956 set_code_cache(result); |
| 6969 } | 6957 } |
| 6970 | 6958 |
| 6971 // Update the code cache. | 6959 // Update the code cache. |
| (...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10394 DisallowHeapAllocation no_gc; | 10382 DisallowHeapAllocation no_gc; |
| 10395 ASSERT(kind() == FUNCTION); | 10383 ASSERT(kind() == FUNCTION); |
| 10396 BackEdgeTable back_edges(this, &no_gc); | 10384 BackEdgeTable back_edges(this, &no_gc); |
| 10397 for (uint32_t i = 0; i < back_edges.length(); i++) { | 10385 for (uint32_t i = 0; i < back_edges.length(); i++) { |
| 10398 if (back_edges.pc_offset(i) == pc_offset) return back_edges.ast_id(i); | 10386 if (back_edges.pc_offset(i) == pc_offset) return back_edges.ast_id(i); |
| 10399 } | 10387 } |
| 10400 return BailoutId::None(); | 10388 return BailoutId::None(); |
| 10401 } | 10389 } |
| 10402 | 10390 |
| 10403 | 10391 |
| 10404 bool Code::allowed_in_shared_map_code_cache() { | |
| 10405 return is_keyed_load_stub() || is_keyed_store_stub() || | |
| 10406 (is_compare_ic_stub() && | |
| 10407 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); | |
| 10408 } | |
| 10409 | |
| 10410 | |
| 10411 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { | 10392 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { |
| 10412 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY); | 10393 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY); |
| 10413 } | 10394 } |
| 10414 | 10395 |
| 10415 | 10396 |
| 10416 void Code::MakeOlder(MarkingParity current_parity) { | 10397 void Code::MakeOlder(MarkingParity current_parity) { |
| 10417 byte* sequence = FindCodeAgeSequence(); | 10398 byte* sequence = FindCodeAgeSequence(); |
| 10418 if (sequence != NULL) { | 10399 if (sequence != NULL) { |
| 10419 Age age; | 10400 Age age; |
| 10420 MarkingParity code_parity; | 10401 MarkingParity code_parity; |
| (...skipping 5702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16123 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16104 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16124 static const char* error_messages_[] = { | 16105 static const char* error_messages_[] = { |
| 16125 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16106 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16126 }; | 16107 }; |
| 16127 #undef ERROR_MESSAGES_TEXTS | 16108 #undef ERROR_MESSAGES_TEXTS |
| 16128 return error_messages_[reason]; | 16109 return error_messages_[reason]; |
| 16129 } | 16110 } |
| 16130 | 16111 |
| 16131 | 16112 |
| 16132 } } // namespace v8::internal | 16113 } } // namespace v8::internal |
| OLD | NEW |