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

Side by Side Diff: src/ic.cc

Issue 293023: Added infrastructure for optimizing new CanvasArray types in WebGL... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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 | « src/ic.h ('k') | src/messages.js » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 SetTargetAtAddress(address, initialize_stub()); 258 SetTargetAtAddress(address, initialize_stub());
259 } 259 }
260 260
261 261
262 void KeyedStoreIC::Clear(Address address, Code* target) { 262 void KeyedStoreIC::Clear(Address address, Code* target) {
263 if (target->ic_state() == UNINITIALIZED) return; 263 if (target->ic_state() == UNINITIALIZED) return;
264 SetTargetAtAddress(address, initialize_stub()); 264 SetTargetAtAddress(address, initialize_stub());
265 } 265 }
266 266
267 267
268 Code* KeyedLoadIC::external_array_stub(JSObject::ElementsKind elements_kind) {
269 switch (elements_kind) {
270 case JSObject::EXTERNAL_BYTE_ELEMENTS:
271 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalByteArray);
272 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
273 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalUnsignedByteArray);
274 case JSObject::EXTERNAL_SHORT_ELEMENTS:
275 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalShortArray);
276 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
277 return Builtins::builtin(
278 Builtins::KeyedLoadIC_ExternalUnsignedShortArray);
279 case JSObject::EXTERNAL_INT_ELEMENTS:
280 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalIntArray);
281 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
282 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalUnsignedIntArray);
283 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
284 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalFloatArray);
285 default:
286 UNREACHABLE();
287 return NULL;
288 }
289 }
290
291
292 Code* KeyedStoreIC::external_array_stub(JSObject::ElementsKind elements_kind) {
293 switch (elements_kind) {
294 case JSObject::EXTERNAL_BYTE_ELEMENTS:
295 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalByteArray);
296 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
297 return Builtins::builtin(
298 Builtins::KeyedStoreIC_ExternalUnsignedByteArray);
299 case JSObject::EXTERNAL_SHORT_ELEMENTS:
300 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalShortArray);
301 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
302 return Builtins::builtin(
303 Builtins::KeyedStoreIC_ExternalUnsignedShortArray);
304 case JSObject::EXTERNAL_INT_ELEMENTS:
305 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalIntArray);
306 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
307 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalUnsignedIntArray);
308 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
309 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalFloatArray);
310 default:
311 UNREACHABLE();
312 return NULL;
313 }
314 }
315
316
268 static bool HasInterceptorGetter(JSObject* object) { 317 static bool HasInterceptorGetter(JSObject* object) {
269 return !object->GetNamedInterceptor()->getter()->IsUndefined(); 318 return !object->GetNamedInterceptor()->getter()->IsUndefined();
270 } 319 }
271 320
272 321
273 static void LookupForRead(Object* object, 322 static void LookupForRead(Object* object,
274 String* name, 323 String* name,
275 LookupResult* lookup) { 324 LookupResult* lookup) {
276 AssertNoAllocation no_gc; // pointers must stay valid 325 AssertNoAllocation no_gc; // pointers must stay valid
277 326
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 865 }
817 866
818 return object->GetProperty(*object, &lookup, *name, &attr); 867 return object->GetProperty(*object, &lookup, *name, &attr);
819 } 868 }
820 869
821 // Do not use ICs for objects that require access checks (including 870 // Do not use ICs for objects that require access checks (including
822 // the global object). 871 // the global object).
823 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); 872 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
824 873
825 if (use_ic) { 874 if (use_ic) {
826 set_target(generic_stub()); 875 Code* stub = generic_stub();
876 if (object->IsJSObject()) {
877 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
878 if (receiver->HasExternalArrayElements()) {
879 stub = external_array_stub(receiver->GetElementsKind());
880 }
881 }
882 set_target(stub);
827 // For JSObjects that are not value wrappers and that do not have 883 // For JSObjects that are not value wrappers and that do not have
828 // indexed interceptors, we initialize the inlined fast case (if 884 // indexed interceptors, we initialize the inlined fast case (if
829 // present) by patching the inlined map check. 885 // present) by patching the inlined map check.
830 if (object->IsJSObject() && 886 if (object->IsJSObject() &&
831 !object->IsJSValue() && 887 !object->IsJSValue() &&
832 !JSObject::cast(*object)->HasIndexedInterceptor()) { 888 !JSObject::cast(*object)->HasIndexedInterceptor()) {
833 Map* map = JSObject::cast(*object)->map(); 889 Map* map = JSObject::cast(*object)->map();
834 PatchInlinedLoad(address(), map); 890 PatchInlinedLoad(address(), map);
835 } 891 }
836 } 892 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1159
1104 // Set the property. 1160 // Set the property.
1105 return receiver->SetProperty(*name, *value, NONE); 1161 return receiver->SetProperty(*name, *value, NONE);
1106 } 1162 }
1107 1163
1108 // Do not use ICs for objects that require access checks (including 1164 // Do not use ICs for objects that require access checks (including
1109 // the global object). 1165 // the global object).
1110 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); 1166 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
1111 ASSERT(!(use_ic && object->IsJSGlobalProxy())); 1167 ASSERT(!(use_ic && object->IsJSGlobalProxy()));
1112 1168
1113 if (use_ic) set_target(generic_stub()); 1169 if (use_ic) {
1170 Code* stub = generic_stub();
1171 if (object->IsJSObject()) {
1172 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1173 if (receiver->HasExternalArrayElements()) {
1174 stub = external_array_stub(receiver->GetElementsKind());
1175 }
1176 }
1177 set_target(stub);
1178 }
1114 1179
1115 // Set the property. 1180 // Set the property.
1116 return Runtime::SetObjectProperty(object, key, value, NONE); 1181 return Runtime::SetObjectProperty(object, key, value, NONE);
1117 } 1182 }
1118 1183
1119 1184
1120 void KeyedStoreIC::UpdateCaches(LookupResult* lookup, 1185 void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
1121 State state, 1186 State state,
1122 Handle<JSObject> receiver, 1187 Handle<JSObject> receiver,
1123 Handle<String> name, 1188 Handle<String> name,
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 #undef ADDR 1424 #undef ADDR
1360 }; 1425 };
1361 1426
1362 1427
1363 Address IC::AddressFromUtilityId(IC::UtilityId id) { 1428 Address IC::AddressFromUtilityId(IC::UtilityId id) {
1364 return IC_utilities[id]; 1429 return IC_utilities[id];
1365 } 1430 }
1366 1431
1367 1432
1368 } } // namespace v8::internal 1433 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698