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

Side by Side Diff: src/objects.h

Issue 10830005: In-place trimming of descriptor array when appending callbacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 8 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/factory.cc ('k') | src/objects.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 bool IsConsistentWithBackPointers(Map* current_map); 2628 bool IsConsistentWithBackPointers(Map* current_map);
2629 2629
2630 // Are two DescriptorArrays equal? 2630 // Are two DescriptorArrays equal?
2631 bool IsEqualTo(DescriptorArray* other); 2631 bool IsEqualTo(DescriptorArray* other);
2632 #endif 2632 #endif
2633 2633
2634 // The maximum number of descriptors we want in a descriptor array (should 2634 // The maximum number of descriptors we want in a descriptor array (should
2635 // fit in a page). 2635 // fit in a page).
2636 static const int kMaxNumberOfDescriptors = 1024 + 512; 2636 static const int kMaxNumberOfDescriptors = 1024 + 512;
2637 2637
2638 static int SizeFor(int number_of_descriptors) {
2639 return ToKeyIndex(number_of_descriptors);
2640 }
2641
2638 private: 2642 private:
2639 // An entry in a DescriptorArray, represented as an (array, index) pair. 2643 // An entry in a DescriptorArray, represented as an (array, index) pair.
2640 class Entry { 2644 class Entry {
2641 public: 2645 public:
2642 inline explicit Entry(DescriptorArray* descs, int index) : 2646 inline explicit Entry(DescriptorArray* descs, int index) :
2643 descs_(descs), index_(index) { } 2647 descs_(descs), index_(index) { }
2644 2648
2645 inline PropertyType type() { return descs_->GetType(index_); } 2649 inline PropertyType type() { return descs_->GetType(index_); }
2646 inline Object* GetCallbackObject() { return descs_->GetValue(index_); } 2650 inline Object* GetCallbackObject() { return descs_->GetValue(index_); }
2647 2651
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after
4954 4958
4955 // Clears the code cache. 4959 // Clears the code cache.
4956 inline void ClearCodeCache(Heap* heap); 4960 inline void ClearCodeCache(Heap* heap);
4957 4961
4958 // Update code cache. 4962 // Update code cache.
4959 static void UpdateCodeCache(Handle<Map> map, 4963 static void UpdateCodeCache(Handle<Map> map,
4960 Handle<String> name, 4964 Handle<String> name,
4961 Handle<Code> code); 4965 Handle<Code> code);
4962 MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code); 4966 MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code);
4963 4967
4968 // Extend the descriptor array of the map with the list of descriptors.
4969 // In case of duplicates, the latest descriptor is used.
4970 static void CopyAppendCallbackDescriptors(Handle<Map> map,
4971 Handle<Object> descriptors);
4972
4964 // Returns the found code or undefined if absent. 4973 // Returns the found code or undefined if absent.
4965 Object* FindInCodeCache(String* name, Code::Flags flags); 4974 Object* FindInCodeCache(String* name, Code::Flags flags);
4966 4975
4967 // Returns the non-negative index of the code object if it is in the 4976 // Returns the non-negative index of the code object if it is in the
4968 // cache and -1 otherwise. 4977 // cache and -1 otherwise.
4969 int IndexInCodeCache(Object* name, Code* code); 4978 int IndexInCodeCache(Object* name, Code* code);
4970 4979
4971 // Removes a code object from the code cache at the given index. 4980 // Removes a code object from the code cache at the given index.
4972 void RemoveFromCodeCache(String* name, Code* code, int index); 4981 void RemoveFromCodeCache(String* name, Code* code, int index);
4973 4982
(...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after
8898 } else { 8907 } else {
8899 value &= ~(1 << bit_position); 8908 value &= ~(1 << bit_position);
8900 } 8909 }
8901 return value; 8910 return value;
8902 } 8911 }
8903 }; 8912 };
8904 8913
8905 } } // namespace v8::internal 8914 } } // namespace v8::internal
8906 8915
8907 #endif // V8_OBJECTS_H_ 8916 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698