OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "arguments.h" | 9 #include "arguments.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 return JSArray::cast(*receiver)->length()->IsSmi() && | 1622 return JSArray::cast(*receiver)->length()->IsSmi() && |
1623 index >= Smi::cast(JSArray::cast(*receiver)->length())->value(); | 1623 index >= Smi::cast(JSArray::cast(*receiver)->length())->value(); |
1624 } | 1624 } |
1625 return index >= receiver->elements()->length(); | 1625 return index >= receiver->elements()->length(); |
1626 } | 1626 } |
1627 | 1627 |
1628 | 1628 |
1629 KeyedAccessStoreMode KeyedStoreIC::GetStoreMode(Handle<JSObject> receiver, | 1629 KeyedAccessStoreMode KeyedStoreIC::GetStoreMode(Handle<JSObject> receiver, |
1630 Handle<Object> key, | 1630 Handle<Object> key, |
1631 Handle<Object> value) { | 1631 Handle<Object> value) { |
1632 Handle<Object> smi_key = Object::ToSmi(isolate(), key); | 1632 Handle<Smi> smi_key = Object::ToSmi(isolate(), key).ToHandleChecked(); |
1633 ASSERT(!smi_key.is_null() && smi_key->IsSmi()); | 1633 int index = smi_key->value(); |
1634 int index = Handle<Smi>::cast(smi_key)->value(); | |
1635 bool oob_access = IsOutOfBoundsAccess(receiver, index); | 1634 bool oob_access = IsOutOfBoundsAccess(receiver, index); |
1636 // Don't consider this a growing store if the store would send the receiver to | 1635 // Don't consider this a growing store if the store would send the receiver to |
1637 // dictionary mode. | 1636 // dictionary mode. |
1638 bool allow_growth = receiver->IsJSArray() && oob_access && | 1637 bool allow_growth = receiver->IsJSArray() && oob_access && |
1639 !receiver->WouldConvertToSlowElements(key); | 1638 !receiver->WouldConvertToSlowElements(key); |
1640 if (allow_growth) { | 1639 if (allow_growth) { |
1641 // Handle growing array in stub if necessary. | 1640 // Handle growing array in stub if necessary. |
1642 if (receiver->HasFastSmiElements()) { | 1641 if (receiver->HasFastSmiElements()) { |
1643 if (value->IsHeapNumber()) { | 1642 if (value->IsHeapNumber()) { |
1644 if (receiver->HasFastHoleyElements()) { | 1643 if (receiver->HasFastHoleyElements()) { |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2923 #undef ADDR | 2922 #undef ADDR |
2924 }; | 2923 }; |
2925 | 2924 |
2926 | 2925 |
2927 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2926 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2928 return IC_utilities[id]; | 2927 return IC_utilities[id]; |
2929 } | 2928 } |
2930 | 2929 |
2931 | 2930 |
2932 } } // namespace v8::internal | 2931 } } // namespace v8::internal |
OLD | NEW |