OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com) | 3 * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 exec->globalData().heap.registerThread(); | 460 exec->globalData().heap.registerThread(); |
461 JSLock lock(exec); | 461 JSLock lock(exec); |
462 | 462 |
463 JSGlobalData* globalData = &exec->globalData(); | 463 JSGlobalData* globalData = &exec->globalData(); |
464 | 464 |
465 JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(globalD
ata); | 465 JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(globalD
ata); |
466 PropertyNameArray array(globalData); | 466 PropertyNameArray array(globalData); |
467 jsObject->getPropertyNames(exec, array); | 467 jsObject->getPropertyNames(exec, array); |
468 | 468 |
469 size_t size = array.size(); | 469 size_t size = array.size(); |
470 propertyNames->array.reserveCapacity(size); | 470 propertyNames->array.reserveInitialCapacity(size); |
471 for (size_t i = 0; i < size; ++i) | 471 for (size_t i = 0; i < size; ++i) |
472 propertyNames->array.append(JSRetainPtr<JSStringRef>(Adopt, OpaqueJSStri
ng::create(array[i].ustring()).releaseRef())); | 472 propertyNames->array.append(JSRetainPtr<JSStringRef>(Adopt, OpaqueJSStri
ng::create(array[i].ustring()).releaseRef())); |
473 | 473 |
474 return JSPropertyNameArrayRetain(propertyNames); | 474 return JSPropertyNameArrayRetain(propertyNames); |
475 } | 475 } |
476 | 476 |
477 JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) | 477 JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) |
478 { | 478 { |
479 ++array->refCount; | 479 ++array->refCount; |
480 return array; | 480 return array; |
(...skipping 19 matching lines...) Expand all Loading... |
500 | 500 |
501 void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStri
ngRef propertyName) | 501 void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStri
ngRef propertyName) |
502 { | 502 { |
503 PropertyNameArray* propertyNames = toJS(array); | 503 PropertyNameArray* propertyNames = toJS(array); |
504 | 504 |
505 propertyNames->globalData()->heap.registerThread(); | 505 propertyNames->globalData()->heap.registerThread(); |
506 JSLock lock(propertyNames->globalData()->isSharedInstance); | 506 JSLock lock(propertyNames->globalData()->isSharedInstance); |
507 | 507 |
508 propertyNames->add(propertyName->identifier(propertyNames->globalData())); | 508 propertyNames->add(propertyName->identifier(propertyNames->globalData())); |
509 } | 509 } |
OLD | NEW |