OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 | 335 |
336 Handle<String> SubString(Handle<String> str, int start, int end) { | 336 Handle<String> SubString(Handle<String> str, int start, int end) { |
337 CALL_HEAP_FUNCTION(str->Slice(start, end), String); | 337 CALL_HEAP_FUNCTION(str->Slice(start, end), String); |
338 } | 338 } |
339 | 339 |
340 | 340 |
341 Handle<Object> SetElement(Handle<JSObject> object, | 341 Handle<Object> SetElement(Handle<JSObject> object, |
342 uint32_t index, | 342 uint32_t index, |
343 Handle<Object> value) { | 343 Handle<Object> value) { |
| 344 if (object->HasPixelElements()) { |
| 345 if (!value->IsSmi() && !value->IsHeapNumber() && !value->IsUndefined()) { |
| 346 bool has_exception; |
| 347 Handle<Object> number = Execution::ToNumber(value, &has_exception); |
| 348 if (has_exception) return Handle<Object>(); |
| 349 value = number; |
| 350 } |
| 351 } |
344 CALL_HEAP_FUNCTION(object->SetElement(index, *value), Object); | 352 CALL_HEAP_FUNCTION(object->SetElement(index, *value), Object); |
345 } | 353 } |
346 | 354 |
347 | 355 |
348 Handle<JSObject> Copy(Handle<JSObject> obj) { | 356 Handle<JSObject> Copy(Handle<JSObject> obj) { |
349 CALL_HEAP_FUNCTION(Heap::CopyJSObject(*obj), JSObject); | 357 CALL_HEAP_FUNCTION(Heap::CopyJSObject(*obj), JSObject); |
350 } | 358 } |
351 | 359 |
352 | 360 |
353 // Wrappers for scripts are kept alive and cached in weak global | 361 // Wrappers for scripts are kept alive and cached in weak global |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); | 751 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); |
744 obj->set_map(*new_map); | 752 obj->set_map(*new_map); |
745 new_map->set_needs_loading(true); | 753 new_map->set_needs_loading(true); |
746 // Store the lazy loading info in the constructor field. We'll | 754 // Store the lazy loading info in the constructor field. We'll |
747 // reestablish the constructor from the fixed array after loading. | 755 // reestablish the constructor from the fixed array after loading. |
748 new_map->set_constructor(*arr); | 756 new_map->set_constructor(*arr); |
749 ASSERT(!obj->IsLoaded()); | 757 ASSERT(!obj->IsLoaded()); |
750 } | 758 } |
751 | 759 |
752 } } // namespace v8::internal | 760 } } // namespace v8::internal |
OLD | NEW |