| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 GetIsolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 623 GetIsolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| 624 return ABSENT; | 624 return ABSENT; |
| 625 } | 625 } |
| 626 | 626 |
| 627 | 627 |
| 628 Object* JSObject::GetNormalizedProperty(LookupResult* result) { | 628 Object* JSObject::GetNormalizedProperty(LookupResult* result) { |
| 629 ASSERT(!HasFastProperties()); | 629 ASSERT(!HasFastProperties()); |
| 630 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); | 630 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); |
| 631 if (IsGlobalObject()) { | 631 if (IsGlobalObject()) { |
| 632 value = JSGlobalPropertyCell::cast(value)->value(); | 632 value = PropertyCell::cast(value)->value(); |
| 633 } | 633 } |
| 634 ASSERT(!value->IsJSGlobalPropertyCell()); | 634 ASSERT(!value->IsPropertyCell() && !value->IsCell()); |
| 635 return value; | 635 return value; |
| 636 } | 636 } |
| 637 | 637 |
| 638 | 638 |
| 639 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) { | 639 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) { |
| 640 ASSERT(!HasFastProperties()); | 640 ASSERT(!HasFastProperties()); |
| 641 if (IsGlobalObject()) { | 641 if (IsGlobalObject()) { |
| 642 JSGlobalPropertyCell* cell = | 642 PropertyCell* cell = PropertyCell::cast( |
| 643 JSGlobalPropertyCell::cast( | 643 property_dictionary()->ValueAt(result->GetDictionaryEntry())); |
| 644 property_dictionary()->ValueAt(result->GetDictionaryEntry())); | |
| 645 cell->set_value(value); | 644 cell->set_value(value); |
| 646 } else { | 645 } else { |
| 647 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); | 646 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); |
| 648 } | 647 } |
| 649 return value; | 648 return value; |
| 650 } | 649 } |
| 651 | 650 |
| 652 | 651 |
| 653 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object, | 652 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object, |
| 654 Handle<Name> key, | 653 Handle<Name> key, |
| 655 Handle<Object> value, | 654 Handle<Object> value, |
| 656 PropertyDetails details) { | 655 PropertyDetails details) { |
| 657 CALL_HEAP_FUNCTION(object->GetIsolate(), | 656 CALL_HEAP_FUNCTION(object->GetIsolate(), |
| 658 object->SetNormalizedProperty(*key, *value, details), | 657 object->SetNormalizedProperty(*key, *value, details), |
| 659 Object); | 658 Object); |
| 660 } | 659 } |
| 661 | 660 |
| 662 | 661 |
| 663 MaybeObject* JSObject::SetNormalizedProperty(Name* name, | 662 MaybeObject* JSObject::SetNormalizedProperty(Name* name, |
| 664 Object* value, | 663 Object* value, |
| 665 PropertyDetails details) { | 664 PropertyDetails details) { |
| 666 ASSERT(!HasFastProperties()); | 665 ASSERT(!HasFastProperties()); |
| 667 int entry = property_dictionary()->FindEntry(name); | 666 int entry = property_dictionary()->FindEntry(name); |
| 668 if (entry == NameDictionary::kNotFound) { | 667 if (entry == NameDictionary::kNotFound) { |
| 669 Object* store_value = value; | 668 Object* store_value = value; |
| 670 if (IsGlobalObject()) { | 669 if (IsGlobalObject()) { |
| 671 Heap* heap = name->GetHeap(); | 670 Heap* heap = name->GetHeap(); |
| 672 MaybeObject* maybe_store_value = | 671 MaybeObject* maybe_store_value = |
| 673 heap->AllocateJSGlobalPropertyCell(value); | 672 heap->AllocatePropertyCell(value); |
| 674 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; | 673 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; |
| 675 } | 674 } |
| 676 Object* dict; | 675 Object* dict; |
| 677 { MaybeObject* maybe_dict = | 676 { MaybeObject* maybe_dict = |
| 678 property_dictionary()->Add(name, store_value, details); | 677 property_dictionary()->Add(name, store_value, details); |
| 679 if (!maybe_dict->ToObject(&dict)) return maybe_dict; | 678 if (!maybe_dict->ToObject(&dict)) return maybe_dict; |
| 680 } | 679 } |
| 681 set_properties(NameDictionary::cast(dict)); | 680 set_properties(NameDictionary::cast(dict)); |
| 682 return value; | 681 return value; |
| 683 } | 682 } |
| 684 | 683 |
| 685 PropertyDetails original_details = property_dictionary()->DetailsAt(entry); | 684 PropertyDetails original_details = property_dictionary()->DetailsAt(entry); |
| 686 int enumeration_index; | 685 int enumeration_index; |
| 687 // Preserve the enumeration index unless the property was deleted. | 686 // Preserve the enumeration index unless the property was deleted. |
| 688 if (original_details.IsDeleted()) { | 687 if (original_details.IsDeleted()) { |
| 689 enumeration_index = property_dictionary()->NextEnumerationIndex(); | 688 enumeration_index = property_dictionary()->NextEnumerationIndex(); |
| 690 property_dictionary()->SetNextEnumerationIndex(enumeration_index + 1); | 689 property_dictionary()->SetNextEnumerationIndex(enumeration_index + 1); |
| 691 } else { | 690 } else { |
| 692 enumeration_index = original_details.dictionary_index(); | 691 enumeration_index = original_details.dictionary_index(); |
| 693 ASSERT(enumeration_index > 0); | 692 ASSERT(enumeration_index > 0); |
| 694 } | 693 } |
| 695 | 694 |
| 696 details = PropertyDetails( | 695 details = PropertyDetails( |
| 697 details.attributes(), details.type(), enumeration_index); | 696 details.attributes(), details.type(), enumeration_index); |
| 698 | 697 |
| 699 if (IsGlobalObject()) { | 698 if (IsGlobalObject()) { |
| 700 JSGlobalPropertyCell* cell = | 699 PropertyCell* cell = |
| 701 JSGlobalPropertyCell::cast(property_dictionary()->ValueAt(entry)); | 700 PropertyCell::cast(property_dictionary()->ValueAt(entry)); |
| 702 cell->set_value(value); | 701 cell->set_value(value); |
| 703 // Please note we have to update the property details. | 702 // Please note we have to update the property details. |
| 704 property_dictionary()->DetailsAtPut(entry, details); | 703 property_dictionary()->DetailsAtPut(entry, details); |
| 705 } else { | 704 } else { |
| 706 property_dictionary()->SetEntry(entry, name, value, details); | 705 property_dictionary()->SetEntry(entry, name, value, details); |
| 707 } | 706 } |
| 708 return value; | 707 return value; |
| 709 } | 708 } |
| 710 | 709 |
| 711 | 710 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 723 // map change to invalidate any ICs that think they can load | 722 // map change to invalidate any ICs that think they can load |
| 724 // from the DontDelete cell without checking if it contains | 723 // from the DontDelete cell without checking if it contains |
| 725 // the hole value. | 724 // the hole value. |
| 726 Map* new_map; | 725 Map* new_map; |
| 727 MaybeObject* maybe_new_map = map()->CopyDropDescriptors(); | 726 MaybeObject* maybe_new_map = map()->CopyDropDescriptors(); |
| 728 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | 727 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
| 729 | 728 |
| 730 ASSERT(new_map->is_dictionary_map()); | 729 ASSERT(new_map->is_dictionary_map()); |
| 731 set_map(new_map); | 730 set_map(new_map); |
| 732 } | 731 } |
| 733 JSGlobalPropertyCell* cell = | 732 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); |
| 734 JSGlobalPropertyCell::cast(dictionary->ValueAt(entry)); | |
| 735 cell->set_value(cell->GetHeap()->the_hole_value()); | 733 cell->set_value(cell->GetHeap()->the_hole_value()); |
| 736 dictionary->DetailsAtPut(entry, details.AsDeleted()); | 734 dictionary->DetailsAtPut(entry, details.AsDeleted()); |
| 737 } else { | 735 } else { |
| 738 Object* deleted = dictionary->DeleteProperty(entry, mode); | 736 Object* deleted = dictionary->DeleteProperty(entry, mode); |
| 739 if (deleted == GetHeap()->true_value()) { | 737 if (deleted == GetHeap()->true_value()) { |
| 740 FixedArray* new_properties = NULL; | 738 FixedArray* new_properties = NULL; |
| 741 MaybeObject* maybe_properties = dictionary->Shrink(name); | 739 MaybeObject* maybe_properties = dictionary->Shrink(name); |
| 742 if (!maybe_properties->To(&new_properties)) { | 740 if (!maybe_properties->To(&new_properties)) { |
| 743 return maybe_properties; | 741 return maybe_properties; |
| 744 } | 742 } |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 Object* constructor_name = | 1376 Object* constructor_name = |
| 1379 JSFunction::cast(constructor)->shared()->name(); | 1377 JSFunction::cast(constructor)->shared()->name(); |
| 1380 if (constructor_name->IsString()) { | 1378 if (constructor_name->IsString()) { |
| 1381 String* str = String::cast(constructor_name); | 1379 String* str = String::cast(constructor_name); |
| 1382 if (str->length() > 0) { | 1380 if (str->length() > 0) { |
| 1383 bool vowel = AnWord(str); | 1381 bool vowel = AnWord(str); |
| 1384 accumulator->Add("<%sa%s ", | 1382 accumulator->Add("<%sa%s ", |
| 1385 global_object ? "Global Object: " : "", | 1383 global_object ? "Global Object: " : "", |
| 1386 vowel ? "n" : ""); | 1384 vowel ? "n" : ""); |
| 1387 accumulator->Put(str); | 1385 accumulator->Put(str); |
| 1388 accumulator->Add(" with %smap 0x%p", | 1386 accumulator->Add(" with %smap %p", |
| 1389 map_of_this->is_deprecated() ? "deprecated " : "", | 1387 map_of_this->is_deprecated() ? "deprecated " : "", |
| 1390 map_of_this); | 1388 map_of_this); |
| 1391 printed = true; | 1389 printed = true; |
| 1392 } | 1390 } |
| 1393 } | 1391 } |
| 1394 } | 1392 } |
| 1395 } | 1393 } |
| 1396 if (!printed) { | 1394 if (!printed) { |
| 1397 accumulator->Add("<JS %sObject", global_object ? "Global " : ""); | 1395 accumulator->Add("<JS %sObject", global_object ? "Global " : ""); |
| 1398 } | 1396 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 break; | 1558 break; |
| 1561 case JS_PROXY_TYPE: | 1559 case JS_PROXY_TYPE: |
| 1562 accumulator->Add("<JSProxy>"); | 1560 accumulator->Add("<JSProxy>"); |
| 1563 break; | 1561 break; |
| 1564 case JS_FUNCTION_PROXY_TYPE: | 1562 case JS_FUNCTION_PROXY_TYPE: |
| 1565 accumulator->Add("<JSFunctionProxy>"); | 1563 accumulator->Add("<JSFunctionProxy>"); |
| 1566 break; | 1564 break; |
| 1567 case FOREIGN_TYPE: | 1565 case FOREIGN_TYPE: |
| 1568 accumulator->Add("<Foreign>"); | 1566 accumulator->Add("<Foreign>"); |
| 1569 break; | 1567 break; |
| 1570 case JS_GLOBAL_PROPERTY_CELL_TYPE: | 1568 case CELL_TYPE: |
| 1571 accumulator->Add("Cell for "); | 1569 accumulator->Add("Cell for "); |
| 1572 JSGlobalPropertyCell::cast(this)->value()->ShortPrint(accumulator); | 1570 Cell::cast(this)->value()->ShortPrint(accumulator); |
| 1571 break; |
| 1572 case PROPERTY_CELL_TYPE: |
| 1573 accumulator->Add("PropertyCell for "); |
| 1574 PropertyCell::cast(this)->value()->ShortPrint(accumulator); |
| 1573 break; | 1575 break; |
| 1574 default: | 1576 default: |
| 1575 accumulator->Add("<Other heap object (%d)>", map()->instance_type()); | 1577 accumulator->Add("<Other heap object (%d)>", map()->instance_type()); |
| 1576 break; | 1578 break; |
| 1577 } | 1579 } |
| 1578 } | 1580 } |
| 1579 | 1581 |
| 1580 | 1582 |
| 1581 void HeapObject::Iterate(ObjectVisitor* v) { | 1583 void HeapObject::Iterate(ObjectVisitor* v) { |
| 1582 // Handle header | 1584 // Handle header |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 break; | 1656 break; |
| 1655 case FOREIGN_TYPE: | 1657 case FOREIGN_TYPE: |
| 1656 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v); | 1658 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v); |
| 1657 break; | 1659 break; |
| 1658 case MAP_TYPE: | 1660 case MAP_TYPE: |
| 1659 Map::BodyDescriptor::IterateBody(this, v); | 1661 Map::BodyDescriptor::IterateBody(this, v); |
| 1660 break; | 1662 break; |
| 1661 case CODE_TYPE: | 1663 case CODE_TYPE: |
| 1662 reinterpret_cast<Code*>(this)->CodeIterateBody(v); | 1664 reinterpret_cast<Code*>(this)->CodeIterateBody(v); |
| 1663 break; | 1665 break; |
| 1664 case JS_GLOBAL_PROPERTY_CELL_TYPE: | 1666 case CELL_TYPE: |
| 1665 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v); | 1667 Cell::BodyDescriptor::IterateBody(this, v); |
| 1668 break; |
| 1669 case PROPERTY_CELL_TYPE: |
| 1670 PropertyCell::BodyDescriptor::IterateBody(this, v); |
| 1666 break; | 1671 break; |
| 1667 case SYMBOL_TYPE: | 1672 case SYMBOL_TYPE: |
| 1668 Symbol::BodyDescriptor::IterateBody(this, v); | 1673 Symbol::BodyDescriptor::IterateBody(this, v); |
| 1669 break; | 1674 break; |
| 1670 case HEAP_NUMBER_TYPE: | 1675 case HEAP_NUMBER_TYPE: |
| 1671 case FILLER_TYPE: | 1676 case FILLER_TYPE: |
| 1672 case BYTE_ARRAY_TYPE: | 1677 case BYTE_ARRAY_TYPE: |
| 1673 case FREE_SPACE_TYPE: | 1678 case FREE_SPACE_TYPE: |
| 1674 case EXTERNAL_PIXEL_ARRAY_TYPE: | 1679 case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 1675 case EXTERNAL_BYTE_ARRAY_TYPE: | 1680 case EXTERNAL_BYTE_ARRAY_TYPE: |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 Object* value, | 1929 Object* value, |
| 1925 PropertyAttributes attributes) { | 1930 PropertyAttributes attributes) { |
| 1926 ASSERT(!HasFastProperties()); | 1931 ASSERT(!HasFastProperties()); |
| 1927 NameDictionary* dict = property_dictionary(); | 1932 NameDictionary* dict = property_dictionary(); |
| 1928 Object* store_value = value; | 1933 Object* store_value = value; |
| 1929 if (IsGlobalObject()) { | 1934 if (IsGlobalObject()) { |
| 1930 // In case name is an orphaned property reuse the cell. | 1935 // In case name is an orphaned property reuse the cell. |
| 1931 int entry = dict->FindEntry(name); | 1936 int entry = dict->FindEntry(name); |
| 1932 if (entry != NameDictionary::kNotFound) { | 1937 if (entry != NameDictionary::kNotFound) { |
| 1933 store_value = dict->ValueAt(entry); | 1938 store_value = dict->ValueAt(entry); |
| 1934 JSGlobalPropertyCell::cast(store_value)->set_value(value); | 1939 PropertyCell::cast(store_value)->set_value(value); |
| 1935 // Assign an enumeration index to the property and update | 1940 // Assign an enumeration index to the property and update |
| 1936 // SetNextEnumerationIndex. | 1941 // SetNextEnumerationIndex. |
| 1937 int index = dict->NextEnumerationIndex(); | 1942 int index = dict->NextEnumerationIndex(); |
| 1938 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); | 1943 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); |
| 1939 dict->SetNextEnumerationIndex(index + 1); | 1944 dict->SetNextEnumerationIndex(index + 1); |
| 1940 dict->SetEntry(entry, name, store_value, details); | 1945 dict->SetEntry(entry, name, store_value, details); |
| 1941 return value; | 1946 return value; |
| 1942 } | 1947 } |
| 1943 Heap* heap = GetHeap(); | 1948 Heap* heap = GetHeap(); |
| 1944 { MaybeObject* maybe_store_value = | 1949 { MaybeObject* maybe_store_value = |
| 1945 heap->AllocateJSGlobalPropertyCell(value); | 1950 heap->AllocatePropertyCell(value); |
| 1946 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; | 1951 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; |
| 1947 } | 1952 } |
| 1948 JSGlobalPropertyCell::cast(store_value)->set_value(value); | 1953 PropertyCell::cast(store_value)->set_value(value); |
| 1949 } | 1954 } |
| 1950 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); | 1955 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); |
| 1951 Object* result; | 1956 Object* result; |
| 1952 { MaybeObject* maybe_result = dict->Add(name, store_value, details); | 1957 { MaybeObject* maybe_result = dict->Add(name, store_value, details); |
| 1953 if (!maybe_result->ToObject(&result)) return maybe_result; | 1958 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 1954 } | 1959 } |
| 1955 if (dict != result) set_properties(NameDictionary::cast(result)); | 1960 if (dict != result) set_properties(NameDictionary::cast(result)); |
| 1956 return value; | 1961 return value; |
| 1957 } | 1962 } |
| 1958 | 1963 |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3260 | 3265 |
| 3261 int entry = property_dictionary()->FindEntry(name); | 3266 int entry = property_dictionary()->FindEntry(name); |
| 3262 if (entry != NameDictionary::kNotFound) { | 3267 if (entry != NameDictionary::kNotFound) { |
| 3263 Object* value = property_dictionary()->ValueAt(entry); | 3268 Object* value = property_dictionary()->ValueAt(entry); |
| 3264 if (IsGlobalObject()) { | 3269 if (IsGlobalObject()) { |
| 3265 PropertyDetails d = property_dictionary()->DetailsAt(entry); | 3270 PropertyDetails d = property_dictionary()->DetailsAt(entry); |
| 3266 if (d.IsDeleted()) { | 3271 if (d.IsDeleted()) { |
| 3267 result->NotFound(); | 3272 result->NotFound(); |
| 3268 return; | 3273 return; |
| 3269 } | 3274 } |
| 3270 value = JSGlobalPropertyCell::cast(value)->value(); | 3275 value = PropertyCell::cast(value)->value(); |
| 3271 } | 3276 } |
| 3272 // Make sure to disallow caching for uninitialized constants | 3277 // Make sure to disallow caching for uninitialized constants |
| 3273 // found in the dictionary-mode objects. | 3278 // found in the dictionary-mode objects. |
| 3274 if (value->IsTheHole()) result->DisallowCaching(); | 3279 if (value->IsTheHole()) result->DisallowCaching(); |
| 3275 result->DictionaryResult(this, entry); | 3280 result->DictionaryResult(this, entry); |
| 3276 return; | 3281 return; |
| 3277 } | 3282 } |
| 3278 | 3283 |
| 3279 result->NotFound(); | 3284 result->NotFound(); |
| 3280 } | 3285 } |
| (...skipping 5617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8898 return info; | 8903 return info; |
| 8899 } | 8904 } |
| 8900 } | 8905 } |
| 8901 } | 8906 } |
| 8902 return NULL; | 8907 return NULL; |
| 8903 } | 8908 } |
| 8904 | 8909 |
| 8905 | 8910 |
| 8906 bool AllocationSiteInfo::GetElementsKindPayload(ElementsKind* kind) { | 8911 bool AllocationSiteInfo::GetElementsKindPayload(ElementsKind* kind) { |
| 8907 ASSERT(kind != NULL); | 8912 ASSERT(kind != NULL); |
| 8908 if (payload()->IsJSGlobalPropertyCell()) { | 8913 if (payload()->IsCell()) { |
| 8909 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(payload()); | 8914 Cell* cell = Cell::cast(payload()); |
| 8910 Object* cell_contents = cell->value(); | 8915 Object* cell_contents = cell->value(); |
| 8911 if (cell_contents->IsSmi()) { | 8916 if (cell_contents->IsSmi()) { |
| 8912 *kind = static_cast<ElementsKind>( | 8917 *kind = static_cast<ElementsKind>( |
| 8913 Smi::cast(cell_contents)->value()); | 8918 Smi::cast(cell_contents)->value()); |
| 8914 return true; | 8919 return true; |
| 8915 } | 8920 } |
| 8916 } | 8921 } |
| 8917 return false; | 8922 return false; |
| 8918 } | 8923 } |
| 8919 | 8924 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9186 code()->optimizable()); | 9191 code()->optimizable()); |
| 9187 set_code_no_write_barrier( | 9192 set_code_no_write_barrier( |
| 9188 GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile)); | 9193 GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile)); |
| 9189 // No write barrier required, since the builtin is part of the root set. | 9194 // No write barrier required, since the builtin is part of the root set. |
| 9190 } | 9195 } |
| 9191 | 9196 |
| 9192 | 9197 |
| 9193 void JSFunction::MarkForParallelRecompilation() { | 9198 void JSFunction::MarkForParallelRecompilation() { |
| 9194 ASSERT(is_compiled() && !IsOptimized()); | 9199 ASSERT(is_compiled() && !IsOptimized()); |
| 9195 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); | 9200 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); |
| 9196 ASSERT(FLAG_parallel_recompilation); | 9201 if (!FLAG_parallel_recompilation) { |
| 9202 JSFunction::MarkForLazyRecompilation(); |
| 9203 return; |
| 9204 } |
| 9197 if (FLAG_trace_parallel_recompilation) { | 9205 if (FLAG_trace_parallel_recompilation) { |
| 9198 PrintF(" ** Marking "); | 9206 PrintF(" ** Marking "); |
| 9199 PrintName(); | 9207 PrintName(); |
| 9200 PrintF(" for parallel recompilation.\n"); | 9208 PrintF(" for parallel recompilation.\n"); |
| 9201 } | 9209 } |
| 9202 set_code_no_write_barrier( | 9210 set_code_no_write_barrier( |
| 9203 GetIsolate()->builtins()->builtin(Builtins::kParallelRecompile)); | 9211 GetIsolate()->builtins()->builtin(Builtins::kParallelRecompile)); |
| 9204 // No write barrier required, since the builtin is part of the root set. | 9212 // No write barrier required, since the builtin is part of the root set. |
| 9205 } | 9213 } |
| 9206 | 9214 |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9973 void ObjectVisitor::VisitCodeEntry(Address entry_address) { | 9981 void ObjectVisitor::VisitCodeEntry(Address entry_address) { |
| 9974 Object* code = Code::GetObjectFromEntryAddress(entry_address); | 9982 Object* code = Code::GetObjectFromEntryAddress(entry_address); |
| 9975 Object* old_code = code; | 9983 Object* old_code = code; |
| 9976 VisitPointer(&code); | 9984 VisitPointer(&code); |
| 9977 if (code != old_code) { | 9985 if (code != old_code) { |
| 9978 Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry(); | 9986 Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry(); |
| 9979 } | 9987 } |
| 9980 } | 9988 } |
| 9981 | 9989 |
| 9982 | 9990 |
| 9983 void ObjectVisitor::VisitGlobalPropertyCell(RelocInfo* rinfo) { | 9991 void ObjectVisitor::VisitCell(RelocInfo* rinfo) { |
| 9984 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL); | 9992 ASSERT(rinfo->rmode() == RelocInfo::CELL); |
| 9985 Object* cell = rinfo->target_cell(); | 9993 Object* cell = rinfo->target_cell(); |
| 9986 Object* old_cell = cell; | 9994 Object* old_cell = cell; |
| 9987 VisitPointer(&cell); | 9995 VisitPointer(&cell); |
| 9988 if (cell != old_cell) { | 9996 if (cell != old_cell) { |
| 9989 rinfo->set_target_cell(reinterpret_cast<JSGlobalPropertyCell*>(cell)); | 9997 rinfo->set_target_cell(reinterpret_cast<Cell*>(cell)); |
| 9990 } | 9998 } |
| 9991 } | 9999 } |
| 9992 | 10000 |
| 9993 | 10001 |
| 9994 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { | 10002 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { |
| 9995 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 10003 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
| 9996 rinfo->IsPatchedReturnSequence()) || | 10004 rinfo->IsPatchedReturnSequence()) || |
| 9997 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 10005 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
| 9998 rinfo->IsPatchedDebugBreakSlotSequence())); | 10006 rinfo->IsPatchedDebugBreakSlotSequence())); |
| 9999 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 10007 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
| 10000 Object* old_target = target; | 10008 Object* old_target = target; |
| 10001 VisitPointer(&target); | 10009 VisitPointer(&target); |
| 10002 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. | 10010 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. |
| 10003 } | 10011 } |
| 10004 | 10012 |
| 10005 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { | 10013 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { |
| 10006 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 10014 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
| 10007 VisitPointer(rinfo->target_object_address()); | 10015 VisitPointer(rinfo->target_object_address()); |
| 10008 } | 10016 } |
| 10009 | 10017 |
| 10010 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { | 10018 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { |
| 10011 Address* p = rinfo->target_reference_address(); | 10019 Address* p = rinfo->target_reference_address(); |
| 10012 VisitExternalReferences(p, p + 1); | 10020 VisitExternalReferences(p, p + 1); |
| 10013 } | 10021 } |
| 10014 | 10022 |
| 10015 byte Code::compare_nil_types() { | 10023 byte Code::compare_nil_state() { |
| 10016 ASSERT(is_compare_nil_ic_stub()); | 10024 ASSERT(is_compare_nil_ic_stub()); |
| 10017 return CompareNilICStub::ExtractTypesFromExtraICState( | 10025 return CompareNilICStub::ExtractTypesFromExtraICState( |
| 10018 extended_extra_ic_state()); | 10026 extended_extra_ic_state()); |
| 10019 } | 10027 } |
| 10020 | 10028 |
| 10021 | 10029 |
| 10022 void Code::InvalidateRelocation() { | 10030 void Code::InvalidateRelocation() { |
| 10023 set_relocation_info(GetHeap()->empty_byte_array()); | 10031 set_relocation_info(GetHeap()->empty_byte_array()); |
| 10024 } | 10032 } |
| 10025 | 10033 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10041 | 10049 |
| 10042 // copy reloc info | 10050 // copy reloc info |
| 10043 CopyBytes(relocation_start(), | 10051 CopyBytes(relocation_start(), |
| 10044 desc.buffer + desc.buffer_size - desc.reloc_size, | 10052 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 10045 static_cast<size_t>(desc.reloc_size)); | 10053 static_cast<size_t>(desc.reloc_size)); |
| 10046 | 10054 |
| 10047 // unbox handles and relocate | 10055 // unbox handles and relocate |
| 10048 intptr_t delta = instruction_start() - desc.buffer; | 10056 intptr_t delta = instruction_start() - desc.buffer; |
| 10049 int mode_mask = RelocInfo::kCodeTargetMask | | 10057 int mode_mask = RelocInfo::kCodeTargetMask | |
| 10050 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 10058 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 10051 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 10059 RelocInfo::ModeMask(RelocInfo::CELL) | |
| 10052 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | | 10060 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
| 10053 RelocInfo::kApplyMask; | 10061 RelocInfo::kApplyMask; |
| 10054 // Needed to find target_object and runtime_entry on X64 | 10062 // Needed to find target_object and runtime_entry on X64 |
| 10055 Assembler* origin = desc.origin; | 10063 Assembler* origin = desc.origin; |
| 10056 AllowDeferredHandleDereference embedding_raw_address; | 10064 AllowDeferredHandleDereference embedding_raw_address; |
| 10057 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 10065 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
| 10058 RelocInfo::Mode mode = it.rinfo()->rmode(); | 10066 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 10059 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 10067 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 10060 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 10068 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 10061 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); | 10069 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); |
| 10062 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 10070 } else if (mode == RelocInfo::CELL) { |
| 10063 Handle<JSGlobalPropertyCell> cell = it.rinfo()->target_cell_handle(); | 10071 Handle<Cell> cell = it.rinfo()->target_cell_handle(); |
| 10064 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); | 10072 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); |
| 10065 } else if (RelocInfo::IsCodeTarget(mode)) { | 10073 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 10066 // rewrite code handles in inline cache targets to direct | 10074 // rewrite code handles in inline cache targets to direct |
| 10067 // pointers to the first instruction in the code object | 10075 // pointers to the first instruction in the code object |
| 10068 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 10076 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 10069 Code* code = Code::cast(*p); | 10077 Code* code = Code::cast(*p); |
| 10070 it.rinfo()->set_target_address(code->instruction_start(), | 10078 it.rinfo()->set_target_address(code->instruction_start(), |
| 10071 SKIP_WRITE_BARRIER); | 10079 SKIP_WRITE_BARRIER); |
| 10072 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 10080 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 10073 Address p = it.rinfo()->target_runtime_entry(origin); | 10081 Address p = it.rinfo()->target_runtime_entry(origin); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10239 } | 10247 } |
| 10240 | 10248 |
| 10241 | 10249 |
| 10242 void Code::ClearTypeFeedbackCells(Heap* heap) { | 10250 void Code::ClearTypeFeedbackCells(Heap* heap) { |
| 10243 if (kind() != FUNCTION) return; | 10251 if (kind() != FUNCTION) return; |
| 10244 Object* raw_info = type_feedback_info(); | 10252 Object* raw_info = type_feedback_info(); |
| 10245 if (raw_info->IsTypeFeedbackInfo()) { | 10253 if (raw_info->IsTypeFeedbackInfo()) { |
| 10246 TypeFeedbackCells* type_feedback_cells = | 10254 TypeFeedbackCells* type_feedback_cells = |
| 10247 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells(); | 10255 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells(); |
| 10248 for (int i = 0; i < type_feedback_cells->CellCount(); i++) { | 10256 for (int i = 0; i < type_feedback_cells->CellCount(); i++) { |
| 10249 JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i); | 10257 Cell* cell = type_feedback_cells->GetCell(i); |
| 10250 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap)); | 10258 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap)); |
| 10251 } | 10259 } |
| 10252 } | 10260 } |
| 10253 } | 10261 } |
| 10254 | 10262 |
| 10255 | 10263 |
| 10256 bool Code::allowed_in_shared_map_code_cache() { | 10264 bool Code::allowed_in_shared_map_code_cache() { |
| 10257 return is_keyed_load_stub() || is_keyed_store_stub() || | 10265 return is_keyed_load_stub() || is_keyed_store_stub() || |
| 10258 (is_compare_ic_stub() && | 10266 (is_compare_ic_stub() && |
| 10259 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); | 10267 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10292 byte* Code::FindCodeAgeSequence() { | 10300 byte* Code::FindCodeAgeSequence() { |
| 10293 return FLAG_age_code && | 10301 return FLAG_age_code && |
| 10294 prologue_offset() != kPrologueOffsetNotSet && | 10302 prologue_offset() != kPrologueOffsetNotSet && |
| 10295 (kind() == OPTIMIZED_FUNCTION || | 10303 (kind() == OPTIMIZED_FUNCTION || |
| 10296 (kind() == FUNCTION && !has_debug_break_slots())) | 10304 (kind() == FUNCTION && !has_debug_break_slots())) |
| 10297 ? instruction_start() + prologue_offset() | 10305 ? instruction_start() + prologue_offset() |
| 10298 : NULL; | 10306 : NULL; |
| 10299 } | 10307 } |
| 10300 | 10308 |
| 10301 | 10309 |
| 10310 int Code::GetAge() { |
| 10311 byte* sequence = FindCodeAgeSequence(); |
| 10312 if (sequence == NULL) { |
| 10313 return Code::kNoAge; |
| 10314 } |
| 10315 Age age; |
| 10316 MarkingParity parity; |
| 10317 GetCodeAgeAndParity(sequence, &age, &parity); |
| 10318 return age; |
| 10319 } |
| 10320 |
| 10321 |
| 10302 void Code::GetCodeAgeAndParity(Code* code, Age* age, | 10322 void Code::GetCodeAgeAndParity(Code* code, Age* age, |
| 10303 MarkingParity* parity) { | 10323 MarkingParity* parity) { |
| 10304 Isolate* isolate = Isolate::Current(); | 10324 Isolate* isolate = Isolate::Current(); |
| 10305 Builtins* builtins = isolate->builtins(); | 10325 Builtins* builtins = isolate->builtins(); |
| 10306 Code* stub = NULL; | 10326 Code* stub = NULL; |
| 10307 #define HANDLE_CODE_AGE(AGE) \ | 10327 #define HANDLE_CODE_AGE(AGE) \ |
| 10308 stub = *builtins->Make##AGE##CodeYoungAgainEvenMarking(); \ | 10328 stub = *builtins->Make##AGE##CodeYoungAgainEvenMarking(); \ |
| 10309 if (code == stub) { \ | 10329 if (code == stub) { \ |
| 10310 *age = k##AGE##CodeAge; \ | 10330 *age = k##AGE##CodeAge; \ |
| 10311 *parity = EVEN_MARKING_PARITY; \ | 10331 *parity = EVEN_MARKING_PARITY; \ |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10531 break; | 10551 break; |
| 10532 } | 10552 } |
| 10533 | 10553 |
| 10534 case Translation::LITERAL: { | 10554 case Translation::LITERAL: { |
| 10535 unsigned literal_index = iterator.Next(); | 10555 unsigned literal_index = iterator.Next(); |
| 10536 PrintF(out, "{literal_id=%u}", literal_index); | 10556 PrintF(out, "{literal_id=%u}", literal_index); |
| 10537 break; | 10557 break; |
| 10538 } | 10558 } |
| 10539 | 10559 |
| 10540 case Translation::ARGUMENTS_OBJECT: { | 10560 case Translation::ARGUMENTS_OBJECT: { |
| 10541 bool args_known = iterator.Next(); | |
| 10542 int args_index = iterator.Next(); | |
| 10543 int args_length = iterator.Next(); | 10561 int args_length = iterator.Next(); |
| 10544 PrintF(out, "{index=%d, length=%d, known=%d}", | 10562 PrintF(out, "{length=%d}", args_length); |
| 10545 args_index, args_length, args_known); | |
| 10546 break; | 10563 break; |
| 10547 } | 10564 } |
| 10548 } | 10565 } |
| 10549 PrintF(out, "\n"); | 10566 PrintF(out, "\n"); |
| 10550 } | 10567 } |
| 10551 } | 10568 } |
| 10552 } | 10569 } |
| 10553 | 10570 |
| 10554 | 10571 |
| 10555 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(FILE* out) { | 10572 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(FILE* out) { |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12036 } | 12053 } |
| 12037 | 12054 |
| 12038 | 12055 |
| 12039 Handle<Object> JSObject::SetElement(Handle<JSObject> object, | 12056 Handle<Object> JSObject::SetElement(Handle<JSObject> object, |
| 12040 uint32_t index, | 12057 uint32_t index, |
| 12041 Handle<Object> value, | 12058 Handle<Object> value, |
| 12042 PropertyAttributes attr, | 12059 PropertyAttributes attr, |
| 12043 StrictModeFlag strict_mode, | 12060 StrictModeFlag strict_mode, |
| 12044 SetPropertyMode set_mode) { | 12061 SetPropertyMode set_mode) { |
| 12045 if (object->HasExternalArrayElements()) { | 12062 if (object->HasExternalArrayElements()) { |
| 12046 if (!value->IsSmi() && !value->IsHeapNumber() && !value->IsUndefined()) { | 12063 if (!value->IsNumber() && !value->IsUndefined()) { |
| 12047 bool has_exception; | 12064 bool has_exception; |
| 12048 Handle<Object> number = Execution::ToNumber(value, &has_exception); | 12065 Handle<Object> number = Execution::ToNumber(value, &has_exception); |
| 12049 if (has_exception) return Handle<Object>(); | 12066 if (has_exception) return Handle<Object>(); |
| 12050 value = number; | 12067 value = number; |
| 12051 } | 12068 } |
| 12052 } | 12069 } |
| 12053 CALL_HEAP_FUNCTION( | 12070 CALL_HEAP_FUNCTION( |
| 12054 object->GetIsolate(), | 12071 object->GetIsolate(), |
| 12055 object->SetElement(index, *value, attr, strict_mode, true, set_mode), | 12072 object->SetElement(index, *value, attr, strict_mode, true, set_mode), |
| 12056 Object); | 12073 Object); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12314 if (FLAG_trace_track_allocation_sites) { | 12331 if (FLAG_trace_track_allocation_sites) { |
| 12315 PrintF( | 12332 PrintF( |
| 12316 "AllocationSiteInfo: JSArray %p boilerplate updated %s->%s\n", | 12333 "AllocationSiteInfo: JSArray %p boilerplate updated %s->%s\n", |
| 12317 reinterpret_cast<void*>(this), | 12334 reinterpret_cast<void*>(this), |
| 12318 ElementsKindToString(kind), | 12335 ElementsKindToString(kind), |
| 12319 ElementsKindToString(to_kind)); | 12336 ElementsKindToString(to_kind)); |
| 12320 } | 12337 } |
| 12321 return payload->TransitionElementsKind(to_kind); | 12338 return payload->TransitionElementsKind(to_kind); |
| 12322 } | 12339 } |
| 12323 } | 12340 } |
| 12324 } else if (info->payload()->IsJSGlobalPropertyCell()) { | 12341 } else if (info->payload()->IsCell()) { |
| 12325 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(info->payload()); | 12342 Cell* cell = Cell::cast(info->payload()); |
| 12326 Object* cell_contents = cell->value(); | 12343 Object* cell_contents = cell->value(); |
| 12327 if (cell_contents->IsSmi()) { | 12344 if (cell_contents->IsSmi()) { |
| 12328 ElementsKind kind = static_cast<ElementsKind>( | 12345 ElementsKind kind = static_cast<ElementsKind>( |
| 12329 Smi::cast(cell_contents)->value()); | 12346 Smi::cast(cell_contents)->value()); |
| 12330 if (AllocationSiteInfo::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { | 12347 if (AllocationSiteInfo::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { |
| 12331 if (FLAG_trace_track_allocation_sites) { | 12348 if (FLAG_trace_track_allocation_sites) { |
| 12332 PrintF("AllocationSiteInfo: JSArray %p info updated %s->%s\n", | 12349 PrintF("AllocationSiteInfo: JSArray %p info updated %s->%s\n", |
| 12333 reinterpret_cast<void*>(this), | 12350 reinterpret_cast<void*>(this), |
| 12334 ElementsKindToString(kind), | 12351 ElementsKindToString(kind), |
| 12335 ElementsKindToString(to_kind)); | 12352 ElementsKindToString(to_kind)); |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14237 // Clamp undefined to NaN (default). All other types have been | 14254 // Clamp undefined to NaN (default). All other types have been |
| 14238 // converted to a number type further up in the call chain. | 14255 // converted to a number type further up in the call chain. |
| 14239 ASSERT(value->IsUndefined()); | 14256 ASSERT(value->IsUndefined()); |
| 14240 } | 14257 } |
| 14241 set(index, double_value); | 14258 set(index, double_value); |
| 14242 } | 14259 } |
| 14243 return heap->AllocateHeapNumber(double_value); | 14260 return heap->AllocateHeapNumber(double_value); |
| 14244 } | 14261 } |
| 14245 | 14262 |
| 14246 | 14263 |
| 14247 JSGlobalPropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) { | 14264 PropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) { |
| 14248 ASSERT(!HasFastProperties()); | 14265 ASSERT(!HasFastProperties()); |
| 14249 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); | 14266 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); |
| 14250 return JSGlobalPropertyCell::cast(value); | 14267 return PropertyCell::cast(value); |
| 14251 } | 14268 } |
| 14252 | 14269 |
| 14253 | 14270 |
| 14254 Handle<JSGlobalPropertyCell> GlobalObject::EnsurePropertyCell( | 14271 Handle<PropertyCell> GlobalObject::EnsurePropertyCell( |
| 14255 Handle<GlobalObject> global, | 14272 Handle<GlobalObject> global, |
| 14256 Handle<Name> name) { | 14273 Handle<Name> name) { |
| 14257 Isolate* isolate = global->GetIsolate(); | 14274 Isolate* isolate = global->GetIsolate(); |
| 14258 CALL_HEAP_FUNCTION(isolate, | 14275 CALL_HEAP_FUNCTION(isolate, |
| 14259 global->EnsurePropertyCell(*name), | 14276 global->EnsurePropertyCell(*name), |
| 14260 JSGlobalPropertyCell); | 14277 PropertyCell); |
| 14261 } | 14278 } |
| 14262 | 14279 |
| 14263 | 14280 |
| 14264 MaybeObject* GlobalObject::EnsurePropertyCell(Name* name) { | 14281 MaybeObject* GlobalObject::EnsurePropertyCell(Name* name) { |
| 14265 ASSERT(!HasFastProperties()); | 14282 ASSERT(!HasFastProperties()); |
| 14266 int entry = property_dictionary()->FindEntry(name); | 14283 int entry = property_dictionary()->FindEntry(name); |
| 14267 if (entry == NameDictionary::kNotFound) { | 14284 if (entry == NameDictionary::kNotFound) { |
| 14268 Heap* heap = GetHeap(); | 14285 Heap* heap = GetHeap(); |
| 14269 Object* cell; | 14286 Object* cell; |
| 14270 { MaybeObject* maybe_cell = | 14287 { MaybeObject* maybe_cell = |
| 14271 heap->AllocateJSGlobalPropertyCell(heap->the_hole_value()); | 14288 heap->AllocatePropertyCell(heap->the_hole_value()); |
| 14272 if (!maybe_cell->ToObject(&cell)) return maybe_cell; | 14289 if (!maybe_cell->ToObject(&cell)) return maybe_cell; |
| 14273 } | 14290 } |
| 14274 PropertyDetails details(NONE, NORMAL, 0); | 14291 PropertyDetails details(NONE, NORMAL, 0); |
| 14275 details = details.AsDeleted(); | 14292 details = details.AsDeleted(); |
| 14276 Object* dictionary; | 14293 Object* dictionary; |
| 14277 { MaybeObject* maybe_dictionary = | 14294 { MaybeObject* maybe_dictionary = |
| 14278 property_dictionary()->Add(name, cell, details); | 14295 property_dictionary()->Add(name, cell, details); |
| 14279 if (!maybe_dictionary->ToObject(&dictionary)) return maybe_dictionary; | 14296 if (!maybe_dictionary->ToObject(&dictionary)) return maybe_dictionary; |
| 14280 } | 14297 } |
| 14281 set_properties(NameDictionary::cast(dictionary)); | 14298 set_properties(NameDictionary::cast(dictionary)); |
| 14282 return cell; | 14299 return cell; |
| 14283 } else { | 14300 } else { |
| 14284 Object* value = property_dictionary()->ValueAt(entry); | 14301 Object* value = property_dictionary()->ValueAt(entry); |
| 14285 ASSERT(value->IsJSGlobalPropertyCell()); | 14302 ASSERT(value->IsPropertyCell()); |
| 14286 return value; | 14303 return value; |
| 14287 } | 14304 } |
| 14288 } | 14305 } |
| 14289 | 14306 |
| 14290 | 14307 |
| 14291 MaybeObject* StringTable::LookupString(String* string, Object** s) { | 14308 MaybeObject* StringTable::LookupString(String* string, Object** s) { |
| 14292 InternalizedStringKey key(string); | 14309 InternalizedStringKey key(string); |
| 14293 return LookupKey(&key, s); | 14310 return LookupKey(&key, s); |
| 14294 } | 14311 } |
| 14295 | 14312 |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15058 | 15075 |
| 15059 | 15076 |
| 15060 // Backwards lookup (slow). | 15077 // Backwards lookup (slow). |
| 15061 template<typename Shape, typename Key> | 15078 template<typename Shape, typename Key> |
| 15062 Object* Dictionary<Shape, Key>::SlowReverseLookup(Object* value) { | 15079 Object* Dictionary<Shape, Key>::SlowReverseLookup(Object* value) { |
| 15063 int capacity = HashTable<Shape, Key>::Capacity(); | 15080 int capacity = HashTable<Shape, Key>::Capacity(); |
| 15064 for (int i = 0; i < capacity; i++) { | 15081 for (int i = 0; i < capacity; i++) { |
| 15065 Object* k = HashTable<Shape, Key>::KeyAt(i); | 15082 Object* k = HashTable<Shape, Key>::KeyAt(i); |
| 15066 if (Dictionary<Shape, Key>::IsKey(k)) { | 15083 if (Dictionary<Shape, Key>::IsKey(k)) { |
| 15067 Object* e = ValueAt(i); | 15084 Object* e = ValueAt(i); |
| 15068 if (e->IsJSGlobalPropertyCell()) { | 15085 if (e->IsPropertyCell()) { |
| 15069 e = JSGlobalPropertyCell::cast(e)->value(); | 15086 e = PropertyCell::cast(e)->value(); |
| 15070 } | 15087 } |
| 15071 if (e == value) return k; | 15088 if (e == value) return k; |
| 15072 } | 15089 } |
| 15073 } | 15090 } |
| 15074 Heap* heap = Dictionary<Shape, Key>::GetHeap(); | 15091 Heap* heap = Dictionary<Shape, Key>::GetHeap(); |
| 15075 return heap->undefined_value(); | 15092 return heap->undefined_value(); |
| 15076 } | 15093 } |
| 15077 | 15094 |
| 15078 | 15095 |
| 15079 MaybeObject* NameDictionary::TransformPropertiesToFastFor( | 15096 MaybeObject* NameDictionary::TransformPropertiesToFastFor( |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15788 } | 15805 } |
| 15789 | 15806 |
| 15790 | 15807 |
| 15791 void JSTypedArray::Neuter() { | 15808 void JSTypedArray::Neuter() { |
| 15792 set_byte_offset(Smi::FromInt(0)); | 15809 set_byte_offset(Smi::FromInt(0)); |
| 15793 set_byte_length(Smi::FromInt(0)); | 15810 set_byte_length(Smi::FromInt(0)); |
| 15794 set_length(Smi::FromInt(0)); | 15811 set_length(Smi::FromInt(0)); |
| 15795 set_elements(GetHeap()->EmptyExternalArrayForMap(map())); | 15812 set_elements(GetHeap()->EmptyExternalArrayForMap(map())); |
| 15796 } | 15813 } |
| 15797 | 15814 |
| 15815 |
| 15816 Type* PropertyCell::type() { |
| 15817 return static_cast<Type*>(type_raw()); |
| 15818 } |
| 15819 |
| 15820 |
| 15821 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { |
| 15822 set_type_raw(type, ignored); |
| 15823 } |
| 15824 |
| 15825 |
| 15798 } } // namespace v8::internal | 15826 } } // namespace v8::internal |
| OLD | NEW |