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

Side by Side Diff: src/ic/ic.cc

Issue 1233453004: Version 4.4.63.16 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.4
Patch Set: Created 5 years, 5 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
« no previous file with comments | « include/v8-version.h ('k') | test/cctest/test-api.cc » ('j') | 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 // 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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 } else if (!lookup->IsFound()) { 1105 } else if (!lookup->IsFound()) {
1106 if (kind() == Code::LOAD_IC) { 1106 if (kind() == Code::LOAD_IC) {
1107 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), 1107 code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(),
1108 receiver_map()); 1108 receiver_map());
1109 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. 1109 // TODO(jkummerow/verwaest): Introduce a builtin that handles this case.
1110 if (code.is_null()) code = slow_stub(); 1110 if (code.is_null()) code = slow_stub();
1111 } else { 1111 } else {
1112 code = slow_stub(); 1112 code = slow_stub();
1113 } 1113 }
1114 } else { 1114 } else {
1115 code = ComputeHandler(lookup); 1115 if (lookup->state() == LookupIterator::ACCESSOR) {
1116 Handle<Object> accessors = lookup->GetAccessors();
1117 Handle<Map> map = receiver_map();
1118 if (accessors->IsExecutableAccessorInfo()) {
1119 Handle<ExecutableAccessorInfo> info =
1120 Handle<ExecutableAccessorInfo>::cast(accessors);
1121 if ((v8::ToCData<Address>(info->getter()) != 0) &&
1122 !ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info,
1123 map)) {
1124 TRACE_GENERIC_IC(isolate(), "LoadIC", "incompatible receiver type");
1125 code = slow_stub();
1126 }
1127 } else if (accessors->IsAccessorPair()) {
1128 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
1129 isolate());
1130 Handle<JSObject> holder = lookup->GetHolder<JSObject>();
1131 Handle<Object> receiver = lookup->GetReceiver();
1132 if (getter->IsJSFunction() && holder->HasFastProperties()) {
1133 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
1134 if (receiver->IsJSObject() || function->IsBuiltin() ||
1135 !is_sloppy(function->shared()->language_mode())) {
1136 CallOptimization call_optimization(function);
1137 if (call_optimization.is_simple_api_call() &&
1138 !call_optimization.IsCompatibleReceiver(receiver, holder)) {
1139 TRACE_GENERIC_IC(isolate(), "LoadIC",
1140 "incompatible receiver type");
1141 code = slow_stub();
1142 }
1143 }
1144 }
1145 }
1146 }
1147 if (code.is_null()) code = ComputeHandler(lookup);
1116 } 1148 }
1117 1149
1118 PatchCache(lookup->name(), code); 1150 PatchCache(lookup->name(), code);
1119 TRACE_IC("LoadIC", lookup->name()); 1151 TRACE_IC("LoadIC", lookup->name());
1120 } 1152 }
1121 1153
1122 1154
1123 void IC::UpdateMegamorphicCache(Map* map, Name* name, Code* code) { 1155 void IC::UpdateMegamorphicCache(Map* map, Name* name, Code* code) {
1124 isolate()->stub_cache()->Set(name, map, code); 1156 isolate()->stub_cache()->Set(name, map, code);
1125 } 1157 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 return stub.GetCode(); 1267 return stub.GetCode();
1236 } 1268 }
1237 1269
1238 Handle<Object> accessors = lookup->GetAccessors(); 1270 Handle<Object> accessors = lookup->GetAccessors();
1239 if (accessors->IsExecutableAccessorInfo()) { 1271 if (accessors->IsExecutableAccessorInfo()) {
1240 Handle<ExecutableAccessorInfo> info = 1272 Handle<ExecutableAccessorInfo> info =
1241 Handle<ExecutableAccessorInfo>::cast(accessors); 1273 Handle<ExecutableAccessorInfo>::cast(accessors);
1242 if (v8::ToCData<Address>(info->getter()) == 0) break; 1274 if (v8::ToCData<Address>(info->getter()) == 0) break;
1243 if (!ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info, 1275 if (!ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info,
1244 map)) { 1276 map)) {
1277 // This case should be already handled in LoadIC::UpdateCaches.
1278 UNREACHABLE();
1245 break; 1279 break;
1246 } 1280 }
1247 if (!holder->HasFastProperties()) break; 1281 if (!holder->HasFastProperties()) break;
1248 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); 1282 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
1249 return compiler.CompileLoadCallback(lookup->name(), info); 1283 return compiler.CompileLoadCallback(lookup->name(), info);
1250 } 1284 }
1251 if (accessors->IsAccessorPair()) { 1285 if (accessors->IsAccessorPair()) {
1252 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), 1286 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
1253 isolate()); 1287 isolate());
1254 if (!getter->IsJSFunction()) break; 1288 if (!getter->IsJSFunction()) break;
1255 if (!holder->HasFastProperties()) break; 1289 if (!holder->HasFastProperties()) break;
1256 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); 1290 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
1257 if (!receiver->IsJSObject() && !function->IsBuiltin() && 1291 if (!receiver->IsJSObject() && !function->IsBuiltin() &&
1258 is_sloppy(function->shared()->language_mode())) { 1292 is_sloppy(function->shared()->language_mode())) {
1259 // Calling sloppy non-builtins with a value as the receiver 1293 // Calling sloppy non-builtins with a value as the receiver
1260 // requires boxing. 1294 // requires boxing.
1261 break; 1295 break;
1262 } 1296 }
1263 CallOptimization call_optimization(function); 1297 CallOptimization call_optimization(function);
1264 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); 1298 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
1265 if (call_optimization.is_simple_api_call() && 1299 if (call_optimization.is_simple_api_call()) {
1266 call_optimization.IsCompatibleReceiver(receiver, holder)) { 1300 if (call_optimization.IsCompatibleReceiver(receiver, holder)) {
1267 return compiler.CompileLoadCallback(lookup->name(), call_optimization, 1301 return compiler.CompileLoadCallback(
1268 lookup->GetAccessorIndex()); 1302 lookup->name(), call_optimization, lookup->GetAccessorIndex());
1303 } else {
1304 // This case should be already handled in LoadIC::UpdateCaches.
1305 UNREACHABLE();
1306 }
1269 } 1307 }
1270 int expected_arguments = 1308 int expected_arguments =
1271 function->shared()->internal_formal_parameter_count(); 1309 function->shared()->internal_formal_parameter_count();
1272 return compiler.CompileLoadViaGetter( 1310 return compiler.CompileLoadViaGetter(
1273 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); 1311 lookup->name(), lookup->GetAccessorIndex(), expected_arguments);
1274 } 1312 }
1275 break; 1313 break;
1276 } 1314 }
1277 1315
1278 case LookupIterator::DATA: { 1316 case LookupIterator::DATA: {
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 static const Address IC_utilities[] = { 3090 static const Address IC_utilities[] = {
3053 #define ADDR(name) FUNCTION_ADDR(name), 3091 #define ADDR(name) FUNCTION_ADDR(name),
3054 IC_UTIL_LIST(ADDR) NULL 3092 IC_UTIL_LIST(ADDR) NULL
3055 #undef ADDR 3093 #undef ADDR
3056 }; 3094 };
3057 3095
3058 3096
3059 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3097 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3060 } 3098 }
3061 } // namespace v8::internal 3099 } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698