OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 8994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9005 template <typename Char> | 9005 template <typename Char> |
9006 static inline bool CompareRawStringContents(const Char* const a, | 9006 static inline bool CompareRawStringContents(const Char* const a, |
9007 const Char* const b, | 9007 const Char* const b, |
9008 int length) { | 9008 int length) { |
9009 int i = 0; | 9009 int i = 0; |
9010 #ifndef V8_HOST_CAN_READ_UNALIGNED | 9010 #ifndef V8_HOST_CAN_READ_UNALIGNED |
9011 // If this architecture isn't comfortable reading unaligned ints | 9011 // If this architecture isn't comfortable reading unaligned ints |
9012 // then we have to check that the strings are aligned before | 9012 // then we have to check that the strings are aligned before |
9013 // comparing them blockwise. | 9013 // comparing them blockwise. |
9014 const int kAlignmentMask = sizeof(uint32_t) - 1; // NOLINT | 9014 const int kAlignmentMask = sizeof(uint32_t) - 1; // NOLINT |
9015 uint32_t pa_addr = reinterpret_cast<uint32_t>(a); | 9015 uintptr_t pa_addr = reinterpret_cast<uintptr_t>(a); |
9016 uint32_t pb_addr = reinterpret_cast<uint32_t>(b); | 9016 uintptr_t pb_addr = reinterpret_cast<uintptr_t>(b); |
9017 if (((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) == 0) { | 9017 if (((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) == 0) { |
9018 #endif | 9018 #endif |
9019 const int kStepSize = sizeof(int) / sizeof(Char); // NOLINT | 9019 const int kStepSize = sizeof(int) / sizeof(Char); // NOLINT |
9020 int endpoint = length - kStepSize; | 9020 int endpoint = length - kStepSize; |
9021 // Compare blocks until we reach near the end of the string. | 9021 // Compare blocks until we reach near the end of the string. |
9022 for (; i <= endpoint; i += kStepSize) { | 9022 for (; i <= endpoint; i += kStepSize) { |
9023 uint32_t wa = *reinterpret_cast<const uint32_t*>(a + i); | 9023 uint32_t wa = *reinterpret_cast<const uint32_t*>(a + i); |
9024 uint32_t wb = *reinterpret_cast<const uint32_t*>(b + i); | 9024 uint32_t wb = *reinterpret_cast<const uint32_t*>(b + i); |
9025 if (wa != wb) { | 9025 if (wa != wb) { |
9026 return false; | 9026 return false; |
(...skipping 7959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16986 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16986 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16987 static const char* error_messages_[] = { | 16987 static const char* error_messages_[] = { |
16988 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16988 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16989 }; | 16989 }; |
16990 #undef ERROR_MESSAGES_TEXTS | 16990 #undef ERROR_MESSAGES_TEXTS |
16991 return error_messages_[reason]; | 16991 return error_messages_[reason]; |
16992 } | 16992 } |
16993 | 16993 |
16994 | 16994 |
16995 } } // namespace v8::internal | 16995 } } // namespace v8::internal |
OLD | NEW |