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

Side by Side Diff: src/utils.h

Issue 1159433003: Use GetProperty for getting elements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 6 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 | « src/runtime/runtime-typedarray.cc ('k') | test/cctest/test-api.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 // 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 #ifndef V8_UTILS_H_ 5 #ifndef V8_UTILS_H_
6 #define V8_UTILS_H_ 6 #define V8_UTILS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 } 1683 }
1684 1684
1685 // Convert string to uint32 array index; character by character. 1685 // Convert string to uint32 array index; character by character.
1686 int d = ch - '0'; 1686 int d = ch - '0';
1687 if (d < 0 || d > 9) return false; 1687 if (d < 0 || d > 9) return false;
1688 uint32_t result = d; 1688 uint32_t result = d;
1689 while (stream->HasMore()) { 1689 while (stream->HasMore()) {
1690 d = stream->GetNext() - '0'; 1690 d = stream->GetNext() - '0';
1691 if (d < 0 || d > 9) return false; 1691 if (d < 0 || d > 9) return false;
1692 // Check that the new result is below the 32 bit limit. 1692 // Check that the new result is below the 32 bit limit.
1693 if (result > 429496729U - ((d > 5) ? 1 : 0)) return false; 1693 if (result > 429496729U - ((d + 3) >> 3)) return false;
1694 result = (result * 10) + d; 1694 result = (result * 10) + d;
1695 } 1695 }
1696 1696
1697 *index = result; 1697 *index = result;
1698 return true; 1698 return true;
1699 } 1699 }
1700 1700
1701 1701
1702 // Returns current value of top of the stack. Works correctly with ASAN. 1702 // Returns current value of top of the stack. Works correctly with ASAN.
1703 DISABLE_ASAN 1703 DISABLE_ASAN
1704 inline uintptr_t GetCurrentStackPosition() { 1704 inline uintptr_t GetCurrentStackPosition() {
1705 // Takes the address of the limit variable in order to find out where 1705 // Takes the address of the limit variable in order to find out where
1706 // the top of stack is right now. 1706 // the top of stack is right now.
1707 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); 1707 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit);
1708 return limit; 1708 return limit;
1709 } 1709 }
1710 1710
1711 } // namespace internal 1711 } // namespace internal
1712 } // namespace v8 1712 } // namespace v8
1713 1713
1714 #endif // V8_UTILS_H_ 1714 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-typedarray.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698