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

Side by Side Diff: src/objects-inl.h

Issue 2804033005: Suppress incorrect warning (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 Handle<Object> AsHandle(Isolate* isolate) override; 957 Handle<Object> AsHandle(Isolate* isolate) override;
958 }; 958 };
959 959
960 class SeqOneByteSubStringKey : public HashTableKey { 960 class SeqOneByteSubStringKey : public HashTableKey {
961 public: 961 public:
962 SeqOneByteSubStringKey(Handle<SeqOneByteString> string, int from, int length) 962 SeqOneByteSubStringKey(Handle<SeqOneByteString> string, int from, int length)
963 : string_(string), from_(from), length_(length) { 963 : string_(string), from_(from), length_(length) {
964 DCHECK(string_->IsSeqOneByteString()); 964 DCHECK(string_->IsSeqOneByteString());
965 } 965 }
966 966
967 // VS 2017 on official builds gives this spurious warning:
968 // warning C4789: buffer 'key' of size 16 bytes will be overrun; 4 bytes will
969 // be written starting at offset 16
970 // https://bugs.chromium.org/p/v8/issues/detail?id=6068
971 #if defined(V8_CC_MSVC)
972 #pragma warning(push)
973 #pragma warning(disable : 4789)
974 #endif
967 uint32_t Hash() override { 975 uint32_t Hash() override {
968 DCHECK(length_ >= 0); 976 DCHECK(length_ >= 0);
969 DCHECK(from_ + length_ <= string_->length()); 977 DCHECK(from_ + length_ <= string_->length());
970 const uint8_t* chars = string_->GetChars() + from_; 978 const uint8_t* chars = string_->GetChars() + from_;
971 hash_field_ = StringHasher::HashSequentialString( 979 hash_field_ = StringHasher::HashSequentialString(
972 chars, length_, string_->GetHeap()->HashSeed()); 980 chars, length_, string_->GetHeap()->HashSeed());
973 uint32_t result = hash_field_ >> String::kHashShift; 981 uint32_t result = hash_field_ >> String::kHashShift;
974 DCHECK(result != 0); // Ensure that the hash value of 0 is never computed. 982 DCHECK(result != 0); // Ensure that the hash value of 0 is never computed.
975 return result; 983 return result;
976 } 984 }
985 #if defined(V8_CC_MSVC)
986 #pragma warning(pop)
987 #endif
977 988
978 uint32_t HashForObject(Object* other) override { 989 uint32_t HashForObject(Object* other) override {
979 return String::cast(other)->Hash(); 990 return String::cast(other)->Hash();
980 } 991 }
981 992
982 bool IsMatch(Object* string) override; 993 bool IsMatch(Object* string) override;
983 Handle<Object> AsHandle(Isolate* isolate) override; 994 Handle<Object> AsHandle(Isolate* isolate) override;
984 995
985 private: 996 private:
986 Handle<SeqOneByteString> string_; 997 Handle<SeqOneByteString> string_;
(...skipping 7282 matching lines...) Expand 10 before | Expand all | Expand 10 after
8269 #undef WRITE_BYTE_FIELD 8280 #undef WRITE_BYTE_FIELD
8270 #undef NOBARRIER_READ_BYTE_FIELD 8281 #undef NOBARRIER_READ_BYTE_FIELD
8271 #undef NOBARRIER_WRITE_BYTE_FIELD 8282 #undef NOBARRIER_WRITE_BYTE_FIELD
8272 8283
8273 } // namespace internal 8284 } // namespace internal
8274 } // namespace v8 8285 } // namespace v8
8275 8286
8276 #include "src/objects/object-macros-undef.h" 8287 #include "src/objects/object-macros-undef.h"
8277 8288
8278 #endif // V8_OBJECTS_INL_H_ 8289 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698