Chromium Code Reviews| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 | 445 |
| 446 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, | 446 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, |
| 447 uint32_t index) { | 447 uint32_t index) { |
| 448 String* name; | 448 String* name; |
| 449 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 449 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
| 450 if (!maybe->To<String>(&name)) return maybe; | 450 if (!maybe->To<String>(&name)) return maybe; |
| 451 return GetPropertyWithHandler(receiver, name); | 451 return GetPropertyWithHandler(receiver, name); |
| 452 } | 452 } |
| 453 | 453 |
| 454 | 454 |
| 455 MaybeObject* JSProxy::SetElementWithHandler(JSReceiver* receiver, | 455 Handle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> object, |
|
rossberg
2013/08/30 06:51:13
Nit: can we name this 'proxy'?
Michael Starzinger
2013/08/30 10:42:09
Done. Also renamed it for all other occurrences th
| |
| 456 uint32_t index, | 456 Handle<JSReceiver> receiver, |
| 457 Object* value, | 457 uint32_t index, |
| 458 StrictModeFlag strict_mode) { | 458 Handle<Object> value, |
| 459 String* name; | 459 StrictModeFlag strict_mode) { |
| 460 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 460 Isolate* isolate = object->GetIsolate(); |
| 461 if (!maybe->To<String>(&name)) return maybe; | 461 Handle<String> name = isolate->factory()->Uint32ToString(index); |
| 462 return SetPropertyWithHandler(receiver, name, value, NONE, strict_mode); | 462 CALL_HEAP_FUNCTION(isolate, |
| 463 object->SetPropertyWithHandler( | |
| 464 *receiver, *name, *value, NONE, strict_mode), | |
| 465 Object); | |
| 463 } | 466 } |
| 464 | 467 |
| 465 | 468 |
| 466 bool JSProxy::HasElementWithHandler(uint32_t index) { | 469 bool JSProxy::HasElementWithHandler(uint32_t index) { |
| 467 String* name; | 470 String* name; |
| 468 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 471 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
| 469 if (!maybe->To<String>(&name)) return maybe; | 472 if (!maybe->To<String>(&name)) return maybe; |
| 470 return HasPropertyWithHandler(name); | 473 return HasPropertyWithHandler(name); |
| 471 } | 474 } |
| 472 | 475 |
| (...skipping 11631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12104 ASSERT(elements()->IsFixedDoubleArray()); | 12107 ASSERT(elements()->IsFixedDoubleArray()); |
| 12105 Object* obj; | 12108 Object* obj; |
| 12106 { MaybeObject* maybe_obj = NormalizeElements(); | 12109 { MaybeObject* maybe_obj = NormalizeElements(); |
| 12107 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 12110 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 12108 } | 12111 } |
| 12109 ASSERT(HasDictionaryElements()); | 12112 ASSERT(HasDictionaryElements()); |
| 12110 return SetElement(index, value, NONE, strict_mode, check_prototype); | 12113 return SetElement(index, value, NONE, strict_mode, check_prototype); |
| 12111 } | 12114 } |
| 12112 | 12115 |
| 12113 | 12116 |
| 12114 MaybeObject* JSReceiver::SetElement(uint32_t index, | 12117 Handle<Object> JSReceiver::SetElement(Handle<JSReceiver> object, |
| 12115 Object* value, | 12118 uint32_t index, |
| 12116 PropertyAttributes attributes, | 12119 Handle<Object> value, |
| 12117 StrictModeFlag strict_mode, | 12120 PropertyAttributes attributes, |
| 12118 bool check_proto) { | 12121 StrictModeFlag strict_mode) { |
| 12119 if (IsJSProxy()) { | 12122 if (object->IsJSProxy()) { |
| 12120 return JSProxy::cast(this)->SetElementWithHandler( | 12123 return JSProxy::SetElementWithHandler( |
| 12121 this, index, value, strict_mode); | 12124 Handle<JSProxy>::cast(object), object, index, value, strict_mode); |
| 12122 } else { | |
| 12123 return JSObject::cast(this)->SetElement( | |
| 12124 index, value, attributes, strict_mode, check_proto); | |
| 12125 } | 12125 } |
| 12126 return JSObject::SetElement( | |
| 12127 Handle<JSObject>::cast(object), index, value, attributes, strict_mode); | |
| 12126 } | 12128 } |
| 12127 | 12129 |
| 12128 | 12130 |
| 12129 Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object, | 12131 Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object, |
| 12130 uint32_t index, | 12132 uint32_t index, |
| 12131 Handle<Object> value, | 12133 Handle<Object> value, |
| 12132 StrictModeFlag strict_mode) { | 12134 StrictModeFlag strict_mode) { |
| 12133 ASSERT(!object->HasExternalArrayElements()); | 12135 ASSERT(!object->HasExternalArrayElements()); |
| 12134 CALL_HEAP_FUNCTION( | 12136 CALL_HEAP_FUNCTION( |
| 12135 object->GetIsolate(), | 12137 object->GetIsolate(), |
| (...skipping 3856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15992 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15994 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 15993 static const char* error_messages_[] = { | 15995 static const char* error_messages_[] = { |
| 15994 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15996 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 15995 }; | 15997 }; |
| 15996 #undef ERROR_MESSAGES_TEXTS | 15998 #undef ERROR_MESSAGES_TEXTS |
| 15997 return error_messages_[reason]; | 15999 return error_messages_[reason]; |
| 15998 } | 16000 } |
| 15999 | 16001 |
| 16000 | 16002 |
| 16001 } } // namespace v8::internal | 16003 } } // namespace v8::internal |
| OLD | NEW |