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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { | 1219 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { |
1220 // This helper implements a few common fast cases for converting | 1220 // This helper implements a few common fast cases for converting |
1221 // non-smi keys of keyed loads/stores to a smi or a string. | 1221 // non-smi keys of keyed loads/stores to a smi or a string. |
1222 if (key->IsHeapNumber()) { | 1222 if (key->IsHeapNumber()) { |
1223 double value = Handle<HeapNumber>::cast(key)->value(); | 1223 double value = Handle<HeapNumber>::cast(key)->value(); |
1224 if (std::isnan(value)) { | 1224 if (std::isnan(value)) { |
1225 key = isolate->factory()->nan_string(); | 1225 key = isolate->factory()->nan_string(); |
1226 } else { | 1226 } else { |
1227 int int_value = FastD2I(value); | 1227 int int_value = FastD2I(value); |
1228 if (value == int_value && Smi::IsValid(int_value)) { | 1228 if (value == int_value && Smi::IsValid(int_value)) { |
1229 key = handle(Smi::FromInt(int_value), isolate); | 1229 key = Handle<Smi>(Smi::FromInt(int_value), isolate); |
1230 } | 1230 } |
1231 } | 1231 } |
1232 } else if (key->IsUndefined()) { | 1232 } else if (key->IsUndefined()) { |
1233 key = isolate->factory()->undefined_string(); | 1233 key = isolate->factory()->undefined_string(); |
1234 } | 1234 } |
1235 return key; | 1235 return key; |
1236 } | 1236 } |
1237 | 1237 |
1238 | 1238 |
1239 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { | 1239 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 static const Address IC_utilities[] = { | 2896 static const Address IC_utilities[] = { |
2897 #define ADDR(name) FUNCTION_ADDR(name), | 2897 #define ADDR(name) FUNCTION_ADDR(name), |
2898 IC_UTIL_LIST(ADDR) NULL | 2898 IC_UTIL_LIST(ADDR) NULL |
2899 #undef ADDR | 2899 #undef ADDR |
2900 }; | 2900 }; |
2901 | 2901 |
2902 | 2902 |
2903 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2903 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
2904 } // namespace internal | 2904 } // namespace internal |
2905 } // namespace v8 | 2905 } // namespace v8 |
OLD | NEW |