OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, | 258 MaybeObject* JSProxy::GetElementWithHandler(Object* receiver, |
259 uint32_t index) { | 259 uint32_t index) { |
260 String* name; | 260 String* name; |
261 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 261 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
262 if (!maybe->To<String>(&name)) return maybe; | 262 if (!maybe->To<String>(&name)) return maybe; |
263 return GetPropertyWithHandler(receiver, name); | 263 return GetPropertyWithHandler(receiver, name); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 MaybeObject* JSProxy::SetElementWithHandler(JSReceiver* receiver, | |
268 uint32_t index, | |
269 Object* value, | |
270 StrictModeFlag strict_mode) { | |
271 String* name; | |
272 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | |
273 if (!maybe->To<String>(&name)) return maybe; | |
274 return SetPropertyWithHandler(receiver, name, value, NONE, strict_mode); | |
275 } | |
276 | |
277 | |
278 bool JSProxy::HasElementWithHandler(uint32_t index) { | 267 bool JSProxy::HasElementWithHandler(uint32_t index) { |
279 String* name; | 268 String* name; |
280 MaybeObject* maybe = GetHeap()->Uint32ToString(index); | 269 MaybeObject* maybe = GetHeap()->Uint32ToString(index); |
281 if (!maybe->To<String>(&name)) return maybe; | 270 if (!maybe->To<String>(&name)) return maybe; |
282 return HasPropertyWithHandler(name); | 271 return HasPropertyWithHandler(name); |
283 } | 272 } |
284 | 273 |
285 | 274 |
286 MaybeObject* Object::GetPropertyWithDefinedGetter(Object* receiver, | 275 MaybeObject* Object::GetPropertyWithDefinedGetter(Object* receiver, |
287 JSReceiver* getter) { | 276 JSReceiver* getter) { |
(...skipping 9561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9849 ASSERT(elements()->IsFixedDoubleArray()); | 9838 ASSERT(elements()->IsFixedDoubleArray()); |
9850 Object* obj; | 9839 Object* obj; |
9851 { MaybeObject* maybe_obj = NormalizeElements(); | 9840 { MaybeObject* maybe_obj = NormalizeElements(); |
9852 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 9841 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
9853 } | 9842 } |
9854 ASSERT(HasDictionaryElements()); | 9843 ASSERT(HasDictionaryElements()); |
9855 return SetElement(index, value, NONE, strict_mode, check_prototype); | 9844 return SetElement(index, value, NONE, strict_mode, check_prototype); |
9856 } | 9845 } |
9857 | 9846 |
9858 | 9847 |
9859 MaybeObject* JSReceiver::SetElement(uint32_t index, | |
9860 Object* value, | |
9861 PropertyAttributes attributes, | |
9862 StrictModeFlag strict_mode, | |
9863 bool check_proto) { | |
9864 if (IsJSProxy()) { | |
9865 return JSProxy::cast(this)->SetElementWithHandler( | |
9866 this, index, value, strict_mode); | |
9867 } else { | |
9868 return JSObject::cast(this)->SetElement( | |
9869 index, value, attributes, strict_mode, check_proto); | |
9870 } | |
9871 } | |
9872 | |
9873 | |
9874 Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object, | 9848 Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object, |
9875 uint32_t index, | 9849 uint32_t index, |
9876 Handle<Object> value, | 9850 Handle<Object> value, |
9877 StrictModeFlag strict_mode) { | 9851 StrictModeFlag strict_mode) { |
9878 ASSERT(!object->HasExternalArrayElements()); | 9852 ASSERT(!object->HasExternalArrayElements()); |
9879 CALL_HEAP_FUNCTION( | 9853 CALL_HEAP_FUNCTION( |
9880 object->GetIsolate(), | 9854 object->GetIsolate(), |
9881 object->SetElement(index, *value, NONE, strict_mode, false), | 9855 object->SetElement(index, *value, NONE, strict_mode, false), |
9882 Object); | 9856 Object); |
9883 } | 9857 } |
(...skipping 3589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13473 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13447 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13474 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13448 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13475 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13449 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13476 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13450 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13477 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13451 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13478 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13452 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13479 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13453 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13480 } | 13454 } |
13481 | 13455 |
13482 } } // namespace v8::internal | 13456 } } // namespace v8::internal |
OLD | NEW |