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

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

Issue 10448097: Revert r11681 https://chromiumcodereview.appspot.com/10448011 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('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 // 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 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 offset += kPointerSize; 1604 offset += kPointerSize;
1605 } 1605 }
1606 } 1606 }
1607 1607
1608 1608
1609 bool JSObject::HasFastProperties() { 1609 bool JSObject::HasFastProperties() {
1610 return !properties()->IsDictionary(); 1610 return !properties()->IsDictionary();
1611 } 1611 }
1612 1612
1613 1613
1614 bool JSObject::TooManyFastProperties(int properties) { 1614 int JSObject::MaxFastProperties() {
1615 // Allow extra fast properties if the object has more than 1615 // Allow extra fast properties if the object has more than
1616 // kFastPropertiesSoftLimit in-object properties. When this is the case, 1616 // kMaxFastProperties in-object properties. When this is the case,
1617 // it is very unlikely that the object is being used as a dictionary 1617 // it is very unlikely that the object is being used as a dictionary
1618 // and there is a good chance that allowing more map transitions 1618 // and there is a good chance that allowing more map transitions
1619 // will be worth it. 1619 // will be worth it.
1620 int inobject = map()->inobject_properties(); 1620 return Max(map()->inobject_properties(), kMaxFastProperties);
1621
1622 int limit;
1623 if (map()->used_for_prototype()) {
1624 limit = Max(inobject, kMaxFastProperties);
1625 } else {
1626 limit = Max(inobject, kFastPropertiesSoftLimit);
1627 }
1628 return properties >= limit;
1629 } 1621 }
1630 1622
1631 1623
1632 void Struct::InitializeBody(int object_size) { 1624 void Struct::InitializeBody(int object_size) {
1633 Object* value = GetHeap()->undefined_value(); 1625 Object* value = GetHeap()->undefined_value();
1634 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { 1626 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
1635 WRITE_FIELD(this, offset, value); 1627 WRITE_FIELD(this, offset, value);
1636 } 1628 }
1637 } 1629 }
1638 1630
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 } else { 2923 } else {
2932 set_bit_field3(bit_field3() & ~(1 << kIsShared)); 2924 set_bit_field3(bit_field3() & ~(1 << kIsShared));
2933 } 2925 }
2934 } 2926 }
2935 2927
2936 bool Map::is_shared() { 2928 bool Map::is_shared() {
2937 return ((1 << kIsShared) & bit_field3()) != 0; 2929 return ((1 << kIsShared) & bit_field3()) != 0;
2938 } 2930 }
2939 2931
2940 2932
2941 void Map::set_used_for_prototype(bool value) {
2942 if (value) {
2943 set_bit_field3(bit_field3() | (1 << kUsedForPrototype));
2944 } else {
2945 set_bit_field3(bit_field3() & ~(1 << kUsedForPrototype));
2946 }
2947 }
2948
2949
2950 bool Map::used_for_prototype() {
2951 return ((1 << kUsedForPrototype) & bit_field3()) != 0;
2952 }
2953
2954
2955 JSFunction* Map::unchecked_constructor() { 2933 JSFunction* Map::unchecked_constructor() {
2956 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset)); 2934 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset));
2957 } 2935 }
2958 2936
2959 2937
2960 Code::Flags Code::flags() { 2938 Code::Flags Code::flags() {
2961 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); 2939 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
2962 } 2940 }
2963 2941
2964 2942
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
4095 4073
4096 4074
4097 Object* JSFunction::prototype() { 4075 Object* JSFunction::prototype() {
4098 ASSERT(has_prototype()); 4076 ASSERT(has_prototype());
4099 // If the function's prototype property has been set to a non-JSObject 4077 // If the function's prototype property has been set to a non-JSObject
4100 // value, that value is stored in the constructor field of the map. 4078 // value, that value is stored in the constructor field of the map.
4101 if (map()->has_non_instance_prototype()) return map()->constructor(); 4079 if (map()->has_non_instance_prototype()) return map()->constructor();
4102 return instance_prototype(); 4080 return instance_prototype();
4103 } 4081 }
4104 4082
4105
4106 bool JSFunction::should_have_prototype() { 4083 bool JSFunction::should_have_prototype() {
4107 return map()->function_with_prototype(); 4084 return map()->function_with_prototype();
4108 } 4085 }
4109 4086
4110 4087
4111 bool JSFunction::is_compiled() { 4088 bool JSFunction::is_compiled() {
4112 return code() != GetIsolate()->builtins()->builtin(Builtins::kLazyCompile); 4089 return code() != GetIsolate()->builtins()->builtin(Builtins::kLazyCompile);
4113 } 4090 }
4114 4091
4115 4092
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
5066 #undef WRITE_UINT32_FIELD 5043 #undef WRITE_UINT32_FIELD
5067 #undef READ_SHORT_FIELD 5044 #undef READ_SHORT_FIELD
5068 #undef WRITE_SHORT_FIELD 5045 #undef WRITE_SHORT_FIELD
5069 #undef READ_BYTE_FIELD 5046 #undef READ_BYTE_FIELD
5070 #undef WRITE_BYTE_FIELD 5047 #undef WRITE_BYTE_FIELD
5071 5048
5072 5049
5073 } } // namespace v8::internal 5050 } } // namespace v8::internal
5074 5051
5075 #endif // V8_OBJECTS_INL_H_ 5052 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698