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

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

Issue 172088: Analyze functions for assignment to this properties (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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/objects-debug.cc ('k') | src/parser.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 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #define SMI_ACCESSORS(holder, name, offset) \ 84 #define SMI_ACCESSORS(holder, name, offset) \
85 int holder::name() { \ 85 int holder::name() { \
86 Object* value = READ_FIELD(this, offset); \ 86 Object* value = READ_FIELD(this, offset); \
87 return Smi::cast(value)->value(); \ 87 return Smi::cast(value)->value(); \
88 } \ 88 } \
89 void holder::set_##name(int value) { \ 89 void holder::set_##name(int value) { \
90 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ 90 WRITE_FIELD(this, offset, Smi::FromInt(value)); \
91 } 91 }
92 92
93 93
94 #define BOOL_ACCESSORS(holder, field, name, offset) \ 94 #define BOOL_GETTER(holder, field, name, offset) \
95 bool holder::name() { \
96 return BooleanBit::get(field(), offset); \
97 } \
98
99
100 #define BOOL_ACCESSORS(holder, field, name, offset) \
95 bool holder::name() { \ 101 bool holder::name() { \
96 return BooleanBit::get(field(), offset); \ 102 return BooleanBit::get(field(), offset); \
97 } \ 103 } \
98 void holder::set_##name(bool value) { \ 104 void holder::set_##name(bool value) { \
99 set_##field(BooleanBit::set(field(), offset, value)); \ 105 set_##field(BooleanBit::set(field(), offset, value)); \
100 } 106 }
101 107
102 108
103 bool Object::IsInstanceOf(FunctionTemplateInfo* expected) { 109 bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
104 // There is a constraint on the object; check. 110 // There is a constraint on the object; check.
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 int Map::instance_size() { 1936 int Map::instance_size() {
1931 return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2; 1937 return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2;
1932 } 1938 }
1933 1939
1934 1940
1935 int Map::inobject_properties() { 1941 int Map::inobject_properties() {
1936 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset); 1942 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset);
1937 } 1943 }
1938 1944
1939 1945
1946 int Map::pre_allocated_property_fields() {
1947 return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset);
1948 }
1949
1950
1940 int HeapObject::SizeFromMap(Map* map) { 1951 int HeapObject::SizeFromMap(Map* map) {
1941 InstanceType instance_type = map->instance_type(); 1952 InstanceType instance_type = map->instance_type();
1942 // Only inline the most frequent cases. 1953 // Only inline the most frequent cases.
1943 if (instance_type == JS_OBJECT_TYPE || 1954 if (instance_type == JS_OBJECT_TYPE ||
1944 (instance_type & (kIsNotStringMask | kStringRepresentationMask)) == 1955 (instance_type & (kIsNotStringMask | kStringRepresentationMask)) ==
1945 (kStringTag | kConsStringTag) || 1956 (kStringTag | kConsStringTag) ||
1946 instance_type == JS_ARRAY_TYPE) return map->instance_size(); 1957 instance_type == JS_ARRAY_TYPE) return map->instance_size();
1947 if (instance_type == FIXED_ARRAY_TYPE) { 1958 if (instance_type == FIXED_ARRAY_TYPE) {
1948 return reinterpret_cast<FixedArray*>(this)->FixedArraySize(); 1959 return reinterpret_cast<FixedArray*>(this)->FixedArraySize();
1949 } 1960 }
(...skipping 12 matching lines...) Expand all
1962 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value)); 1973 WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value));
1963 } 1974 }
1964 1975
1965 1976
1966 void Map::set_inobject_properties(int value) { 1977 void Map::set_inobject_properties(int value) {
1967 ASSERT(0 <= value && value < 256); 1978 ASSERT(0 <= value && value < 256);
1968 WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value)); 1979 WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value));
1969 } 1980 }
1970 1981
1971 1982
1983 void Map::set_pre_allocated_property_fields(int value) {
1984 ASSERT(0 <= value && value < 256);
1985 WRITE_BYTE_FIELD(this,
1986 kPreAllocatedPropertyFieldsOffset,
1987 static_cast<byte>(value));
1988 }
1989
1990
1972 InstanceType Map::instance_type() { 1991 InstanceType Map::instance_type() {
1973 return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset)); 1992 return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset));
1974 } 1993 }
1975 1994
1976 1995
1977 void Map::set_instance_type(InstanceType value) { 1996 void Map::set_instance_type(InstanceType value) {
1978 ASSERT(0 <= value && value < 256); 1997 ASSERT(0 <= value && value < 256);
1979 WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value); 1998 WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value);
1980 } 1999 }
1981 2000
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 2310
2292 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 2311 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
2293 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) 2312 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
2294 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, 2313 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
2295 kInstanceClassNameOffset) 2314 kInstanceClassNameOffset)
2296 ACCESSORS(SharedFunctionInfo, function_data, Object, 2315 ACCESSORS(SharedFunctionInfo, function_data, Object,
2297 kExternalReferenceDataOffset) 2316 kExternalReferenceDataOffset)
2298 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) 2317 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
2299 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) 2318 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
2300 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) 2319 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
2320 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object,
2321 kThisPropertyAssignmentsOffset)
2301 2322
2302 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, 2323 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
2303 kHiddenPrototypeBit) 2324 kHiddenPrototypeBit)
2304 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) 2325 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
2305 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, 2326 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check,
2306 kNeedsAccessCheckBit) 2327 kNeedsAccessCheckBit)
2307 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, 2328 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression,
2308 kIsExpressionBit) 2329 kIsExpressionBit)
2309 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, 2330 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel,
2310 kIsTopLevelBit) 2331 kIsTopLevelBit)
2332 BOOL_GETTER(SharedFunctionInfo, compiler_hints,
2333 has_only_this_property_assignments,
2334 kHasOnlyThisPropertyAssignments)
2335 BOOL_GETTER(SharedFunctionInfo, compiler_hints,
2336 has_only_simple_this_property_assignments,
2337 kHasOnlySimpleThisPropertyAssignments)
2338
2311 2339
2312 INT_ACCESSORS(SharedFunctionInfo, length, kLengthOffset) 2340 INT_ACCESSORS(SharedFunctionInfo, length, kLengthOffset)
2313 INT_ACCESSORS(SharedFunctionInfo, formal_parameter_count, 2341 INT_ACCESSORS(SharedFunctionInfo, formal_parameter_count,
2314 kFormalParameterCountOffset) 2342 kFormalParameterCountOffset)
2315 INT_ACCESSORS(SharedFunctionInfo, expected_nof_properties, 2343 INT_ACCESSORS(SharedFunctionInfo, expected_nof_properties,
2316 kExpectedNofPropertiesOffset) 2344 kExpectedNofPropertiesOffset)
2317 INT_ACCESSORS(SharedFunctionInfo, start_position_and_type, 2345 INT_ACCESSORS(SharedFunctionInfo, start_position_and_type,
2318 kStartPositionAndTypeOffset) 2346 kStartPositionAndTypeOffset)
2319 INT_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) 2347 INT_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset)
2320 INT_ACCESSORS(SharedFunctionInfo, function_token_position, 2348 INT_ACCESSORS(SharedFunctionInfo, function_token_position,
2321 kFunctionTokenPositionOffset) 2349 kFunctionTokenPositionOffset)
2350 INT_ACCESSORS(SharedFunctionInfo, compiler_hints,
2351 kCompilerHintsOffset)
2352 INT_ACCESSORS(SharedFunctionInfo, this_property_assignments_count,
2353 kThisPropertyAssignmentsCountOffset)
2322 2354
2323 2355
2324 void SharedFunctionInfo::DontAdaptArguments() { 2356 void SharedFunctionInfo::DontAdaptArguments() {
2325 ASSERT(code()->kind() == Code::BUILTIN); 2357 ASSERT(code()->kind() == Code::BUILTIN);
2326 set_formal_parameter_count(kDontAdaptArgumentsSentinel); 2358 set_formal_parameter_count(kDontAdaptArgumentsSentinel);
2327 } 2359 }
2328 2360
2329 2361
2330 int SharedFunctionInfo::start_position() { 2362 int SharedFunctionInfo::start_position() {
2331 return start_position_and_type() >> kStartPositionShift; 2363 return start_position_and_type() >> kStartPositionShift;
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2848 #undef WRITE_INT_FIELD 2880 #undef WRITE_INT_FIELD
2849 #undef READ_SHORT_FIELD 2881 #undef READ_SHORT_FIELD
2850 #undef WRITE_SHORT_FIELD 2882 #undef WRITE_SHORT_FIELD
2851 #undef READ_BYTE_FIELD 2883 #undef READ_BYTE_FIELD
2852 #undef WRITE_BYTE_FIELD 2884 #undef WRITE_BYTE_FIELD
2853 2885
2854 2886
2855 } } // namespace v8::internal 2887 } } // namespace v8::internal
2856 2888
2857 #endif // V8_OBJECTS_INL_H_ 2889 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698