Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: src/ic.cc

Issue 163213002: Do not internalize in TryConvertKey. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 if (key->IsHeapNumber()) { 976 if (key->IsHeapNumber()) {
977 double value = Handle<HeapNumber>::cast(key)->value(); 977 double value = Handle<HeapNumber>::cast(key)->value();
978 if (std::isnan(value)) { 978 if (std::isnan(value)) {
979 key = isolate->factory()->nan_string(); 979 key = isolate->factory()->nan_string();
980 } else { 980 } else {
981 int int_value = FastD2I(value); 981 int int_value = FastD2I(value);
982 if (value == int_value && Smi::IsValid(int_value)) { 982 if (value == int_value && Smi::IsValid(int_value)) {
983 key = Handle<Smi>(Smi::FromInt(int_value), isolate); 983 key = Handle<Smi>(Smi::FromInt(int_value), isolate);
984 } 984 }
985 } 985 }
986 } else if (key->IsString()) {
987 key = isolate->factory()->InternalizeString(Handle<String>::cast(key));
988 } else if (key->IsUndefined()) { 986 } else if (key->IsUndefined()) {
989 key = isolate->factory()->undefined_string(); 987 key = isolate->factory()->undefined_string();
990 } 988 }
991 return key; 989 return key;
992 } 990 }
993 991
994 992
995 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) { 993 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) {
996 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS 994 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS
997 // via megamorphic stubs, since they don't have a map in their relocation info 995 // via megamorphic stubs, since they don't have a map in their relocation info
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1054
1057 1055
1058 MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) { 1056 MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) {
1059 if (MigrateDeprecated(object)) { 1057 if (MigrateDeprecated(object)) {
1060 return Runtime::GetObjectPropertyOrFail(isolate(), object, key); 1058 return Runtime::GetObjectPropertyOrFail(isolate(), object, key);
1061 } 1059 }
1062 1060
1063 MaybeObject* maybe_object = NULL; 1061 MaybeObject* maybe_object = NULL;
1064 Handle<Code> stub = generic_stub(); 1062 Handle<Code> stub = generic_stub();
1065 1063
1066 // Check for values that can be converted into an internalized string directly 1064 // Check for non-string values that can be converted into an
1067 // or is representable as a smi. 1065 // internalized string directly or is representable as a smi.
1068 key = TryConvertKey(key, isolate()); 1066 key = TryConvertKey(key, isolate());
1069 1067
1070 if (key->IsInternalizedString()) { 1068 if (key->IsInternalizedString()) {
1071 maybe_object = LoadIC::Load(object, Handle<String>::cast(key)); 1069 maybe_object = LoadIC::Load(object, Handle<String>::cast(key));
1072 if (maybe_object->IsFailure()) return maybe_object; 1070 if (maybe_object->IsFailure()) return maybe_object;
1073 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) { 1071 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) {
1074 ASSERT(!object->IsJSGlobalProxy()); 1072 ASSERT(!object->IsJSGlobalProxy());
1075 if (object->IsString() && key->IsNumber()) { 1073 if (object->IsString() && key->IsNumber()) {
1076 if (state() == UNINITIALIZED) stub = string_stub(); 1074 if (state() == UNINITIALIZED) stub = string_stub();
1077 } else if (object->IsJSObject()) { 1075 } else if (object->IsJSObject()) {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 if (MigrateDeprecated(object)) { 1651 if (MigrateDeprecated(object)) {
1654 Handle<Object> result = Runtime::SetObjectProperty(isolate(), object, 1652 Handle<Object> result = Runtime::SetObjectProperty(isolate(), object,
1655 key, 1653 key,
1656 value, 1654 value,
1657 NONE, 1655 NONE,
1658 strict_mode()); 1656 strict_mode());
1659 RETURN_IF_EMPTY_HANDLE(isolate(), result); 1657 RETURN_IF_EMPTY_HANDLE(isolate(), result);
1660 return *result; 1658 return *result;
1661 } 1659 }
1662 1660
1663 // Check for values that can be converted into an internalized string directly 1661 // Check for non-string values that can be converted into an
1664 // or is representable as a smi. 1662 // internalized string directly or is representable as a smi.
1665 key = TryConvertKey(key, isolate()); 1663 key = TryConvertKey(key, isolate());
1666 1664
1667 MaybeObject* maybe_object = NULL; 1665 MaybeObject* maybe_object = NULL;
1668 Handle<Code> stub = generic_stub(); 1666 Handle<Code> stub = generic_stub();
1669 1667
1670 if (key->IsInternalizedString()) { 1668 if (key->IsInternalizedString()) {
1671 maybe_object = StoreIC::Store(object, 1669 maybe_object = StoreIC::Store(object,
1672 Handle<String>::cast(key), 1670 Handle<String>::cast(key),
1673 value, 1671 value,
1674 JSReceiver::MAY_BE_STORE_FROM_KEYED); 1672 JSReceiver::MAY_BE_STORE_FROM_KEYED);
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 #undef ADDR 2815 #undef ADDR
2818 }; 2816 };
2819 2817
2820 2818
2821 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2819 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2822 return IC_utilities[id]; 2820 return IC_utilities[id];
2823 } 2821 }
2824 2822
2825 2823
2826 } } // namespace v8::internal 2824 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698