| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 PostPatching(address, target, old_target); | 100 PostPatching(address, target, old_target); |
| 101 } | 101 } |
| 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->IsNumber() || object->IsBoolean()); | 110 ASSERT(object->IsString() || object->IsSymbol() || |
| 111 return PROTOTYPE_MAP; | 111 object->IsNumber() || object->IsBoolean()); |
| 112 return DELEGATE_MAP; |
| 112 } | 113 } |
| 113 | 114 |
| 114 | 115 |
| 115 InlineCacheHolderFlag IC::GetCodeCacheForObject(JSObject* object, | 116 InlineCacheHolderFlag IC::GetCodeCacheForObject(JSObject* object, |
| 116 JSObject* holder) { | 117 JSObject* holder) { |
| 117 // Fast-properties and global objects store stubs in their own maps. | 118 // Fast-properties and global objects store stubs in their own maps. |
| 118 // 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 |
| 119 // when holder == object). It works because slow properties objects having | 120 // when holder == object). It works because slow properties objects having |
| 120 // 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 |
| 121 // the property are interchangeable for such a stub. | 122 // the property are interchangeable for such a stub. |
| 122 if (holder != object && | 123 if (holder != object && |
| 123 !object->HasFastProperties() && | 124 !object->HasFastProperties() && |
| 124 !object->IsJSGlobalProxy() && | 125 !object->IsJSGlobalProxy() && |
| 125 !object->IsJSGlobalObject()) { | 126 !object->IsJSGlobalObject()) { |
| 126 return PROTOTYPE_MAP; | 127 return DELEGATE_MAP; |
| 127 } | 128 } |
| 128 return OWN_MAP; | 129 return OWN_MAP; |
| 129 } | 130 } |
| 130 | 131 |
| 131 | 132 |
| 132 JSObject* IC::GetCodeCacheHolder(Object* object, InlineCacheHolderFlag holder) { | 133 JSObject* IC::GetCodeCacheHolder(Object* object, InlineCacheHolderFlag holder) { |
| 133 Object* map_owner = (holder == OWN_MAP ? object : object->GetPrototype()); | 134 Object* map_owner = (holder == OWN_MAP ? object : object->GetDelegate()); |
| 134 ASSERT(map_owner->IsJSObject()); | 135 ASSERT(map_owner->IsJSObject()); |
| 135 return JSObject::cast(map_owner); | 136 return JSObject::cast(map_owner); |
| 136 } | 137 } |
| 137 | 138 |
| 138 | 139 |
| 139 } } // namespace v8::internal | 140 } } // namespace v8::internal |
| 140 | 141 |
| 141 #endif // V8_IC_INL_H_ | 142 #endif // V8_IC_INL_H_ |
| OLD | NEW |