| 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 Handle<JSObject> receiver, | 1661 Handle<JSObject> receiver, |
| 1662 Handle<String> name, | 1662 Handle<String> name, |
| 1663 Handle<Object> value) { | 1663 Handle<Object> value) { |
| 1664 ASSERT(!receiver->IsJSGlobalProxy()); | 1664 ASSERT(!receiver->IsJSGlobalProxy()); |
| 1665 ASSERT(lookup->IsFound()); | 1665 ASSERT(lookup->IsFound()); |
| 1666 | 1666 |
| 1667 // These are not cacheable, so we never see such LookupResults here. | 1667 // These are not cacheable, so we never see such LookupResults here. |
| 1668 ASSERT(!lookup->IsHandler()); | 1668 ASSERT(!lookup->IsHandler()); |
| 1669 | 1669 |
| 1670 Handle<Code> code = ComputeStoreMonomorphic( | 1670 Handle<Code> code = ComputeStoreMonomorphic( |
| 1671 lookup, strict_mode, receiver, name, value); | 1671 lookup, strict_mode, receiver, name); |
| 1672 if (code.is_null()) { | 1672 if (code.is_null()) { |
| 1673 Handle<Code> stub = strict_mode == kStrictMode | 1673 Handle<Code> stub = strict_mode == kStrictMode |
| 1674 ? generic_stub_strict() : generic_stub(); | 1674 ? generic_stub_strict() : generic_stub(); |
| 1675 set_target(*stub); | 1675 set_target(*stub); |
| 1676 return; | 1676 return; |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 PatchCache(state, strict_mode, receiver, name, code); | 1679 PatchCache(state, strict_mode, receiver, name, code); |
| 1680 TRACE_IC("StoreIC", name, state, target()); | 1680 TRACE_IC("StoreIC", name, state, target()); |
| 1681 } | 1681 } |
| 1682 | 1682 |
| 1683 | 1683 |
| 1684 Handle<Code> StoreIC::ComputeStoreMonomorphic(LookupResult* lookup, | 1684 Handle<Code> StoreIC::ComputeStoreMonomorphic(LookupResult* lookup, |
| 1685 StrictModeFlag strict_mode, | 1685 StrictModeFlag strict_mode, |
| 1686 Handle<JSObject> receiver, | 1686 Handle<JSObject> receiver, |
| 1687 Handle<String> name, | 1687 Handle<String> name) { |
| 1688 Handle<Object> value) { | |
| 1689 Handle<JSObject> holder(lookup->holder()); | 1688 Handle<JSObject> holder(lookup->holder()); |
| 1690 switch (lookup->type()) { | 1689 switch (lookup->type()) { |
| 1691 case FIELD: | 1690 case FIELD: |
| 1692 return isolate()->stub_cache()->ComputeStoreField( | 1691 return isolate()->stub_cache()->ComputeStoreField( |
| 1693 name, receiver, lookup, strict_mode); | 1692 name, receiver, lookup, strict_mode); |
| 1694 case NORMAL: | 1693 case NORMAL: |
| 1695 if (receiver->IsGlobalObject()) { | 1694 if (receiver->IsGlobalObject()) { |
| 1696 // The stub generated for the global object picks the value directly | 1695 // The stub generated for the global object picks the value directly |
| 1697 // from the property cell. So the property must be directly on the | 1696 // from the property cell. So the property must be directly on the |
| 1698 // global object. | 1697 // global object. |
| 1699 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); | 1698 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
| 1700 Handle<PropertyCell> cell( | 1699 Handle<PropertyCell> cell( |
| 1701 global->GetPropertyCell(lookup), isolate()); | 1700 global->GetPropertyCell(lookup), isolate()); |
| 1702 return isolate()->stub_cache()->ComputeStoreGlobal( | 1701 return isolate()->stub_cache()->ComputeStoreGlobal( |
| 1703 name, global, cell, value, strict_mode); | 1702 name, global, cell, strict_mode); |
| 1704 } | 1703 } |
| 1705 ASSERT(holder.is_identical_to(receiver)); | 1704 ASSERT(holder.is_identical_to(receiver)); |
| 1706 return isolate()->stub_cache()->ComputeStoreNormal(strict_mode); | 1705 return isolate()->stub_cache()->ComputeStoreNormal(strict_mode); |
| 1707 case CALLBACKS: { | 1706 case CALLBACKS: { |
| 1708 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); | 1707 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); |
| 1709 if (callback->IsExecutableAccessorInfo()) { | 1708 if (callback->IsExecutableAccessorInfo()) { |
| 1710 Handle<ExecutableAccessorInfo> info = | 1709 Handle<ExecutableAccessorInfo> info = |
| 1711 Handle<ExecutableAccessorInfo>::cast(callback); | 1710 Handle<ExecutableAccessorInfo>::cast(callback); |
| 1712 if (v8::ToCData<Address>(info->setter()) == 0) break; | 1711 if (v8::ToCData<Address>(info->setter()) == 0) break; |
| 1713 if (!holder->HasFastProperties()) break; | 1712 if (!holder->HasFastProperties()) break; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 } | 2086 } |
| 2088 | 2087 |
| 2089 return Runtime::SetObjectPropertyOrFail( | 2088 return Runtime::SetObjectPropertyOrFail( |
| 2090 isolate(), object , key, value, NONE, strict_mode); | 2089 isolate(), object , key, value, NONE, strict_mode); |
| 2091 } | 2090 } |
| 2092 | 2091 |
| 2093 | 2092 |
| 2094 Handle<Code> KeyedStoreIC::ComputeStoreMonomorphic(LookupResult* lookup, | 2093 Handle<Code> KeyedStoreIC::ComputeStoreMonomorphic(LookupResult* lookup, |
| 2095 StrictModeFlag strict_mode, | 2094 StrictModeFlag strict_mode, |
| 2096 Handle<JSObject> receiver, | 2095 Handle<JSObject> receiver, |
| 2097 Handle<String> name, | 2096 Handle<String> name) { |
| 2098 Handle<Object> value) { | |
| 2099 // If the property has a non-field type allowing map transitions | 2097 // If the property has a non-field type allowing map transitions |
| 2100 // where there is extra room in the object, we leave the IC in its | 2098 // where there is extra room in the object, we leave the IC in its |
| 2101 // current state. | 2099 // current state. |
| 2102 switch (lookup->type()) { | 2100 switch (lookup->type()) { |
| 2103 case FIELD: | 2101 case FIELD: |
| 2104 return isolate()->stub_cache()->ComputeKeyedStoreField( | 2102 return isolate()->stub_cache()->ComputeKeyedStoreField( |
| 2105 name, receiver, lookup, strict_mode); | 2103 name, receiver, lookup, strict_mode); |
| 2106 case TRANSITION: { | 2104 case TRANSITION: { |
| 2107 // Explicitly pass in the receiver map since LookupForWrite may have | 2105 // Explicitly pass in the receiver map since LookupForWrite may have |
| 2108 // stored something else than the receiver in the holder. | 2106 // stored something else than the receiver in the holder. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2240 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); | 2238 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); |
| 2241 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); | 2239 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); |
| 2242 return ic.Store(state, | 2240 return ic.Store(state, |
| 2243 Code::GetStrictMode(extra_ic_state), | 2241 Code::GetStrictMode(extra_ic_state), |
| 2244 args.at<Object>(0), | 2242 args.at<Object>(0), |
| 2245 args.at<String>(1), | 2243 args.at<String>(1), |
| 2246 args.at<Object>(2)); | 2244 args.at<Object>(2)); |
| 2247 } | 2245 } |
| 2248 | 2246 |
| 2249 | 2247 |
| 2250 RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure) { | |
| 2251 HandleScope scope(isolate); | |
| 2252 ASSERT(args.length() == 3); | |
| 2253 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate); | |
| 2254 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); | |
| 2255 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); | |
| 2256 return ic.Store(state, | |
| 2257 Code::GetStrictMode(extra_ic_state), | |
| 2258 args.at<Object>(0), | |
| 2259 args.at<String>(1), | |
| 2260 args.at<Object>(2)); | |
| 2261 } | |
| 2262 | |
| 2263 | |
| 2264 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { | 2248 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { |
| 2265 SealHandleScope shs(isolate); | 2249 SealHandleScope shs(isolate); |
| 2266 | 2250 |
| 2267 ASSERT(args.length() == 2); | 2251 ASSERT(args.length() == 2); |
| 2268 JSArray* receiver = JSArray::cast(args[0]); | 2252 JSArray* receiver = JSArray::cast(args[0]); |
| 2269 Object* len = args[1]; | 2253 Object* len = args[1]; |
| 2270 | 2254 |
| 2271 // The generated code should filter out non-Smis before we get here. | 2255 // The generated code should filter out non-Smis before we get here. |
| 2272 ASSERT(len->IsSmi()); | 2256 ASSERT(len->IsSmi()); |
| 2273 | 2257 |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3148 #undef ADDR | 3132 #undef ADDR |
| 3149 }; | 3133 }; |
| 3150 | 3134 |
| 3151 | 3135 |
| 3152 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3136 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3153 return IC_utilities[id]; | 3137 return IC_utilities[id]; |
| 3154 } | 3138 } |
| 3155 | 3139 |
| 3156 | 3140 |
| 3157 } } // namespace v8::internal | 3141 } } // namespace v8::internal |
| OLD | NEW |