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

Side by Side Diff: src/v8natives.js

Issue 7044054: Fix Array.prototype.{reduce,reduceRight} to pass undefined as receiver (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 565
566 // ES5 section 8.12.2. 566 // ES5 section 8.12.2.
567 function GetProperty(obj, p) { 567 function GetProperty(obj, p) {
568 if (%IsJSProxy(obj)) { 568 if (%IsJSProxy(obj)) {
569 var handler = %GetHandler(obj); 569 var handler = %GetHandler(obj);
570 var getProperty = handler.getPropertyDescriptor; 570 var getProperty = handler.getPropertyDescriptor;
571 if (IS_UNDEFINED(getProperty)) { 571 if (IS_UNDEFINED(getProperty)) {
572 throw MakeTypeError("handler_trap_missing", 572 throw MakeTypeError("handler_trap_missing",
573 [handler, "getPropertyDescriptor"]); 573 [handler, "getPropertyDescriptor"]);
574 } 574 }
575 var descriptor = getProperty.call(handler, p); 575 var descriptor = %_CallFunction(handler, p, getProperty);
576 if (IS_UNDEFINED(descriptor)) return descriptor; 576 if (IS_UNDEFINED(descriptor)) return descriptor;
577 var desc = ToCompletePropertyDescriptor(descriptor); 577 var desc = ToCompletePropertyDescriptor(descriptor);
578 if (!desc.configurable) { 578 if (!desc.configurable) {
579 throw MakeTypeError("proxy_prop_not_configurable", 579 throw MakeTypeError("proxy_prop_not_configurable",
580 [handler, "getPropertyDescriptor", p, descriptor]); 580 [handler, "getPropertyDescriptor", p, descriptor]);
581 } 581 }
582 return desc; 582 return desc;
583 } 583 }
584 var prop = GetOwnProperty(obj); 584 var prop = GetOwnProperty(obj);
585 if (!IS_UNDEFINED(prop)) return prop; 585 if (!IS_UNDEFINED(prop)) return prop;
586 var proto = %GetPrototype(obj); 586 var proto = %GetPrototype(obj);
587 if (IS_NULL(proto)) return void 0; 587 if (IS_NULL(proto)) return void 0;
588 return GetProperty(proto, p); 588 return GetProperty(proto, p);
589 } 589 }
590 590
591 591
592 // ES5 section 8.12.6 592 // ES5 section 8.12.6
593 function HasProperty(obj, p) { 593 function HasProperty(obj, p) {
594 if (%IsJSProxy(obj)) { 594 if (%IsJSProxy(obj)) {
595 var handler = %GetHandler(obj) 595 var handler = %GetHandler(obj);
596 var has = handler.has 596 var has = handler.has;
597 if (IS_UNDEFINED(has)) has = DerivedHasTrap 597 if (IS_UNDEFINED(has)) has = DerivedHasTrap;
598 return ToBoolean(has.call(handler, obj, p)) 598 return ToBoolean(%_CallFunction(handler, obj, p, has))
599 } 599 }
600 var desc = GetProperty(obj, p); 600 var desc = GetProperty(obj, p);
601 return IS_UNDEFINED(desc) ? false : true; 601 return IS_UNDEFINED(desc) ? false : true;
602 } 602 }
603 603
604 604
605 // ES5 section 8.12.1. 605 // ES5 section 8.12.1.
606 function GetOwnProperty(obj, p) { 606 function GetOwnProperty(obj, p) {
607 // GetOwnProperty returns an array indexed by the constants 607 // GetOwnProperty returns an array indexed by the constants
608 // defined in macros.py. 608 // defined in macros.py.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]) ; 824 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]) ;
825 825
826 // Special handling for proxies. 826 // Special handling for proxies.
827 if (%IsJSProxy(obj)) { 827 if (%IsJSProxy(obj)) {
828 var handler = %GetHandler(obj); 828 var handler = %GetHandler(obj);
829 var getOwnPropertyNames = handler.getOwnPropertyNames; 829 var getOwnPropertyNames = handler.getOwnPropertyNames;
830 if (IS_UNDEFINED(getOwnPropertyNames)) { 830 if (IS_UNDEFINED(getOwnPropertyNames)) {
831 throw MakeTypeError("handler_trap_missing", 831 throw MakeTypeError("handler_trap_missing",
832 [handler, "getOwnPropertyNames"]); 832 [handler, "getOwnPropertyNames"]);
833 } 833 }
834 var names = getOwnPropertyNames.call(handler); 834 var names = %_CallFunction(handler, getOwnPropertyNames);
835 return ToStringArray(names, "getOwnPropertyNames"); 835 return ToStringArray(names, "getOwnPropertyNames");
836 } 836 }
837 837
838 // Find all the indexed properties. 838 // Find all the indexed properties.
839 839
840 // Get the local element names. 840 // Get the local element names.
841 var propertyNames = %GetLocalElementNames(obj); 841 var propertyNames = %GetLocalElementNames(obj);
842 842
843 // Get names for indexed interceptor properties. 843 // Get names for indexed interceptor properties.
844 if (%GetInterceptorInfo(obj) & 1) { 844 if (%GetInterceptorInfo(obj) & 1) {
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 // ---------------------------------------------------------------------------- 1386 // ----------------------------------------------------------------------------
1387 1387
1388 function SetupFunction() { 1388 function SetupFunction() {
1389 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1389 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1390 "bind", FunctionBind, 1390 "bind", FunctionBind,
1391 "toString", FunctionToString 1391 "toString", FunctionToString
1392 )); 1392 ));
1393 } 1393 }
1394 1394
1395 SetupFunction(); 1395 SetupFunction();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698