OLD | NEW |
---|---|
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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1890 ExtractArgumentsCountFromFlags(flags) >= 0); | 1890 ExtractArgumentsCountFromFlags(flags) >= 0); |
1891 WRITE_INT_FIELD(this, kFlagsOffset, flags); | 1891 WRITE_INT_FIELD(this, kFlagsOffset, flags); |
1892 } | 1892 } |
1893 | 1893 |
1894 | 1894 |
1895 Code::Kind Code::kind() { | 1895 Code::Kind Code::kind() { |
1896 return ExtractKindFromFlags(flags()); | 1896 return ExtractKindFromFlags(flags()); |
1897 } | 1897 } |
1898 | 1898 |
1899 | 1899 |
1900 InlineCacheInLoop Code::ic_in_loop() { | |
1901 return ExtractICInLoopFromFlags(flags()); | |
1902 } | |
1903 | |
1904 | |
1900 InlineCacheState Code::ic_state() { | 1905 InlineCacheState Code::ic_state() { |
1901 InlineCacheState result = ExtractICStateFromFlags(flags()); | 1906 InlineCacheState result = ExtractICStateFromFlags(flags()); |
1902 // Only allow uninitialized or debugger states for non-IC code | 1907 // Only allow uninitialized or debugger states for non-IC code |
1903 // objects. This is used in the debugger to determine whether or not | 1908 // objects. This is used in the debugger to determine whether or not |
1904 // a call to code object has been replaced with a debug break call. | 1909 // a call to code object has been replaced with a debug break call. |
1905 ASSERT(is_inline_cache_stub() || | 1910 ASSERT(is_inline_cache_stub() || |
1906 result == UNINITIALIZED || | 1911 result == UNINITIALIZED || |
1907 result == DEBUG_BREAK || | 1912 result == DEBUG_BREAK || |
1908 result == DEBUG_PREPARE_STEP_IN); | 1913 result == DEBUG_PREPARE_STEP_IN); |
1909 return result; | 1914 return result; |
(...skipping 26 matching lines...) Expand all Loading... | |
1936 } | 1941 } |
1937 | 1942 |
1938 | 1943 |
1939 bool Code::is_inline_cache_stub() { | 1944 bool Code::is_inline_cache_stub() { |
1940 Kind kind = this->kind(); | 1945 Kind kind = this->kind(); |
1941 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 1946 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
1942 } | 1947 } |
1943 | 1948 |
1944 | 1949 |
1945 Code::Flags Code::ComputeFlags(Kind kind, | 1950 Code::Flags Code::ComputeFlags(Kind kind, |
1951 InlineCacheInLoop in_loop, | |
1946 InlineCacheState ic_state, | 1952 InlineCacheState ic_state, |
1947 PropertyType type, | 1953 PropertyType type, |
1948 int argc) { | 1954 int argc) { |
1949 // Compute the bit mask. | 1955 // Compute the bit mask. |
1950 int bits = kind << kFlagsKindShift; | 1956 int bits = kind << kFlagsKindShift; |
1957 if (in_loop) bits |= kFlagsICInLoopMask; | |
Kevin Millikin (Chromium)
2009/05/25 11:00:42
if (in_loop == IN_LOOP) ...
| |
1951 bits |= ic_state << kFlagsICStateShift; | 1958 bits |= ic_state << kFlagsICStateShift; |
1952 bits |= type << kFlagsTypeShift; | 1959 bits |= type << kFlagsTypeShift; |
1953 bits |= argc << kFlagsArgumentsCountShift; | 1960 bits |= argc << kFlagsArgumentsCountShift; |
1954 // Cast to flags and validate result before returning it. | 1961 // Cast to flags and validate result before returning it. |
1955 Flags result = static_cast<Flags>(bits); | 1962 Flags result = static_cast<Flags>(bits); |
1956 ASSERT(ExtractKindFromFlags(result) == kind); | 1963 ASSERT(ExtractKindFromFlags(result) == kind); |
1957 ASSERT(ExtractICStateFromFlags(result) == ic_state); | 1964 ASSERT(ExtractICStateFromFlags(result) == ic_state); |
1965 ASSERT(ExtractICInLoopFromFlags(result) == in_loop); | |
1958 ASSERT(ExtractTypeFromFlags(result) == type); | 1966 ASSERT(ExtractTypeFromFlags(result) == type); |
1959 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); | 1967 ASSERT(ExtractArgumentsCountFromFlags(result) == argc); |
1960 return result; | 1968 return result; |
1961 } | 1969 } |
1962 | 1970 |
1963 | 1971 |
1964 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, | 1972 Code::Flags Code::ComputeMonomorphicFlags(Kind kind, |
1965 PropertyType type, | 1973 PropertyType type, |
1974 InlineCacheInLoop in_loop, | |
1966 int argc) { | 1975 int argc) { |
1967 return ComputeFlags(kind, MONOMORPHIC, type, argc); | 1976 return ComputeFlags(kind, in_loop, MONOMORPHIC, type, argc); |
1968 } | 1977 } |
1969 | 1978 |
1970 | 1979 |
1971 Code::Kind Code::ExtractKindFromFlags(Flags flags) { | 1980 Code::Kind Code::ExtractKindFromFlags(Flags flags) { |
1972 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; | 1981 int bits = (flags & kFlagsKindMask) >> kFlagsKindShift; |
1973 return static_cast<Kind>(bits); | 1982 return static_cast<Kind>(bits); |
1974 } | 1983 } |
1975 | 1984 |
1976 | 1985 |
1977 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { | 1986 InlineCacheState Code::ExtractICStateFromFlags(Flags flags) { |
1978 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift; | 1987 int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift; |
1979 return static_cast<InlineCacheState>(bits); | 1988 return static_cast<InlineCacheState>(bits); |
1980 } | 1989 } |
1981 | 1990 |
1982 | 1991 |
1992 InlineCacheInLoop Code::ExtractICInLoopFromFlags(Flags flags) { | |
1993 int bits = (flags & kFlagsICInLoopMask); | |
1994 return bits != 0 ? IN_LOOP : NOT_IN_LOOP; | |
1995 } | |
1996 | |
1997 | |
1983 PropertyType Code::ExtractTypeFromFlags(Flags flags) { | 1998 PropertyType Code::ExtractTypeFromFlags(Flags flags) { |
1984 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; | 1999 int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift; |
1985 return static_cast<PropertyType>(bits); | 2000 return static_cast<PropertyType>(bits); |
1986 } | 2001 } |
1987 | 2002 |
1988 | 2003 |
1989 int Code::ExtractArgumentsCountFromFlags(Flags flags) { | 2004 int Code::ExtractArgumentsCountFromFlags(Flags flags) { |
1990 return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift; | 2005 return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift; |
1991 } | 2006 } |
1992 | 2007 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2630 #undef WRITE_INT_FIELD | 2645 #undef WRITE_INT_FIELD |
2631 #undef READ_SHORT_FIELD | 2646 #undef READ_SHORT_FIELD |
2632 #undef WRITE_SHORT_FIELD | 2647 #undef WRITE_SHORT_FIELD |
2633 #undef READ_BYTE_FIELD | 2648 #undef READ_BYTE_FIELD |
2634 #undef WRITE_BYTE_FIELD | 2649 #undef WRITE_BYTE_FIELD |
2635 | 2650 |
2636 | 2651 |
2637 } } // namespace v8::internal | 2652 } } // namespace v8::internal |
2638 | 2653 |
2639 #endif // V8_OBJECTS_INL_H_ | 2654 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |