Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: src/object-observe.js

Issue 384003003: Replace AddProperty by AddNamedProperty to speed up the common case (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/messages.js ('k') | src/promise.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 "use strict"; 5 "use strict";
6 6
7 // Overview: 7 // Overview:
8 // 8 //
9 // This file contains all of the routing and accounting for Object.observe. 9 // This file contains all of the routing and accounting for Object.observe.
10 // User code will interact with these mechanisms via the Object.observe APIs 10 // User code will interact with these mechanisms via the Object.observe APIs
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 if (!ObjectInfoHasActiveObservers(objectInfo)) 443 if (!ObjectInfoHasActiveObservers(objectInfo))
444 return; 444 return;
445 445
446 var hasType = !IS_UNDEFINED(type); 446 var hasType = !IS_UNDEFINED(type);
447 var newRecord = hasType ? 447 var newRecord = hasType ?
448 { object: ObjectInfoGetObject(objectInfo), type: type } : 448 { object: ObjectInfoGetObject(objectInfo), type: type } :
449 { object: ObjectInfoGetObject(objectInfo) }; 449 { object: ObjectInfoGetObject(objectInfo) };
450 450
451 for (var prop in changeRecord) { 451 for (var prop in changeRecord) {
452 if (prop === 'object' || (hasType && prop === 'type')) continue; 452 if (prop === 'object' || (hasType && prop === 'type')) continue;
453 %AddProperty(newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE); 453 %DefineDataPropertyUnchecked(
454 newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE);
454 } 455 }
455 ObjectFreezeJS(newRecord); 456 ObjectFreezeJS(newRecord);
456 457
457 ObjectInfoEnqueueInternalChangeRecord(objectInfo, newRecord); 458 ObjectInfoEnqueueInternalChangeRecord(objectInfo, newRecord);
458 } 459 }
459 460
460 function ObjectInfoEnqueueInternalChangeRecord(objectInfo, changeRecord) { 461 function ObjectInfoEnqueueInternalChangeRecord(objectInfo, changeRecord) {
461 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 462 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
462 if (IS_SYMBOL(changeRecord.name)) return; 463 if (IS_SYMBOL(changeRecord.name)) return;
463 464
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 "observe", ArrayObserve, 644 "observe", ArrayObserve,
644 "unobserve", ArrayUnobserve 645 "unobserve", ArrayUnobserve
645 )); 646 ));
646 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( 647 InstallFunctions(notifierPrototype, DONT_ENUM, $Array(
647 "notify", ObjectNotifierNotify, 648 "notify", ObjectNotifierNotify,
648 "performChange", ObjectNotifierPerformChange 649 "performChange", ObjectNotifierPerformChange
649 )); 650 ));
650 } 651 }
651 652
652 SetupObjectObserve(); 653 SetupObjectObserve();
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/promise.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698