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

Side by Side Diff: src/v8natives.js

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 10 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/v8-counters.h ('k') | src/version.cc » ('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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 function InstallFunctions(object, attributes, functions) { 49 function InstallFunctions(object, attributes, functions) {
50 if (functions.length >= 8) { 50 if (functions.length >= 8) {
51 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1); 51 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1);
52 } 52 }
53 for (var i = 0; i < functions.length; i += 2) { 53 for (var i = 0; i < functions.length; i += 2) {
54 var key = functions[i]; 54 var key = functions[i];
55 var f = functions[i + 1]; 55 var f = functions[i + 1];
56 %FunctionSetName(f, key); 56 %FunctionSetName(f, key);
57 %SetProperty(object, key, f, attributes); 57 %SetProperty(object, key, f, attributes);
58 } 58 }
59 %TransformToFastProperties(object); 59 %ToFastProperties(object);
60 } 60 }
61 61
62 // Emulates JSC by installing functions on a hidden prototype that 62 // Emulates JSC by installing functions on a hidden prototype that
63 // lies above the current object/prototype. This lets you override 63 // lies above the current object/prototype. This lets you override
64 // functions on String.prototype etc. and then restore the old function 64 // functions on String.prototype etc. and then restore the old function
65 // with delete. See http://code.google.com/p/chromium/issues/detail?id=1717 65 // with delete. See http://code.google.com/p/chromium/issues/detail?id=1717
66 function InstallFunctionsOnHiddenPrototype(object, attributes, functions) { 66 function InstallFunctionsOnHiddenPrototype(object, attributes, functions) {
67 var hidden_prototype = new $Object(); 67 var hidden_prototype = new $Object();
68 %SetHiddenPrototype(object, hidden_prototype); 68 %SetHiddenPrototype(object, hidden_prototype);
69 InstallFunctions(hidden_prototype, attributes, functions); 69 InstallFunctions(hidden_prototype, attributes, functions);
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 // Find all the indexed properties. 617 // Find all the indexed properties.
618 618
619 // Get the local element names. 619 // Get the local element names.
620 var propertyNames = %GetLocalElementNames(obj); 620 var propertyNames = %GetLocalElementNames(obj);
621 621
622 // Get names for indexed interceptor properties. 622 // Get names for indexed interceptor properties.
623 if (%GetInterceptorInfo(obj) & 1) { 623 if (%GetInterceptorInfo(obj) & 1) {
624 var indexedInterceptorNames = 624 var indexedInterceptorNames =
625 %GetIndexedInterceptorElementNames(obj); 625 %GetIndexedInterceptorElementNames(obj);
626 if (indexedInterceptorNames) { 626 if (indexedInterceptorNames)
627 propertyNames = propertyNames.concat(indexedInterceptorNames); 627 propertyNames = propertyNames.concat(indexedInterceptorNames);
628 }
629 } 628 }
630 629
631 // Find all the named properties. 630 // Find all the named properties.
632 631
633 // Get the local property names. 632 // Get the local property names.
634 propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj)); 633 propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj));
635 634
636 // Get names for named interceptor properties if any. 635 // Get names for named interceptor properties if any.
637 636
638 if (%GetInterceptorInfo(obj) & 2) { 637 if (%GetInterceptorInfo(obj) & 2) {
639 var namedInterceptorNames = 638 var namedInterceptorNames =
640 %GetNamedInterceptorPropertyNames(obj); 639 %GetNamedInterceptorPropertyNames(obj);
641 if (namedInterceptorNames) { 640 if (namedInterceptorNames) {
642 propertyNames = propertyNames.concat(namedInterceptorNames); 641 propertyNames = propertyNames.concat(namedInterceptorNames);
643 } 642 }
644 } 643 }
645 644
645 // Property names are expected to be strings.
646 for (var i = 0; i < propertyNames.length; ++i)
647 propertyNames[i] = ToString(propertyNames[i]);
648
646 return propertyNames; 649 return propertyNames;
647 } 650 }
648 651
649 652
650 // ES5 section 15.2.3.5. 653 // ES5 section 15.2.3.5.
651 function ObjectCreate(proto, properties) { 654 function ObjectCreate(proto, properties) {
652 if (!IS_OBJECT(proto) && !IS_NULL(proto)) { 655 if (!IS_OBJECT(proto) && !IS_NULL(proto)) {
653 throw MakeTypeError("proto_object_or_null", [proto]); 656 throw MakeTypeError("proto_object_or_null", [proto]);
654 } 657 }
655 var obj = new $Object(); 658 var obj = new $Object();
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 %SetProperty($Number, 907 %SetProperty($Number,
905 "NEGATIVE_INFINITY", 908 "NEGATIVE_INFINITY",
906 -1/0, 909 -1/0,
907 DONT_ENUM | DONT_DELETE | READ_ONLY); 910 DONT_ENUM | DONT_DELETE | READ_ONLY);
908 911
909 // ECMA-262 section 15.7.3.5. 912 // ECMA-262 section 15.7.3.5.
910 %SetProperty($Number, 913 %SetProperty($Number,
911 "POSITIVE_INFINITY", 914 "POSITIVE_INFINITY",
912 1/0, 915 1/0,
913 DONT_ENUM | DONT_DELETE | READ_ONLY); 916 DONT_ENUM | DONT_DELETE | READ_ONLY);
914 %TransformToFastProperties($Number); 917 %ToFastProperties($Number);
915 918
916 // Setup non-enumerable functions on the Number prototype object. 919 // Setup non-enumerable functions on the Number prototype object.
917 InstallFunctions($Number.prototype, DONT_ENUM, $Array( 920 InstallFunctions($Number.prototype, DONT_ENUM, $Array(
918 "toString", NumberToString, 921 "toString", NumberToString,
919 "toLocaleString", NumberToLocaleString, 922 "toLocaleString", NumberToLocaleString,
920 "valueOf", NumberValueOf, 923 "valueOf", NumberValueOf,
921 "toFixed", NumberToFixed, 924 "toFixed", NumberToFixed,
922 "toExponential", NumberToExponential, 925 "toExponential", NumberToExponential,
923 "toPrecision", NumberToPrecision, 926 "toPrecision", NumberToPrecision,
924 "toJSON", NumberToJSON 927 "toJSON", NumberToJSON
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 992
990 // ---------------------------------------------------------------------------- 993 // ----------------------------------------------------------------------------
991 994
992 function SetupFunction() { 995 function SetupFunction() {
993 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 996 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
994 "toString", FunctionToString 997 "toString", FunctionToString
995 )); 998 ));
996 } 999 }
997 1000
998 SetupFunction(); 1001 SetupFunction();
OLDNEW
« no previous file with comments | « src/v8-counters.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698