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

Side by Side Diff: src/v8natives.js

Issue 7748037: Port r9016 to 3.4 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.4
Patch Set: Increment version. Created 9 years, 4 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/runtime.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 desc.setValue(desc_array[VALUE_INDEX]); 577 desc.setValue(desc_array[VALUE_INDEX]);
578 desc.setWritable(desc_array[WRITABLE_INDEX]); 578 desc.setWritable(desc_array[WRITABLE_INDEX]);
579 } 579 }
580 desc.setEnumerable(desc_array[ENUMERABLE_INDEX]); 580 desc.setEnumerable(desc_array[ENUMERABLE_INDEX]);
581 desc.setConfigurable(desc_array[CONFIGURABLE_INDEX]); 581 desc.setConfigurable(desc_array[CONFIGURABLE_INDEX]);
582 582
583 return desc; 583 return desc;
584 } 584 }
585 585
586 586
587 // ES5 section 8.12.2.
588 function GetProperty(obj, p) {
589 if (%IsJSProxy(obj)) {
590 var handler = %GetHandler(obj);
591 var getProperty = handler.getPropertyDescriptor;
592 if (IS_UNDEFINED(getProperty)) {
593 throw MakeTypeError("handler_trap_missing",
594 [handler, "getPropertyDescriptor"]);
595 }
596 var descriptor = %_CallFunction(handler, p, getProperty);
597 if (IS_UNDEFINED(descriptor)) return descriptor;
598 var desc = ToCompletePropertyDescriptor(descriptor);
599 if (!desc.isConfigurable()) {
600 throw MakeTypeError("proxy_prop_not_configurable",
601 [handler, "getPropertyDescriptor", p, descriptor]);
602 }
603 return desc;
604 }
605 var prop = GetOwnProperty(obj);
606 if (!IS_UNDEFINED(prop)) return prop;
607 var proto = %GetPrototype(obj);
608 if (IS_NULL(proto)) return void 0;
609 return GetProperty(proto, p);
610 }
611
612
613 // ES5 section 8.12.6
614 function HasProperty(obj, p) {
615 if (%IsJSProxy(obj)) {
616 var handler = %GetHandler(obj);
617 var has = handler.has;
618 if (IS_UNDEFINED(has)) has = DerivedHasTrap;
619 return ToBoolean(%_CallFunction(handler, obj, p, has));
620 }
621 var desc = GetProperty(obj, p);
622 return IS_UNDEFINED(desc) ? false : true;
623 }
624
625
626 // ES5 section 8.12.1. 587 // ES5 section 8.12.1.
627 function GetOwnProperty(obj, p) { 588 function GetOwnProperty(obj, p) {
628 if (%IsJSProxy(obj)) { 589 if (%IsJSProxy(obj)) {
629 var handler = %GetHandler(obj); 590 var handler = %GetHandler(obj);
630 var getOwnProperty = handler.getOwnPropertyDescriptor; 591 var getOwnProperty = handler.getOwnPropertyDescriptor;
631 if (IS_UNDEFINED(getOwnProperty)) { 592 if (IS_UNDEFINED(getOwnProperty)) {
632 throw MakeTypeError("handler_trap_missing", 593 throw MakeTypeError("handler_trap_missing",
633 [handler, "getOwnPropertyDescriptor"]); 594 [handler, "getOwnPropertyDescriptor"]);
634 } 595 }
635 var descriptor = %_CallFunction(handler, p, getOwnProperty); 596 var descriptor = %_CallFunction(handler, p, getOwnProperty);
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 // ---------------------------------------------------------------------------- 1483 // ----------------------------------------------------------------------------
1523 1484
1524 function SetupFunction() { 1485 function SetupFunction() {
1525 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1486 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1526 "bind", FunctionBind, 1487 "bind", FunctionBind,
1527 "toString", FunctionToString 1488 "toString", FunctionToString
1528 )); 1489 ));
1529 } 1490 }
1530 1491
1531 SetupFunction(); 1492 SetupFunction();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698