| OLD | NEW |
| 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 | 1036 |
| 1037 // Check if the given name is an array index. | 1037 // Check if the given name is an array index. |
| 1038 uint32_t index; | 1038 uint32_t index; |
| 1039 if (name->AsArrayIndex(&index)) { | 1039 if (name->AsArrayIndex(&index)) { |
| 1040 HandleScope scope; | 1040 HandleScope scope; |
| 1041 Handle<Object> result = SetElement(receiver, index, value); | 1041 Handle<Object> result = SetElement(receiver, index, value); |
| 1042 if (result.is_null()) return Failure::Exception(); | 1042 if (result.is_null()) return Failure::Exception(); |
| 1043 return *value; | 1043 return *value; |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 | |
| 1047 // Use specialized code for setting the length of arrays. | |
| 1048 if (receiver->IsJSArray() | |
| 1049 && name->Equals(Heap::length_symbol()) | |
| 1050 && receiver->AllowsSetElementsLength()) { | |
| 1051 #ifdef DEBUG | |
| 1052 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); | |
| 1053 #endif | |
| 1054 Code* target = Builtins::builtin(Builtins::StoreIC_ArrayLength); | |
| 1055 set_target(target); | |
| 1056 StubCache::Set(*name, HeapObject::cast(*object)->map(), target); | |
| 1057 return receiver->SetProperty(*name, *value, NONE); | |
| 1058 } | |
| 1059 | |
| 1060 // Lookup the property locally in the receiver. | 1046 // Lookup the property locally in the receiver. |
| 1061 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { | 1047 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { |
| 1062 LookupResult lookup; | 1048 LookupResult lookup; |
| 1063 if (LookupForWrite(*receiver, *name, &lookup)) { | 1049 if (LookupForWrite(*receiver, *name, &lookup)) { |
| 1064 UpdateCaches(&lookup, state, receiver, name, value); | 1050 UpdateCaches(&lookup, state, receiver, name, value); |
| 1065 } | 1051 } |
| 1066 } | 1052 } |
| 1067 | 1053 |
| 1068 // Set the property. | 1054 // Set the property. |
| 1069 return receiver->SetProperty(*name, *value, NONE); | 1055 return receiver->SetProperty(*name, *value, NONE); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 Object* StoreIC_Miss(Arguments args) { | 1328 Object* StoreIC_Miss(Arguments args) { |
| 1343 NoHandleAllocation na; | 1329 NoHandleAllocation na; |
| 1344 ASSERT(args.length() == 3); | 1330 ASSERT(args.length() == 3); |
| 1345 StoreIC ic; | 1331 StoreIC ic; |
| 1346 IC::State state = IC::StateFrom(ic.target(), args[0]); | 1332 IC::State state = IC::StateFrom(ic.target(), args[0]); |
| 1347 return ic.Store(state, args.at<Object>(0), args.at<String>(1), | 1333 return ic.Store(state, args.at<Object>(0), args.at<String>(1), |
| 1348 args.at<Object>(2)); | 1334 args.at<Object>(2)); |
| 1349 } | 1335 } |
| 1350 | 1336 |
| 1351 | 1337 |
| 1352 Object* StoreIC_ArrayLength(Arguments args) { | |
| 1353 NoHandleAllocation nha; | |
| 1354 | |
| 1355 ASSERT(args.length() == 2); | |
| 1356 JSObject* receiver = JSObject::cast(args[0]); | |
| 1357 Object* len = args[1]; | |
| 1358 | |
| 1359 return receiver->SetElementsLength(len); | |
| 1360 } | |
| 1361 | |
| 1362 | |
| 1363 // Extend storage is called in a store inline cache when | 1338 // Extend storage is called in a store inline cache when |
| 1364 // it is necessary to extend the properties array of a | 1339 // it is necessary to extend the properties array of a |
| 1365 // JSObject. | 1340 // JSObject. |
| 1366 Object* SharedStoreIC_ExtendStorage(Arguments args) { | 1341 Object* SharedStoreIC_ExtendStorage(Arguments args) { |
| 1367 NoHandleAllocation na; | 1342 NoHandleAllocation na; |
| 1368 ASSERT(args.length() == 3); | 1343 ASSERT(args.length() == 3); |
| 1369 | 1344 |
| 1370 // Convert the parameters | 1345 // Convert the parameters |
| 1371 JSObject* object = JSObject::cast(args[0]); | 1346 JSObject* object = JSObject::cast(args[0]); |
| 1372 Map* transition = Map::cast(args[1]); | 1347 Map* transition = Map::cast(args[1]); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 #undef ADDR | 1387 #undef ADDR |
| 1413 }; | 1388 }; |
| 1414 | 1389 |
| 1415 | 1390 |
| 1416 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1391 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 1417 return IC_utilities[id]; | 1392 return IC_utilities[id]; |
| 1418 } | 1393 } |
| 1419 | 1394 |
| 1420 | 1395 |
| 1421 } } // namespace v8::internal | 1396 } } // namespace v8::internal |
| OLD | NEW |