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/js/v8natives.js

Issue 1543803002: Revert of [proxies] Better print for proxies in d8 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/js/proxy.js ('k') | src/runtime/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 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 function CallTrap2(handler, name, defaultTrap, x, y) { 493 function CallTrap2(handler, name, defaultTrap, x, y) {
494 return %_Call(GetTrap(handler, name, defaultTrap), handler, x, y); 494 return %_Call(GetTrap(handler, name, defaultTrap), handler, x, y);
495 } 495 }
496 496
497 497
498 // ES5 section 8.12.1. 498 // ES5 section 8.12.1.
499 // TODO(jkummerow): Deprecated. Migrate all callers to 499 // TODO(jkummerow): Deprecated. Migrate all callers to
500 // ObjectGetOwnPropertyDescriptor and delete this. 500 // ObjectGetOwnPropertyDescriptor and delete this.
501 function GetOwnPropertyJS(obj, v) { 501 function GetOwnPropertyJS(obj, v) {
502 var p = TO_NAME(v); 502 var p = TO_NAME(v);
503 if (IS_PROXY(obj)) { 503 if (%_IsJSProxy(obj)) {
504 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 504 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
505 if (IS_SYMBOL(v)) return UNDEFINED; 505 if (IS_SYMBOL(v)) return UNDEFINED;
506 506
507 var handler = %JSProxyGetHandler(obj); 507 var handler = %GetHandler(obj);
508 var descriptor = CallTrap1( 508 var descriptor = CallTrap1(
509 handler, "getOwnPropertyDescriptor", UNDEFINED, p); 509 handler, "getOwnPropertyDescriptor", UNDEFINED, p);
510 if (IS_UNDEFINED(descriptor)) return descriptor; 510 if (IS_UNDEFINED(descriptor)) return descriptor;
511 var desc = ToCompletePropertyDescriptor(descriptor); 511 var desc = ToCompletePropertyDescriptor(descriptor);
512 if (!desc.isConfigurable()) { 512 if (!desc.isConfigurable()) {
513 throw MakeTypeError(kIllegalInvocation); 513 throw MakeTypeError(kIllegalInvocation);
514 } 514 }
515 return desc; 515 return desc;
516 } 516 }
517 517
(...skipping 13 matching lines...) Expand all
531 if (IS_CALLABLE(func)) return func; 531 if (IS_CALLABLE(func)) return func;
532 throw MakeTypeError(kCalledNonCallable, typeof func); 532 throw MakeTypeError(kCalledNonCallable, typeof func);
533 } 533 }
534 534
535 535
536 // Harmony proxies. 536 // Harmony proxies.
537 function DefineProxyProperty(obj, p, attributes, should_throw) { 537 function DefineProxyProperty(obj, p, attributes, should_throw) {
538 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 538 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
539 if (IS_SYMBOL(p)) return false; 539 if (IS_SYMBOL(p)) return false;
540 540
541 var handler = %JSProxyGetHandler(obj); 541 var handler = %GetHandler(obj);
542 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); 542 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes);
543 if (!result) { 543 if (!result) {
544 if (should_throw) { 544 if (should_throw) {
545 throw MakeTypeError(kIllegalInvocation); 545 throw MakeTypeError(kIllegalInvocation);
546 } else { 546 } else {
547 return false; 547 return false;
548 } 548 }
549 } 549 }
550 return true; 550 return true;
551 } 551 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 } 755 }
756 756
757 // Step 5 - Fallback to default implementation. 757 // Step 5 - Fallback to default implementation.
758 return DefineObjectProperty(obj, p, desc, should_throw); 758 return DefineObjectProperty(obj, p, desc, should_throw);
759 } 759 }
760 760
761 761
762 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies. 762 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies.
763 function DefineOwnProperty(obj, p, desc, should_throw) { 763 function DefineOwnProperty(obj, p, desc, should_throw) {
764 if (IS_PROXY(obj)) { 764 if (%_IsJSProxy(obj)) {
765 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 765 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
766 if (IS_SYMBOL(p)) return false; 766 if (IS_SYMBOL(p)) return false;
767 767
768 var attributes = FromGenericPropertyDescriptor(desc); 768 var attributes = FromGenericPropertyDescriptor(desc);
769 return DefineProxyProperty(obj, p, attributes, should_throw); 769 return DefineProxyProperty(obj, p, attributes, should_throw);
770 } else if (IS_ARRAY(obj)) { 770 } else if (IS_ARRAY(obj)) {
771 return DefineArrayProperty(obj, p, desc, should_throw); 771 return DefineArrayProperty(obj, p, desc, should_throw);
772 } else { 772 } else {
773 return DefineObjectProperty(obj, p, desc, should_throw); 773 return DefineObjectProperty(obj, p, desc, should_throw);
774 } 774 }
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 to.ObjectIsSealed = ObjectIsSealed; 1453 to.ObjectIsSealed = ObjectIsSealed;
1454 to.ObjectKeys = ObjectKeys; 1454 to.ObjectKeys = ObjectKeys;
1455 }); 1455 });
1456 1456
1457 %InstallToContext([ 1457 %InstallToContext([
1458 "global_eval_fun", GlobalEval, 1458 "global_eval_fun", GlobalEval,
1459 "object_value_of", ObjectValueOf, 1459 "object_value_of", ObjectValueOf,
1460 ]); 1460 ]);
1461 1461
1462 }) 1462 })
OLDNEW
« no previous file with comments | « src/js/proxy.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698