| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, | 445 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, |
| 446 uint32_t index) { | 446 uint32_t index) { |
| 447 String* name; | 447 String* name; |
| 448 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 448 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
| 449 if (!maybe->To<String>(&name)) return maybe; | 449 if (!maybe->To<String>(&name)) return maybe; |
| 450 return GetPropertyWithHandler(receiver, name); | 450 return GetPropertyWithHandler(receiver, name); |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 MaybeObject* JSProxy::SetElementWithHandler(JSReceiver* receiver, | |
| 455 uint32_t index, | |
| 456 Object* value, | |
| 457 StrictModeFlag strict_mode) { | |
| 458 String* name; | |
| 459 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | |
| 460 if (!maybe->To<String>(&name)) return maybe; | |
| 461 return SetPropertyWithHandler(receiver, name, value, NONE, strict_mode); | |
| 462 } | |
| 463 | |
| 464 | |
| 465 bool JSProxy::HasElementWithHandler(uint32_t index) { | 454 bool JSProxy::HasElementWithHandler(uint32_t index) { |
| 466 String* name; | 455 String* name; |
| 467 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 456 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
| 468 if (!maybe->To<String>(&name)) return maybe; | 457 if (!maybe->To<String>(&name)) return maybe; |
| 469 return HasPropertyWithHandler(name); | 458 return HasPropertyWithHandler(name); |
| 470 } | 459 } |
| 471 | 460 |
| 472 | 461 |
| 473 MaybeObject* Object::GetPropertyWithDefinedGetter(Object* receiver, | 462 MaybeObject* Object::GetPropertyWithDefinedGetter(Object* receiver, |
| 474 JSReceiver* getter) { | 463 JSReceiver* getter) { |
| (...skipping 11618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12093 ASSERT(elements()->IsFixedDoubleArray()); | 12082 ASSERT(elements()->IsFixedDoubleArray()); |
| 12094 Object* obj; | 12083 Object* obj; |
| 12095 { MaybeObject* maybe_obj = NormalizeElements(); | 12084 { MaybeObject* maybe_obj = NormalizeElements(); |
| 12096 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 12085 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 12097 } | 12086 } |
| 12098 ASSERT(HasDictionaryElements()); | 12087 ASSERT(HasDictionaryElements()); |
| 12099 return SetElement(index, value, NONE, strict_mode, check_prototype); | 12088 return SetElement(index, value, NONE, strict_mode, check_prototype); |
| 12100 } | 12089 } |
| 12101 | 12090 |
| 12102 | 12091 |
| 12103 MaybeObject* JSReceiver::SetElement(uint32_t index, | |
| 12104 Object* value, | |
| 12105 PropertyAttributes attributes, | |
| 12106 StrictModeFlag strict_mode, | |
| 12107 bool check_proto) { | |
| 12108 if (IsJSProxy()) { | |
| 12109 return JSProxy::cast(this)->SetElementWithHandler( | |
| 12110 this, index, value, strict_mode); | |
| 12111 } else { | |
| 12112 return JSObject::cast(this)->SetElement( | |
| 12113 index, value, attributes, strict_mode, check_proto); | |
| 12114 } | |
| 12115 } | |
| 12116 | |
| 12117 | |
| 12118 Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object, | 12092 Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object, |
| 12119 uint32_t index, | 12093 uint32_t index, |
| 12120 Handle<Object> value, | 12094 Handle<Object> value, |
| 12121 StrictModeFlag strict_mode) { | 12095 StrictModeFlag strict_mode) { |
| 12122 ASSERT(!object->HasExternalArrayElements()); | 12096 ASSERT(!object->HasExternalArrayElements()); |
| 12123 CALL_HEAP_FUNCTION( | 12097 CALL_HEAP_FUNCTION( |
| 12124 object->GetIsolate(), | 12098 object->GetIsolate(), |
| 12125 object->SetElement(index, *value, NONE, strict_mode, false), | 12099 object->SetElement(index, *value, NONE, strict_mode, false), |
| 12126 Object); | 12100 Object); |
| 12127 } | 12101 } |
| (...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15977 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15951 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 15978 static const char* error_messages_[] = { | 15952 static const char* error_messages_[] = { |
| 15979 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15953 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 15980 }; | 15954 }; |
| 15981 #undef ERROR_MESSAGES_TEXTS | 15955 #undef ERROR_MESSAGES_TEXTS |
| 15982 return error_messages_[reason]; | 15956 return error_messages_[reason]; |
| 15983 } | 15957 } |
| 15984 | 15958 |
| 15985 | 15959 |
| 15986 } } // namespace v8::internal | 15960 } } // namespace v8::internal |
| OLD | NEW |