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

Issue 1530293004: [proxies] Better print for proxies in d8 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: do not expose intrinsics directly Created 4 years, 12 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
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 function CallTrap2(handler, name, defaultTrap, x, y) { 479 function CallTrap2(handler, name, defaultTrap, x, y) {
480 return %_Call(GetTrap(handler, name, defaultTrap), handler, x, y); 480 return %_Call(GetTrap(handler, name, defaultTrap), handler, x, y);
481 } 481 }
482 482
483 483
484 // ES5 section 8.12.1. 484 // ES5 section 8.12.1.
485 // TODO(jkummerow): Deprecated. Migrate all callers to 485 // TODO(jkummerow): Deprecated. Migrate all callers to
486 // ObjectGetOwnPropertyDescriptor and delete this. 486 // ObjectGetOwnPropertyDescriptor and delete this.
487 function GetOwnPropertyJS(obj, v) { 487 function GetOwnPropertyJS(obj, v) {
488 var p = TO_NAME(v); 488 var p = TO_NAME(v);
489 if (%_IsJSProxy(obj)) { 489 if (IS_PROXY(obj)) {
490 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 490 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
491 if (IS_SYMBOL(v)) return UNDEFINED; 491 if (IS_SYMBOL(v)) return UNDEFINED;
492 492
493 var handler = %GetHandler(obj); 493 var handler = %JSProxyGetHandler(obj);
494 var descriptor = CallTrap1( 494 var descriptor = CallTrap1(
495 handler, "getOwnPropertyDescriptor", UNDEFINED, p); 495 handler, "getOwnPropertyDescriptor", UNDEFINED, p);
496 if (IS_UNDEFINED(descriptor)) return descriptor; 496 if (IS_UNDEFINED(descriptor)) return descriptor;
497 var desc = ToCompletePropertyDescriptor(descriptor); 497 var desc = ToCompletePropertyDescriptor(descriptor);
498 if (!desc.isConfigurable()) { 498 if (!desc.isConfigurable()) {
499 throw MakeTypeError(kIllegalInvocation); 499 throw MakeTypeError(kIllegalInvocation);
500 } 500 }
501 return desc; 501 return desc;
502 } 502 }
503 503
(...skipping 13 matching lines...) Expand all
517 if (IS_CALLABLE(func)) return func; 517 if (IS_CALLABLE(func)) return func;
518 throw MakeTypeError(kCalledNonCallable, typeof func); 518 throw MakeTypeError(kCalledNonCallable, typeof func);
519 } 519 }
520 520
521 521
522 // Harmony proxies. 522 // Harmony proxies.
523 function DefineProxyProperty(obj, p, attributes, should_throw) { 523 function DefineProxyProperty(obj, p, attributes, should_throw) {
524 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 524 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
525 if (IS_SYMBOL(p)) return false; 525 if (IS_SYMBOL(p)) return false;
526 526
527 var handler = %GetHandler(obj); 527 var handler = %JSProxyGetHandler(obj);
528 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); 528 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes);
529 if (!result) { 529 if (!result) {
530 if (should_throw) { 530 if (should_throw) {
531 throw MakeTypeError(kIllegalInvocation); 531 throw MakeTypeError(kIllegalInvocation);
532 } else { 532 } else {
533 return false; 533 return false;
534 } 534 }
535 } 535 }
536 return true; 536 return true;
537 } 537 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } 740 }
741 } 741 }
742 742
743 // Step 5 - Fallback to default implementation. 743 // Step 5 - Fallback to default implementation.
744 return DefineObjectProperty(obj, p, desc, should_throw); 744 return DefineObjectProperty(obj, p, desc, should_throw);
745 } 745 }
746 746
747 747
748 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies. 748 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies.
749 function DefineOwnProperty(obj, p, desc, should_throw) { 749 function DefineOwnProperty(obj, p, desc, should_throw) {
750 if (%_IsJSProxy(obj)) { 750 if (IS_PROXY(obj)) {
751 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 751 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
752 if (IS_SYMBOL(p)) return false; 752 if (IS_SYMBOL(p)) return false;
753 753
754 var attributes = FromGenericPropertyDescriptor(desc); 754 var attributes = FromGenericPropertyDescriptor(desc);
755 return DefineProxyProperty(obj, p, attributes, should_throw); 755 return DefineProxyProperty(obj, p, attributes, should_throw);
756 } else if (IS_ARRAY(obj)) { 756 } else if (IS_ARRAY(obj)) {
757 return DefineArrayProperty(obj, p, desc, should_throw); 757 return DefineArrayProperty(obj, p, desc, should_throw);
758 } else { 758 } else {
759 return DefineObjectProperty(obj, p, desc, should_throw); 759 return DefineObjectProperty(obj, p, desc, should_throw);
760 } 760 }
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 to.ObjectIsFrozen = ObjectIsFrozen; 1386 to.ObjectIsFrozen = ObjectIsFrozen;
1387 to.ObjectIsSealed = ObjectIsSealed; 1387 to.ObjectIsSealed = ObjectIsSealed;
1388 to.ObjectKeys = ObjectKeys; 1388 to.ObjectKeys = ObjectKeys;
1389 }); 1389 });
1390 1390
1391 %InstallToContext([ 1391 %InstallToContext([
1392 "object_value_of", ObjectValueOf, 1392 "object_value_of", ObjectValueOf,
1393 ]); 1393 ]);
1394 1394
1395 }) 1395 })
OLDNEW
« src/d8.js ('K') | « src/js/proxy.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698