| 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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 StrictModeFlag strict_mode, | 1390 StrictModeFlag strict_mode, |
| 1391 Handle<Object> object, | 1391 Handle<Object> object, |
| 1392 Handle<String> name, | 1392 Handle<String> name, |
| 1393 Handle<Object> value) { | 1393 Handle<Object> value) { |
| 1394 // If the object is undefined or null it's illegal to try to set any | 1394 // If the object is undefined or null it's illegal to try to set any |
| 1395 // properties on it; throw a TypeError in that case. | 1395 // properties on it; throw a TypeError in that case. |
| 1396 if (object->IsUndefined() || object->IsNull()) { | 1396 if (object->IsUndefined() || object->IsNull()) { |
| 1397 return TypeError("non_object_property_store", object, name); | 1397 return TypeError("non_object_property_store", object, name); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 // Ignore stores where the receiver is not a JSObject. | 1400 if (!object->IsJSObject()) { |
| 1401 if (!object->IsJSObject()) return *value; | 1401 // The length property of string values is read-only. Throw in strict mode. |
| 1402 if (strict_mode == kStrictMode && object->IsString() && |
| 1403 name->Equals(Heap::length_symbol())) { |
| 1404 return TypeError("strict_read_only_property", object, name); |
| 1405 } |
| 1406 // Ignore stores where the receiver is not a JSObject. |
| 1407 return *value; |
| 1408 } |
| 1409 |
| 1402 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1410 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 1403 | 1411 |
| 1404 // Check if the given name is an array index. | 1412 // Check if the given name is an array index. |
| 1405 uint32_t index; | 1413 uint32_t index; |
| 1406 if (name->AsArrayIndex(&index)) { | 1414 if (name->AsArrayIndex(&index)) { |
| 1407 HandleScope scope; | 1415 HandleScope scope; |
| 1408 Handle<Object> result = SetElement(receiver, index, value, strict_mode); | 1416 Handle<Object> result = SetElement(receiver, index, value, strict_mode); |
| 1409 if (result.is_null()) return Failure::Exception(); | 1417 if (result.is_null()) return Failure::Exception(); |
| 1410 return *value; | 1418 return *value; |
| 1411 } | 1419 } |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 #undef ADDR | 2332 #undef ADDR |
| 2325 }; | 2333 }; |
| 2326 | 2334 |
| 2327 | 2335 |
| 2328 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2336 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2329 return IC_utilities[id]; | 2337 return IC_utilities[id]; |
| 2330 } | 2338 } |
| 2331 | 2339 |
| 2332 | 2340 |
| 2333 } } // namespace v8::internal | 2341 } } // namespace v8::internal |
| OLD | NEW |