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

Side by Side Diff: src/utils.h

Issue 113393: Optimize the scope creation code by lazily allocating the hash maps... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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/scopes.cc ('k') | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 24 matching lines...) Expand all
35 // ---------------------------------------------------------------------------- 35 // ----------------------------------------------------------------------------
36 // General helper functions 36 // General helper functions
37 37
38 // Returns true iff x is a power of 2. Does not work for zero. 38 // Returns true iff x is a power of 2. Does not work for zero.
39 template <typename T> 39 template <typename T>
40 static inline bool IsPowerOf2(T x) { 40 static inline bool IsPowerOf2(T x) {
41 return (x & (x - 1)) == 0; 41 return (x & (x - 1)) == 0;
42 } 42 }
43 43
44 44
45
46
47 // The C++ standard leaves the semantics of '>>' undefined for 45 // The C++ standard leaves the semantics of '>>' undefined for
48 // negative signed operands. Most implementations do the right thing, 46 // negative signed operands. Most implementations do the right thing,
49 // though. 47 // though.
50 static inline int ArithmeticShiftRight(int x, int s) { 48 static inline int ArithmeticShiftRight(int x, int s) {
51 return x >> s; 49 return x >> s;
52 } 50 }
53 51
54 52
55 // Compute the 0-relative offset of some absolute value x of type T. 53 // Compute the 0-relative offset of some absolute value x of type T.
56 // This allows conversion of Addresses and integral types into 54 // This allows conversion of Addresses and integral types into
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 #endif 539 #endif
542 while (dest < limit) { 540 while (dest < limit) {
543 *dest++ = static_cast<sinkchar>(*src++); 541 *dest++ = static_cast<sinkchar>(*src++);
544 } 542 }
545 } 543 }
546 544
547 545
548 } } // namespace v8::internal 546 } } // namespace v8::internal
549 547
550 #endif // V8_UTILS_H_ 548 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698