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

Side by Side Diff: src/utils.h

Issue 11088027: Added a simple dead code removal phase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 8 years, 2 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/property-details.h ('k') | tools/run-tests.py » ('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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 inline Dest BitCast(const Source& source) { 855 inline Dest BitCast(const Source& source) {
856 return BitCastHelper<Dest, Source>::cast(source); 856 return BitCastHelper<Dest, Source>::cast(source);
857 } 857 }
858 858
859 859
860 template<typename ElementType, int NumElements> 860 template<typename ElementType, int NumElements>
861 class EmbeddedContainer { 861 class EmbeddedContainer {
862 public: 862 public:
863 EmbeddedContainer() : elems_() { } 863 EmbeddedContainer() : elems_() { }
864 864
865 int length() { return NumElements; } 865 int length() const { return NumElements; }
866 const ElementType& operator[](int i) const {
867 ASSERT(i < length());
868 return elems_[i];
869 }
866 ElementType& operator[](int i) { 870 ElementType& operator[](int i) {
867 ASSERT(i < length()); 871 ASSERT(i < length());
868 return elems_[i]; 872 return elems_[i];
869 } 873 }
870 874
871 private: 875 private:
872 ElementType elems_[NumElements]; 876 ElementType elems_[NumElements];
873 }; 877 };
874 878
875 879
876 template<typename ElementType> 880 template<typename ElementType>
877 class EmbeddedContainer<ElementType, 0> { 881 class EmbeddedContainer<ElementType, 0> {
878 public: 882 public:
879 int length() { return 0; } 883 int length() const { return 0; }
884 const ElementType& operator[](int i) const {
885 UNREACHABLE();
886 static ElementType t = 0;
887 return t;
888 }
880 ElementType& operator[](int i) { 889 ElementType& operator[](int i) {
881 UNREACHABLE(); 890 UNREACHABLE();
882 static ElementType t = 0; 891 static ElementType t = 0;
883 return t; 892 return t;
884 } 893 }
885 }; 894 };
886 895
887 896
888 // Helper class for building result strings in a character buffer. The 897 // Helper class for building result strings in a character buffer. The
889 // purpose of the class is to use safe operations that checks the 898 // purpose of the class is to use safe operations that checks the
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 1032
1024 // Ever FunctionState starts with this id. 1033 // Ever FunctionState starts with this id.
1025 static const int kFirstUsableId = 4; 1034 static const int kFirstUsableId = 4;
1026 1035
1027 int id_; 1036 int id_;
1028 }; 1037 };
1029 1038
1030 } } // namespace v8::internal 1039 } } // namespace v8::internal
1031 1040
1032 #endif // V8_UTILS_H_ 1041 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/property-details.h ('k') | tools/run-tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698