| 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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 | 1042 |
| 1043 // Check if the given name is an array index. | 1043 // Check if the given name is an array index. |
| 1044 uint32_t index; | 1044 uint32_t index; |
| 1045 if (name->AsArrayIndex(&index)) { | 1045 if (name->AsArrayIndex(&index)) { |
| 1046 HandleScope scope; | 1046 HandleScope scope; |
| 1047 Handle<Object> result = SetElement(receiver, index, value); | 1047 Handle<Object> result = SetElement(receiver, index, value); |
| 1048 if (result.is_null()) return Failure::Exception(); | 1048 if (result.is_null()) return Failure::Exception(); |
| 1049 return *value; | 1049 return *value; |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 | |
| 1053 // Use specialized code for setting the length of arrays. | |
| 1054 if (receiver->IsJSArray() | |
| 1055 && name->Equals(Heap::length_symbol()) | |
| 1056 && receiver->AllowsSetElementsLength()) { | |
| 1057 #ifdef DEBUG | |
| 1058 if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); | |
| 1059 #endif | |
| 1060 Code* target = Builtins::builtin(Builtins::StoreIC_ArrayLength); | |
| 1061 set_target(target); | |
| 1062 StubCache::Set(*name, HeapObject::cast(*object)->map(), target); | |
| 1063 return receiver->SetProperty(*name, *value, NONE); | |
| 1064 } | |
| 1065 | |
| 1066 // Lookup the property locally in the receiver. | 1052 // Lookup the property locally in the receiver. |
| 1067 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { | 1053 if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { |
| 1068 LookupResult lookup; | 1054 LookupResult lookup; |
| 1069 if (LookupForWrite(*receiver, *name, &lookup)) { | 1055 if (LookupForWrite(*receiver, *name, &lookup)) { |
| 1070 UpdateCaches(&lookup, state, receiver, name, value); | 1056 UpdateCaches(&lookup, state, receiver, name, value); |
| 1071 } | 1057 } |
| 1072 } | 1058 } |
| 1073 | 1059 |
| 1074 // Set the property. | 1060 // Set the property. |
| 1075 return receiver->SetProperty(*name, *value, NONE); | 1061 return receiver->SetProperty(*name, *value, NONE); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 #undef ADDR | 1407 #undef ADDR |
| 1422 }; | 1408 }; |
| 1423 | 1409 |
| 1424 | 1410 |
| 1425 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1411 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 1426 return IC_utilities[id]; | 1412 return IC_utilities[id]; |
| 1427 } | 1413 } |
| 1428 | 1414 |
| 1429 | 1415 |
| 1430 } } // namespace v8::internal | 1416 } } // namespace v8::internal |
| OLD | NEW |