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

Side by Side Diff: src/objects.cc

Issue 18357004: Revert r15419: "Generate StoreGlobal stubs with Hydrogen" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 ASSERT(!value->IsPropertyCell() && !value->IsCell()); 627 ASSERT(!value->IsPropertyCell() && !value->IsCell());
628 return value; 628 return value;
629 } 629 }
630 630
631 631
632 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) { 632 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) {
633 ASSERT(!HasFastProperties()); 633 ASSERT(!HasFastProperties());
634 if (IsGlobalObject()) { 634 if (IsGlobalObject()) {
635 PropertyCell* cell = PropertyCell::cast( 635 PropertyCell* cell = PropertyCell::cast(
636 property_dictionary()->ValueAt(result->GetDictionaryEntry())); 636 property_dictionary()->ValueAt(result->GetDictionaryEntry()));
637 cell->SetValueInferType(value); 637 cell->set_value(value);
638 } else { 638 } else {
639 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); 639 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value);
640 } 640 }
641 return value; 641 return value;
642 } 642 }
643 643
644 644
645 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object, 645 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object,
646 Handle<Name> key, 646 Handle<Name> key,
647 Handle<Object> value, 647 Handle<Object> value,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 enumeration_index = original_details.dictionary_index(); 683 enumeration_index = original_details.dictionary_index();
684 ASSERT(enumeration_index > 0); 684 ASSERT(enumeration_index > 0);
685 } 685 }
686 686
687 details = PropertyDetails( 687 details = PropertyDetails(
688 details.attributes(), details.type(), enumeration_index); 688 details.attributes(), details.type(), enumeration_index);
689 689
690 if (IsGlobalObject()) { 690 if (IsGlobalObject()) {
691 PropertyCell* cell = 691 PropertyCell* cell =
692 PropertyCell::cast(property_dictionary()->ValueAt(entry)); 692 PropertyCell::cast(property_dictionary()->ValueAt(entry));
693 cell->SetValueInferType(value); 693 cell->set_value(value);
694 // Please note we have to update the property details. 694 // Please note we have to update the property details.
695 property_dictionary()->DetailsAtPut(entry, details); 695 property_dictionary()->DetailsAtPut(entry, details);
696 } else { 696 } else {
697 property_dictionary()->SetEntry(entry, name, value, details); 697 property_dictionary()->SetEntry(entry, name, value, details);
698 } 698 }
699 return value; 699 return value;
700 } 700 }
701 701
702 702
703 MaybeObject* JSObject::DeleteNormalizedProperty(Name* name, DeleteMode mode) { 703 MaybeObject* JSObject::DeleteNormalizedProperty(Name* name, DeleteMode mode) {
(...skipping 11 matching lines...) Expand all
715 // from the DontDelete cell without checking if it contains 715 // from the DontDelete cell without checking if it contains
716 // the hole value. 716 // the hole value.
717 Map* new_map; 717 Map* new_map;
718 MaybeObject* maybe_new_map = map()->CopyDropDescriptors(); 718 MaybeObject* maybe_new_map = map()->CopyDropDescriptors();
719 if (!maybe_new_map->To(&new_map)) return maybe_new_map; 719 if (!maybe_new_map->To(&new_map)) return maybe_new_map;
720 720
721 ASSERT(new_map->is_dictionary_map()); 721 ASSERT(new_map->is_dictionary_map());
722 set_map(new_map); 722 set_map(new_map);
723 } 723 }
724 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry)); 724 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(entry));
725 cell->SetValueInferType(cell->GetHeap()->the_hole_value()); 725 cell->set_value(cell->GetHeap()->the_hole_value());
726 dictionary->DetailsAtPut(entry, details.AsDeleted()); 726 dictionary->DetailsAtPut(entry, details.AsDeleted());
727 } else { 727 } else {
728 Object* deleted = dictionary->DeleteProperty(entry, mode); 728 Object* deleted = dictionary->DeleteProperty(entry, mode);
729 if (deleted == GetHeap()->true_value()) { 729 if (deleted == GetHeap()->true_value()) {
730 FixedArray* new_properties = NULL; 730 FixedArray* new_properties = NULL;
731 MaybeObject* maybe_properties = dictionary->Shrink(name); 731 MaybeObject* maybe_properties = dictionary->Shrink(name);
732 if (!maybe_properties->To(&new_properties)) { 732 if (!maybe_properties->To(&new_properties)) {
733 return maybe_properties; 733 return maybe_properties;
734 } 734 }
735 set_properties(new_properties); 735 set_properties(new_properties);
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 Object* value, 1922 Object* value,
1923 PropertyAttributes attributes) { 1923 PropertyAttributes attributes) {
1924 ASSERT(!HasFastProperties()); 1924 ASSERT(!HasFastProperties());
1925 NameDictionary* dict = property_dictionary(); 1925 NameDictionary* dict = property_dictionary();
1926 Object* store_value = value; 1926 Object* store_value = value;
1927 if (IsGlobalObject()) { 1927 if (IsGlobalObject()) {
1928 // In case name is an orphaned property reuse the cell. 1928 // In case name is an orphaned property reuse the cell.
1929 int entry = dict->FindEntry(name); 1929 int entry = dict->FindEntry(name);
1930 if (entry != NameDictionary::kNotFound) { 1930 if (entry != NameDictionary::kNotFound) {
1931 store_value = dict->ValueAt(entry); 1931 store_value = dict->ValueAt(entry);
1932 PropertyCell::cast(store_value)->SetValueInferType(value); 1932 PropertyCell::cast(store_value)->set_value(value);
1933 // Assign an enumeration index to the property and update 1933 // Assign an enumeration index to the property and update
1934 // SetNextEnumerationIndex. 1934 // SetNextEnumerationIndex.
1935 int index = dict->NextEnumerationIndex(); 1935 int index = dict->NextEnumerationIndex();
1936 PropertyDetails details = PropertyDetails(attributes, NORMAL, index); 1936 PropertyDetails details = PropertyDetails(attributes, NORMAL, index);
1937 dict->SetNextEnumerationIndex(index + 1); 1937 dict->SetNextEnumerationIndex(index + 1);
1938 dict->SetEntry(entry, name, store_value, details); 1938 dict->SetEntry(entry, name, store_value, details);
1939 return value; 1939 return value;
1940 } 1940 }
1941 Heap* heap = GetHeap(); 1941 Heap* heap = GetHeap();
1942 { MaybeObject* maybe_store_value = 1942 { MaybeObject* maybe_store_value =
1943 heap->AllocatePropertyCell(value); 1943 heap->AllocatePropertyCell(value);
1944 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; 1944 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value;
1945 } 1945 }
1946 PropertyCell::cast(store_value)->SetValueInferType(value); 1946 PropertyCell::cast(store_value)->set_value(value);
1947 } 1947 }
1948 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0); 1948 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
1949 Object* result; 1949 Object* result;
1950 { MaybeObject* maybe_result = dict->Add(name, store_value, details); 1950 { MaybeObject* maybe_result = dict->Add(name, store_value, details);
1951 if (!maybe_result->ToObject(&result)) return maybe_result; 1951 if (!maybe_result->ToObject(&result)) return maybe_result;
1952 } 1952 }
1953 if (dict != result) set_properties(NameDictionary::cast(result)); 1953 if (dict != result) set_properties(NameDictionary::cast(result));
1954 return value; 1954 return value;
1955 } 1955 }
1956 1956
(...skipping 13842 matching lines...) Expand 10 before | Expand all | Expand 10 after
15799 Type* PropertyCell::type() { 15799 Type* PropertyCell::type() {
15800 return static_cast<Type*>(type_raw()); 15800 return static_cast<Type*>(type_raw());
15801 } 15801 }
15802 15802
15803 15803
15804 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { 15804 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
15805 set_type_raw(type, ignored); 15805 set_type_raw(type, ignored);
15806 } 15806 }
15807 15807
15808 15808
15809 Type* PropertyCell::UpdateType(Object* value) {
15810 Isolate* isolate = GetIsolate();
15811 Handle<Object> value_handle(value, isolate);
15812 Handle<Type> old_type(type(), isolate);
15813 Handle<Type> new_type((value->IsSmi() || value->IsUndefined())
15814 ? Type::Constant(value_handle, isolate)
15815 : Type::Any(), isolate);
15816
15817 if (new_type->Is(old_type)) {
15818 return *old_type;
15819 }
15820
15821 dependent_code()->DeoptimizeDependentCodeGroup(
15822 isolate, DependentCode::kPropertyCellChangedGroup);
15823
15824 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) {
15825 return *new_type;
15826 }
15827
15828 return Type::Any();
15829 }
15830
15831
15832 void PropertyCell::SetValueInferType(Object* value,
15833 WriteBarrierMode ignored) {
15834 set_value(value, ignored);
15835 if (!Type::Any()->Is(type())) {
15836 set_type(UpdateType(value));
15837 }
15838 }
15839
15840
15841 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { 15809 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) {
15842 Handle<DependentCode> dep(dependent_code()); 15810 Handle<DependentCode> dep(dependent_code());
15843 Handle<DependentCode> codes = 15811 Handle<DependentCode> codes =
15844 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, 15812 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup,
15845 info->object_wrapper()); 15813 info->object_wrapper());
15846 if (*codes != dependent_code()) set_dependent_code(*codes); 15814 if (*codes != dependent_code()) set_dependent_code(*codes);
15847 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 15815 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
15848 Handle<HeapObject>(this), info->zone()); 15816 Handle<HeapObject>(this), info->zone());
15849 } 15817 }
15850 15818
15851 15819
15852 void PropertyCell::AddDependentCode(Handle<Code> code) { 15820 void PropertyCell::AddDependentCode(Handle<Code> code) {
15853 Handle<DependentCode> codes = DependentCode::Insert( 15821 Handle<DependentCode> codes = DependentCode::Insert(
15854 Handle<DependentCode>(dependent_code()), 15822 Handle<DependentCode>(dependent_code()),
15855 DependentCode::kPropertyCellChangedGroup, code); 15823 DependentCode::kPropertyCellChangedGroup, code);
15856 if (*codes != dependent_code()) set_dependent_code(*codes); 15824 if (*codes != dependent_code()) set_dependent_code(*codes);
15857 } 15825 }
15858 15826
15859 15827
15860 } } // namespace v8::internal 15828 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698