Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/objects.cc

Issue 16925008: Generate StoreGlobal stubs with Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address feedback Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 ASSERT(!HasFastProperties()); 623 ASSERT(!HasFastProperties());
624 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); 624 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry());
625 if (IsGlobalObject()) { 625 if (IsGlobalObject()) {
626 value = PropertyCell::cast(value)->value(); 626 value = PropertyCell::cast(value)->value();
627 } 627 }
628 ASSERT(!value->IsPropertyCell() && !value->IsCell()); 628 ASSERT(!value->IsPropertyCell() && !value->IsCell());
629 return value; 629 return value;
630 } 630 }
631 631
632 632
633 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) { 633 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object,
634 LookupResult* result,
635 Handle<Object> value) {
636 CALL_HEAP_FUNCTION(object->GetIsolate(),
637 object->SetNormalizedProperty(result, *value),
638 Object);
639 }
640
641
642 MaybeObject* JSObject::SetNormalizedProperty(LookupResult* result,
643 Object* value) {
634 ASSERT(!HasFastProperties()); 644 ASSERT(!HasFastProperties());
635 if (IsGlobalObject()) { 645 if (IsGlobalObject()) {
636 PropertyCell* cell = PropertyCell::cast( 646 PropertyCell* cell = PropertyCell::cast(
637 property_dictionary()->ValueAt(result->GetDictionaryEntry())); 647 property_dictionary()->ValueAt(result->GetDictionaryEntry()));
638 cell->set_value(value); 648 MaybeObject* maybe_type = cell->SetValueInferType(value);
649 if (maybe_type->IsFailure()) return maybe_type;
639 } else { 650 } else {
640 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); 651 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value);
641 } 652 }
642 return value; 653 return value;
643 } 654 }
644 655
645 656
646 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object, 657 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object,
647 Handle<Name> key, 658 Handle<Name> key,
648 Handle<Object> value, 659 Handle<Object> value,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 enumeration_index = original_details.dictionary_index(); 695 enumeration_index = original_details.dictionary_index();
685 ASSERT(enumeration_index > 0); 696 ASSERT(enumeration_index > 0);
686 } 697 }
687 698
688 details = PropertyDetails( 699 details = PropertyDetails(
689 details.attributes(), details.type(), enumeration_index); 700 details.attributes(), details.type(), enumeration_index);
690 701
691 if (IsGlobalObject()) { 702 if (IsGlobalObject()) {
692 PropertyCell* cell = 703 PropertyCell* cell =
693 PropertyCell::cast(property_dictionary()->ValueAt(entry)); 704 PropertyCell::cast(property_dictionary()->ValueAt(entry));
694 cell->set_value(value); 705 MaybeObject* maybe_type = cell->SetValueInferType(value);
706 if (maybe_type->IsFailure()) return maybe_type;
695 // Please note we have to update the property details. 707 // Please note we have to update the property details.
696 property_dictionary()->DetailsAtPut(entry, details); 708 property_dictionary()->DetailsAtPut(entry, details);
697 } else { 709 } else {
698 property_dictionary()->SetEntry(entry, name, value, details); 710 property_dictionary()->SetEntry(entry, name, value, details);
699 } 711 }
700 return value; 712 return value;
701 } 713 }
702 714
703 715
704 MaybeObject* JSObject::DeleteNormalizedProperty(Name* name, DeleteMode mode) { 716 MaybeObject* JSObject::DeleteNormalizedProperty(Name* name, DeleteMode mode) {
(...skipping 11 matching lines...) Expand all
716 // from the DontDelete cell without checking if it contains 728 // from the DontDelete cell without checking if it contains
717 // the hole value. 729 // the hole value.
718 Map* new_map; 730 Map* new_map;
719 MaybeObject* maybe_new_map = map()->CopyDropDescriptors(); 731 MaybeObject* maybe_new_map = map()->CopyDropDescriptors();
720 if (!maybe_new_map->To(&new_map)) return maybe_new_map; 732 if (!maybe_new_map->To(&new_map)) return maybe_new_map;
721 733
722 ASSERT(new_map->is_dictionary_map()); 734 ASSERT(new_map->is_dictionary_map());
723 set_map(new_map); 735 set_map(new_map);
724 } 736 }
725 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); 737 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry));
726 cell->set_value(cell->GetHeap()->the_hole_value()); 738 MaybeObject* maybe_type =
739 cell->SetValueInferType(cell->GetHeap()->the_hole_value());
740 if (maybe_type->IsFailure()) return maybe_type;
727 dictionary->DetailsAtPut(entry, details.AsDeleted()); 741 dictionary->DetailsAtPut(entry, details.AsDeleted());
728 } else { 742 } else {
729 Object* deleted = dictionary->DeleteProperty(entry, mode); 743 Object* deleted = dictionary->DeleteProperty(entry, mode);
730 if (deleted == GetHeap()->true_value()) { 744 if (deleted == GetHeap()->true_value()) {
731 FixedArray* new_properties = NULL; 745 FixedArray* new_properties = NULL;
732 MaybeObject* maybe_properties = dictionary->Shrink(name); 746 MaybeObject* maybe_properties = dictionary->Shrink(name);
733 if (!maybe_properties->To(&new_properties)) { 747 if (!maybe_properties->To(&new_properties)) {
734 return maybe_properties; 748 return maybe_properties;
735 } 749 }
736 set_properties(new_properties); 750 set_properties(new_properties);
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 Object* value, 1937 Object* value,
1924 PropertyAttributes attributes) { 1938 PropertyAttributes attributes) {
1925 ASSERT(!HasFastProperties()); 1939 ASSERT(!HasFastProperties());
1926 NameDictionary* dict = property_dictionary(); 1940 NameDictionary* dict = property_dictionary();
1927 Object* store_value = value; 1941 Object* store_value = value;
1928 if (IsGlobalObject()) { 1942 if (IsGlobalObject()) {
1929 // In case name is an orphaned property reuse the cell. 1943 // In case name is an orphaned property reuse the cell.
1930 int entry = dict->FindEntry(name); 1944 int entry = dict->FindEntry(name);
1931 if (entry != NameDictionary::kNotFound) { 1945 if (entry != NameDictionary::kNotFound) {
1932 store_value = dict->ValueAt(entry); 1946 store_value = dict->ValueAt(entry);
1933 PropertyCell::cast(store_value)->set_value(value); 1947 MaybeObject* maybe_type =
1948 PropertyCell::cast(store_value)->SetValueInferType(value);
1949 if (maybe_type->IsFailure()) return maybe_type;
1934 // Assign an enumeration index to the property and update 1950 // Assign an enumeration index to the property and update
1935 // SetNextEnumerationIndex. 1951 // SetNextEnumerationIndex.
1936 int index = dict->NextEnumerationIndex(); 1952 int index = dict->NextEnumerationIndex();
1937 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); 1953 PropertyDetails details = PropertyDetails(attributes, NORMAL, index);
1938 dict->SetNextEnumerationIndex(index + 1); 1954 dict->SetNextEnumerationIndex(index + 1);
1939 dict->SetEntry(entry, name, store_value, details); 1955 dict->SetEntry(entry, name, store_value, details);
1940 return value; 1956 return value;
1941 } 1957 }
1942 Heap* heap = GetHeap(); 1958 Heap* heap = GetHeap();
1943 { MaybeObject* maybe_store_value = 1959 { MaybeObject* maybe_store_value =
1944 heap->AllocatePropertyCell(value); 1960 heap->AllocatePropertyCell(value);
1945 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; 1961 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value;
1946 } 1962 }
1947 PropertyCell::cast(store_value)->set_value(value); 1963 MaybeObject* maybe_type =
1964 PropertyCell::cast(store_value)->SetValueInferType(value);
1965 if (maybe_type->IsFailure()) return maybe_type;
1948 } 1966 }
1949 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); 1967 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
1950 Object* result; 1968 Object* result;
1951 { MaybeObject* maybe_result = dict->Add(name, store_value, details); 1969 { MaybeObject* maybe_result = dict->Add(name, store_value, details);
1952 if (!maybe_result->ToObject(&result)) return maybe_result; 1970 if (!maybe_result->ToObject(&result)) return maybe_result;
1953 } 1971 }
1954 if (dict != result) set_properties(NameDictionary::cast(result)); 1972 if (dict != result) set_properties(NameDictionary::cast(result));
1955 return value; 1973 return value;
1956 } 1974 }
1957 1975
(...skipping 13848 matching lines...) Expand 10 before | Expand all | Expand 10 after
15806 Type* PropertyCell::type() { 15824 Type* PropertyCell::type() {
15807 return static_cast<Type*>(type_raw()); 15825 return static_cast<Type*>(type_raw());
15808 } 15826 }
15809 15827
15810 15828
15811 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { 15829 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
15812 set_type_raw(type, ignored); 15830 set_type_raw(type, ignored);
15813 } 15831 }
15814 15832
15815 15833
15834 Type* PropertyCell::UpdateType(Handle<PropertyCell> cell,
15835 Handle<Object> value) {
15836 Isolate* isolate = cell->GetIsolate();
15837 Handle<Type> old_type(cell->type(), isolate);
15838 Handle<Type> new_type((value->IsSmi() || value->IsUndefined())
15839 ? Type::Constant(value, isolate)
15840 : Type::Any(), isolate);
15841
15842 if (new_type->Is(old_type)) {
15843 return *old_type;
15844 }
15845
15846 cell->dependent_code()->DeoptimizeDependentCodeGroup(
15847 isolate, DependentCode::kPropertyCellChangedGroup);
15848
15849 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) {
15850 return *new_type;
15851 }
15852
15853 return Type::Any();
15854 }
15855
15856
15857 MaybeObject* PropertyCell::SetValueInferType(Object* value,
15858 WriteBarrierMode ignored) {
15859 set_value(value, ignored);
15860 if (!Type::Any()->Is(type())) {
15861 IdempotentPointerToHandleCodeTrampoline trampoline(GetIsolate());
15862 MaybeObject* maybe_type = trampoline.CallWithReturnValue(
15863 &PropertyCell::UpdateType,
15864 Handle<PropertyCell>(this),
15865 Handle<Object>(value, GetIsolate()));
15866 if (maybe_type->IsFailure()) return maybe_type;
15867 Type* new_type = static_cast<Type*>(maybe_type);
15868 set_type(new_type);
15869 }
15870 return value;
15871 }
15872
15873
15816 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { 15874 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) {
15817 Handle<DependentCode> dep(dependent_code()); 15875 Handle<DependentCode> dep(dependent_code());
15818 Handle<DependentCode> codes = 15876 Handle<DependentCode> codes =
15819 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, 15877 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup,
15820 info->object_wrapper()); 15878 info->object_wrapper());
15821 if (*codes != dependent_code()) set_dependent_code(*codes); 15879 if (*codes != dependent_code()) set_dependent_code(*codes);
15822 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 15880 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
15823 Handle<HeapObject>(this), info->zone()); 15881 Handle<HeapObject>(this), info->zone());
15824 } 15882 }
15825 15883
15826 15884
15827 void PropertyCell::AddDependentCode(Handle<Code> code) { 15885 void PropertyCell::AddDependentCode(Handle<Code> code) {
15828 Handle<DependentCode> codes = DependentCode::Insert( 15886 Handle<DependentCode> codes = DependentCode::Insert(
15829 Handle<DependentCode>(dependent_code()), 15887 Handle<DependentCode>(dependent_code()),
15830 DependentCode::kPropertyCellChangedGroup, code); 15888 DependentCode::kPropertyCellChangedGroup, code);
15831 if (*codes != dependent_code()) set_dependent_code(*codes); 15889 if (*codes != dependent_code()) set_dependent_code(*codes);
15832 } 15890 }
15833 15891
15834 15892
15835 } } // namespace v8::internal 15893 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | src/x64/lithium-gap-resolver-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698