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); | 1671 lookup, strict_mode, receiver, name, value); |
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) { |
1688 Handle<JSObject> holder(lookup->holder()); | 1689 Handle<JSObject> holder(lookup->holder()); |
1689 switch (lookup->type()) { | 1690 switch (lookup->type()) { |
1690 case FIELD: | 1691 case FIELD: |
1691 return isolate()->stub_cache()->ComputeStoreField( | 1692 return isolate()->stub_cache()->ComputeStoreField( |
1692 name, receiver, lookup, strict_mode); | 1693 name, receiver, lookup, strict_mode); |
1693 case NORMAL: | 1694 case NORMAL: |
1694 if (receiver->IsGlobalObject()) { | 1695 if (receiver->IsGlobalObject()) { |
1695 // The stub generated for the global object picks the value directly | 1696 // The stub generated for the global object picks the value directly |
1696 // from the property cell. So the property must be directly on the | 1697 // from the property cell. So the property must be directly on the |
1697 // global object. | 1698 // global object. |
1698 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); | 1699 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
1699 Handle<PropertyCell> cell( | 1700 Handle<PropertyCell> cell( |
1700 global->GetPropertyCell(lookup), isolate()); | 1701 global->GetPropertyCell(lookup), isolate()); |
1701 return isolate()->stub_cache()->ComputeStoreGlobal( | 1702 return isolate()->stub_cache()->ComputeStoreGlobal( |
1702 name, global, cell, strict_mode); | 1703 name, global, cell, value, strict_mode); |
1703 } | 1704 } |
1704 ASSERT(holder.is_identical_to(receiver)); | 1705 ASSERT(holder.is_identical_to(receiver)); |
1705 return isolate()->stub_cache()->ComputeStoreNormal(strict_mode); | 1706 return isolate()->stub_cache()->ComputeStoreNormal(strict_mode); |
1706 case CALLBACKS: { | 1707 case CALLBACKS: { |
1707 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); | 1708 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); |
1708 if (callback->IsExecutableAccessorInfo()) { | 1709 if (callback->IsExecutableAccessorInfo()) { |
1709 Handle<ExecutableAccessorInfo> info = | 1710 Handle<ExecutableAccessorInfo> info = |
1710 Handle<ExecutableAccessorInfo>::cast(callback); | 1711 Handle<ExecutableAccessorInfo>::cast(callback); |
1711 if (v8::ToCData<Address>(info->setter()) == 0) break; | 1712 if (v8::ToCData<Address>(info->setter()) == 0) break; |
1712 if (!holder->HasFastProperties()) break; | 1713 if (!holder->HasFastProperties()) break; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 } | 2087 } |
2087 | 2088 |
2088 return Runtime::SetObjectPropertyOrFail( | 2089 return Runtime::SetObjectPropertyOrFail( |
2089 isolate(), object , key, value, NONE, strict_mode); | 2090 isolate(), object , key, value, NONE, strict_mode); |
2090 } | 2091 } |
2091 | 2092 |
2092 | 2093 |
2093 Handle<Code> KeyedStoreIC::ComputeStoreMonomorphic(LookupResult* lookup, | 2094 Handle<Code> KeyedStoreIC::ComputeStoreMonomorphic(LookupResult* lookup, |
2094 StrictModeFlag strict_mode, | 2095 StrictModeFlag strict_mode, |
2095 Handle<JSObject> receiver, | 2096 Handle<JSObject> receiver, |
2096 Handle<String> name) { | 2097 Handle<String> name, |
| 2098 Handle<Object> value) { |
2097 // If the property has a non-field type allowing map transitions | 2099 // If the property has a non-field type allowing map transitions |
2098 // where there is extra room in the object, we leave the IC in its | 2100 // where there is extra room in the object, we leave the IC in its |
2099 // current state. | 2101 // current state. |
2100 switch (lookup->type()) { | 2102 switch (lookup->type()) { |
2101 case FIELD: | 2103 case FIELD: |
2102 return isolate()->stub_cache()->ComputeKeyedStoreField( | 2104 return isolate()->stub_cache()->ComputeKeyedStoreField( |
2103 name, receiver, lookup, strict_mode); | 2105 name, receiver, lookup, strict_mode); |
2104 case TRANSITION: { | 2106 case TRANSITION: { |
2105 // Explicitly pass in the receiver map since LookupForWrite may have | 2107 // Explicitly pass in the receiver map since LookupForWrite may have |
2106 // stored something else than the receiver in the holder. | 2108 // stored something else than the receiver in the holder. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); | 2240 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); |
2239 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); | 2241 Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state(); |
2240 return ic.Store(state, | 2242 return ic.Store(state, |
2241 Code::GetStrictMode(extra_ic_state), | 2243 Code::GetStrictMode(extra_ic_state), |
2242 args.at<Object>(0), | 2244 args.at<Object>(0), |
2243 args.at<String>(1), | 2245 args.at<String>(1), |
2244 args.at<Object>(2)); | 2246 args.at<Object>(2)); |
2245 } | 2247 } |
2246 | 2248 |
2247 | 2249 |
| 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 |
2248 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { | 2264 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { |
2249 SealHandleScope shs(isolate); | 2265 SealHandleScope shs(isolate); |
2250 | 2266 |
2251 ASSERT(args.length() == 2); | 2267 ASSERT(args.length() == 2); |
2252 JSArray* receiver = JSArray::cast(args[0]); | 2268 JSArray* receiver = JSArray::cast(args[0]); |
2253 Object* len = args[1]; | 2269 Object* len = args[1]; |
2254 | 2270 |
2255 // The generated code should filter out non-Smis before we get here. | 2271 // The generated code should filter out non-Smis before we get here. |
2256 ASSERT(len->IsSmi()); | 2272 ASSERT(len->IsSmi()); |
2257 | 2273 |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 #undef ADDR | 3033 #undef ADDR |
3018 }; | 3034 }; |
3019 | 3035 |
3020 | 3036 |
3021 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3037 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3022 return IC_utilities[id]; | 3038 return IC_utilities[id]; |
3023 } | 3039 } |
3024 | 3040 |
3025 | 3041 |
3026 } } // namespace v8::internal | 3042 } } // namespace v8::internal |
OLD | NEW |