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

Side by Side Diff: src/ic.cc

Issue 177683002: Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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
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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 return compiler.CompileLoadCallback(type, holder, name, info); 936 return compiler.CompileLoadCallback(type, holder, name, info);
937 } else if (callback->IsAccessorPair()) { 937 } else if (callback->IsAccessorPair()) {
938 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), 938 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(),
939 isolate()); 939 isolate());
940 if (!getter->IsJSFunction()) break; 940 if (!getter->IsJSFunction()) break;
941 if (holder->IsGlobalObject()) break; 941 if (holder->IsGlobalObject()) break;
942 if (!holder->HasFastProperties()) break; 942 if (!holder->HasFastProperties()) break;
943 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); 943 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
944 if (!object->IsJSObject() && 944 if (!object->IsJSObject() &&
945 !function->IsBuiltin() && 945 !function->IsBuiltin() &&
946 function->shared()->is_classic_mode()) { 946 function->shared()->is_sloppy_mode()) {
947 // Calling non-strict non-builtins with a value as the receiver 947 // Calling sloppy non-builtins with a value as the receiver
948 // requires boxing. 948 // requires boxing.
949 break; 949 break;
950 } 950 }
951 CallOptimization call_optimization(function); 951 CallOptimization call_optimization(function);
952 if (call_optimization.is_simple_api_call() && 952 if (call_optimization.is_simple_api_call() &&
953 call_optimization.IsCompatibleReceiver(object, holder)) { 953 call_optimization.IsCompatibleReceiver(object, holder)) {
954 return compiler.CompileLoadCallback( 954 return compiler.CompileLoadCallback(
955 type, holder, name, call_optimization); 955 type, holder, name, call_optimization);
956 } 956 }
957 return compiler.CompileLoadViaGetter(type, holder, name, function); 957 return compiler.CompileLoadViaGetter(type, holder, name, function);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 if (key->IsInternalizedString()) { 1071 if (key->IsInternalizedString()) {
1072 maybe_object = LoadIC::Load(object, Handle<String>::cast(key)); 1072 maybe_object = LoadIC::Load(object, Handle<String>::cast(key));
1073 if (maybe_object->IsFailure()) return maybe_object; 1073 if (maybe_object->IsFailure()) return maybe_object;
1074 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) { 1074 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) {
1075 ASSERT(!object->IsAccessCheckNeeded()); 1075 ASSERT(!object->IsAccessCheckNeeded());
1076 if (object->IsString() && key->IsNumber()) { 1076 if (object->IsString() && key->IsNumber()) {
1077 if (state() == UNINITIALIZED) stub = string_stub(); 1077 if (state() == UNINITIALIZED) stub = string_stub();
1078 } else if (object->IsJSObject()) { 1078 } else if (object->IsJSObject()) {
1079 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1079 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1080 if (receiver->elements()->map() == 1080 if (receiver->elements()->map() ==
1081 isolate()->heap()->non_strict_arguments_elements_map()) { 1081 isolate()->heap()->sloppy_arguments_elements_map()) {
1082 stub = non_strict_arguments_stub(); 1082 stub = sloppy_arguments_stub();
1083 } else if (receiver->HasIndexedInterceptor()) { 1083 } else if (receiver->HasIndexedInterceptor()) {
1084 stub = indexed_interceptor_stub(); 1084 stub = indexed_interceptor_stub();
1085 } else if (!key->ToSmi()->IsFailure() && 1085 } else if (!key->ToSmi()->IsFailure() &&
1086 (!target().is_identical_to(non_strict_arguments_stub()))) { 1086 (!target().is_identical_to(sloppy_arguments_stub()))) {
1087 stub = LoadElementStub(receiver); 1087 stub = LoadElementStub(receiver);
1088 } 1088 }
1089 } 1089 }
1090 } 1090 }
1091 1091
1092 if (!is_target_set()) { 1092 if (!is_target_set()) {
1093 if (*stub == *generic_stub()) { 1093 if (*stub == *generic_stub()) {
1094 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); 1094 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic");
1095 } 1095 }
1096 ASSERT(!stub.is_null()); 1096 ASSERT(!stub.is_null());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 Handle<String> name, 1307 Handle<String> name,
1308 Handle<Object> value, 1308 Handle<Object> value,
1309 InlineCacheHolderFlag cache_holder) { 1309 InlineCacheHolderFlag cache_holder) {
1310 if (object->IsAccessCheckNeeded()) return slow_stub(); 1310 if (object->IsAccessCheckNeeded()) return slow_stub();
1311 ASSERT(cache_holder == OWN_MAP); 1311 ASSERT(cache_holder == OWN_MAP);
1312 // This is currently guaranteed by checks in StoreIC::Store. 1312 // This is currently guaranteed by checks in StoreIC::Store.
1313 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1313 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1314 1314
1315 Handle<JSObject> holder(lookup->holder()); 1315 Handle<JSObject> holder(lookup->holder());
1316 // Handlers do not use strict mode. 1316 // Handlers do not use strict mode.
1317 StoreStubCompiler compiler(isolate(), kNonStrictMode, kind()); 1317 StoreStubCompiler compiler(isolate(), kSloppyMode, kind());
1318 switch (lookup->type()) { 1318 switch (lookup->type()) {
1319 case FIELD: 1319 case FIELD:
1320 return compiler.CompileStoreField(receiver, lookup, name); 1320 return compiler.CompileStoreField(receiver, lookup, name);
1321 case TRANSITION: { 1321 case TRANSITION: {
1322 // Explicitly pass in the receiver map since LookupForWrite may have 1322 // Explicitly pass in the receiver map since LookupForWrite may have
1323 // stored something else than the receiver in the holder. 1323 // stored something else than the receiver in the holder.
1324 Handle<Map> transition(lookup->GetTransitionTarget()); 1324 Handle<Map> transition(lookup->GetTransitionTarget());
1325 PropertyDetails details = transition->GetLastDescriptorDetails(); 1325 PropertyDetails details = transition->GetLastDescriptorDetails();
1326 1326
1327 if (details.type() == CALLBACKS || details.attributes() != NONE) break; 1327 if (details.type() == CALLBACKS || details.attributes() != NONE) break;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false; 1670 if (heap_object->map()->IsMapInArrayPrototypeChain()) use_ic = false;
1671 } 1671 }
1672 1672
1673 if (use_ic) { 1673 if (use_ic) {
1674 ASSERT(!object->IsAccessCheckNeeded()); 1674 ASSERT(!object->IsAccessCheckNeeded());
1675 1675
1676 if (object->IsJSObject()) { 1676 if (object->IsJSObject()) {
1677 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1677 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1678 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure(); 1678 bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure();
1679 if (receiver->elements()->map() == 1679 if (receiver->elements()->map() ==
1680 isolate()->heap()->non_strict_arguments_elements_map()) { 1680 isolate()->heap()->sloppy_arguments_elements_map()) {
1681 stub = non_strict_arguments_stub(); 1681 stub = sloppy_arguments_stub();
1682 } else if (key_is_smi_like && 1682 } else if (key_is_smi_like &&
1683 !(target().is_identical_to(non_strict_arguments_stub()))) { 1683 !(target().is_identical_to(sloppy_arguments_stub()))) {
1684 // We should go generic if receiver isn't a dictionary, but our 1684 // We should go generic if receiver isn't a dictionary, but our
1685 // prototype chain does have dictionary elements. This ensures that 1685 // prototype chain does have dictionary elements. This ensures that
1686 // other non-dictionary receivers in the polymorphic case benefit 1686 // other non-dictionary receivers in the polymorphic case benefit
1687 // from fast path keyed stores. 1687 // from fast path keyed stores.
1688 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) { 1688 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) {
1689 KeyedAccessStoreMode store_mode = 1689 KeyedAccessStoreMode store_mode =
1690 GetStoreMode(receiver, key, value); 1690 GetStoreMode(receiver, key, value);
1691 stub = StoreElementStub(receiver, store_mode); 1691 stub = StoreElementStub(receiver, store_mode);
1692 } 1692 }
1693 } 1693 }
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 #undef ADDR 2802 #undef ADDR
2803 }; 2803 };
2804 2804
2805 2805
2806 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2806 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2807 return IC_utilities[id]; 2807 return IC_utilities[id];
2808 } 2808 }
2809 2809
2810 2810
2811 } } // namespace v8::internal 2811 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698