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

Side by Side Diff: src/mirror-delay.js

Issue 542092: Submit Object.getOwnPropertyNames patch by Pavel Feldman. See http://codereview.chromium.org/549050. (Closed)
Patch Set: Created 10 years, 11 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
« no previous file with comments | « src/messages.js ('k') | src/runtime.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 }; 593 };
594 594
595 595
596 ObjectMirror.prototype.protoObject = function() { 596 ObjectMirror.prototype.protoObject = function() {
597 return MakeMirror(%DebugGetPrototype(this.value_)); 597 return MakeMirror(%DebugGetPrototype(this.value_));
598 }; 598 };
599 599
600 600
601 ObjectMirror.prototype.hasNamedInterceptor = function() { 601 ObjectMirror.prototype.hasNamedInterceptor = function() {
602 // Get information on interceptors for this object. 602 // Get information on interceptors for this object.
603 var x = %DebugInterceptorInfo(this.value_); 603 var x = %GetInterceptorInfo(this.value_);
604 return (x & 2) != 0; 604 return (x & 2) != 0;
605 }; 605 };
606 606
607 607
608 ObjectMirror.prototype.hasIndexedInterceptor = function() { 608 ObjectMirror.prototype.hasIndexedInterceptor = function() {
609 // Get information on interceptors for this object. 609 // Get information on interceptors for this object.
610 var x = %DebugInterceptorInfo(this.value_); 610 var x = %GetInterceptorInfo(this.value_);
611 return (x & 1) != 0; 611 return (x & 1) != 0;
612 }; 612 };
613 613
614 614
615 /** 615 /**
616 * Return the property names for this object. 616 * Return the property names for this object.
617 * @param {number} kind Indicate whether named, indexed or both kinds of 617 * @param {number} kind Indicate whether named, indexed or both kinds of
618 * properties are requested 618 * properties are requested
619 * @param {number} limit Limit the number of names returend to the specified 619 * @param {number} limit Limit the number of names returend to the specified
620 value 620 value
621 * @return {Array} Property names for this object 621 * @return {Array} Property names for this object
622 */ 622 */
623 ObjectMirror.prototype.propertyNames = function(kind, limit) { 623 ObjectMirror.prototype.propertyNames = function(kind, limit) {
624 // Find kind and limit and allocate array for the result 624 // Find kind and limit and allocate array for the result
625 kind = kind || PropertyKind.Named | PropertyKind.Indexed; 625 kind = kind || PropertyKind.Named | PropertyKind.Indexed;
626 626
627 var propertyNames; 627 var propertyNames;
628 var elementNames; 628 var elementNames;
629 var total = 0; 629 var total = 0;
630 630
631 // Find all the named properties. 631 // Find all the named properties.
632 if (kind & PropertyKind.Named) { 632 if (kind & PropertyKind.Named) {
633 // Get the local property names. 633 // Get the local property names.
634 propertyNames = %DebugLocalPropertyNames(this.value_); 634 propertyNames = %GetLocalPropertyNames(this.value_);
635 total += propertyNames.length; 635 total += propertyNames.length;
636 636
637 // Get names for named interceptor properties if any. 637 // Get names for named interceptor properties if any.
638 if (this.hasNamedInterceptor() && (kind & PropertyKind.Named)) { 638 if (this.hasNamedInterceptor() && (kind & PropertyKind.Named)) {
639 var namedInterceptorNames = 639 var namedInterceptorNames =
640 %DebugNamedInterceptorPropertyNames(this.value_); 640 %GetNamedInterceptorPropertyNames(this.value_);
641 if (namedInterceptorNames) { 641 if (namedInterceptorNames) {
642 propertyNames = propertyNames.concat(namedInterceptorNames); 642 propertyNames = propertyNames.concat(namedInterceptorNames);
643 total += namedInterceptorNames.length; 643 total += namedInterceptorNames.length;
644 } 644 }
645 } 645 }
646 } 646 }
647 647
648 // Find all the indexed properties. 648 // Find all the indexed properties.
649 if (kind & PropertyKind.Indexed) { 649 if (kind & PropertyKind.Indexed) {
650 // Get the local element names. 650 // Get the local element names.
651 elementNames = %DebugLocalElementNames(this.value_); 651 elementNames = %GetLocalElementNames(this.value_);
652 total += elementNames.length; 652 total += elementNames.length;
653 653
654 // Get names for indexed interceptor properties. 654 // Get names for indexed interceptor properties.
655 if (this.hasIndexedInterceptor() && (kind & PropertyKind.Indexed)) { 655 if (this.hasIndexedInterceptor() && (kind & PropertyKind.Indexed)) {
656 var indexedInterceptorNames = 656 var indexedInterceptorNames =
657 %DebugIndexedInterceptorElementNames(this.value_); 657 %GetIndexedInterceptorElementNames(this.value_);
658 if (indexedInterceptorNames) { 658 if (indexedInterceptorNames) {
659 elementNames = elementNames.concat(indexedInterceptorNames); 659 elementNames = elementNames.concat(indexedInterceptorNames);
660 total += indexedInterceptorNames.length; 660 total += indexedInterceptorNames.length;
661 } 661 }
662 } 662 }
663 } 663 }
664 limit = Math.min(limit || total, total); 664 limit = Math.min(limit || total, total);
665 665
666 var names = new Array(limit); 666 var names = new Array(limit);
667 var index = 0; 667 var index = 0;
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 } 2323 }
2324 if (!isFinite(value)) { 2324 if (!isFinite(value)) {
2325 if (value > 0) { 2325 if (value > 0) {
2326 return 'Infinity'; 2326 return 'Infinity';
2327 } else { 2327 } else {
2328 return '-Infinity'; 2328 return '-Infinity';
2329 } 2329 }
2330 } 2330 }
2331 return value; 2331 return value;
2332 } 2332 }
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698