OLD | NEW |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 | 103 |
104 InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object, | 104 InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object, |
105 JSObject* holder) { | 105 JSObject* holder) { |
106 if (object->IsJSObject()) { | 106 if (object->IsJSObject()) { |
107 return GetCodeCacheForObject(JSObject::cast(object), holder); | 107 return GetCodeCacheForObject(JSObject::cast(object), holder); |
108 } | 108 } |
109 // If the object is a value, we use the prototype map for the cache. | 109 // If the object is a value, we use the prototype map for the cache. |
110 ASSERT(object->IsString() || object->IsSymbol() || | 110 ASSERT(object->IsString() || object->IsSymbol() || |
111 object->IsNumber() || object->IsBoolean()); | 111 object->IsNumber() || object->IsBoolean()); |
112 return DELEGATE_MAP; | 112 return PROTOTYPE_MAP; |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 InlineCacheHolderFlag IC::GetCodeCacheForObject(JSObject* object, | 116 InlineCacheHolderFlag IC::GetCodeCacheForObject(JSObject* object, |
117 JSObject* holder) { | 117 JSObject* holder) { |
118 // Fast-properties and global objects store stubs in their own maps. | 118 // Fast-properties and global objects store stubs in their own maps. |
119 // Slow properties objects use prototype's map (unless the property is its own | 119 // Slow properties objects use prototype's map (unless the property is its own |
120 // when holder == object). It works because slow properties objects having | 120 // when holder == object). It works because slow properties objects having |
121 // the same prototype (or a prototype with the same map) and not having | 121 // the same prototype (or a prototype with the same map) and not having |
122 // the property are interchangeable for such a stub. | 122 // the property are interchangeable for such a stub. |
123 if (holder != object && | 123 if (holder != object && |
124 !object->HasFastProperties() && | 124 !object->HasFastProperties() && |
125 !object->IsJSGlobalProxy() && | 125 !object->IsJSGlobalProxy() && |
126 !object->IsJSGlobalObject()) { | 126 !object->IsJSGlobalObject()) { |
127 return DELEGATE_MAP; | 127 return PROTOTYPE_MAP; |
128 } | 128 } |
129 return OWN_MAP; | 129 return OWN_MAP; |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 JSObject* IC::GetCodeCacheHolder(Isolate* isolate, | 133 JSObject* IC::GetCodeCacheHolder(Isolate* isolate, |
134 Object* object, | 134 Object* object, |
135 InlineCacheHolderFlag holder) { | 135 InlineCacheHolderFlag holder) { |
136 Object* map_owner = holder == OWN_MAP ? object : object->GetDelegate(isolate); | 136 Object* map_owner = |
| 137 holder == OWN_MAP ? object : object->GetPrototype(isolate); |
137 ASSERT(map_owner->IsJSObject()); | 138 ASSERT(map_owner->IsJSObject()); |
138 return JSObject::cast(map_owner); | 139 return JSObject::cast(map_owner); |
139 } | 140 } |
140 | 141 |
141 | 142 |
142 } } // namespace v8::internal | 143 } } // namespace v8::internal |
143 | 144 |
144 #endif // V8_IC_INL_H_ | 145 #endif // V8_IC_INL_H_ |
OLD | NEW |