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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1319133002: [es6] Implement spec compliant ToName (actually ToPropertyKey). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ToPrimitive
Patch Set: Created 5 years, 3 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
« no previous file with comments | « src/runtime/runtime.h ('k') | src/v8natives.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 } 749 }
750 } 750 }
751 return isolate->heap()->false_value(); 751 return isolate->heap()->false_value();
752 } 752 }
753 753
754 754
755 RUNTIME_FUNCTION(Runtime_HasProperty) { 755 RUNTIME_FUNCTION(Runtime_HasProperty) {
756 HandleScope scope(isolate); 756 HandleScope scope(isolate);
757 DCHECK(args.length() == 2); 757 DCHECK(args.length() == 2);
758 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); 758 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
759 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 759 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
760 760
761 Maybe<bool> maybe = JSReceiver::HasProperty(receiver, key); 761 Handle<Name> name;
762 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
763 Object::ToName(isolate, key));
764 Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name);
762 if (!maybe.IsJust()) return isolate->heap()->exception(); 765 if (!maybe.IsJust()) return isolate->heap()->exception();
763 return isolate->heap()->ToBoolean(maybe.FromJust()); 766 return isolate->heap()->ToBoolean(maybe.FromJust());
764 } 767 }
765 768
766 769
767 RUNTIME_FUNCTION(Runtime_HasElement) { 770 RUNTIME_FUNCTION(Runtime_HasElement) {
768 HandleScope scope(isolate); 771 HandleScope scope(isolate);
769 DCHECK(args.length() == 2); 772 DCHECK(args.length() == 2);
770 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); 773 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
771 CONVERT_SMI_ARG_CHECKED(index, 1); 774 CONVERT_SMI_ARG_CHECKED(index, 1);
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 HandleScope scope(isolate); 1477 HandleScope scope(isolate);
1475 DCHECK_EQ(1, args.length()); 1478 DCHECK_EQ(1, args.length());
1476 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); 1479 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
1477 Handle<Object> result; 1480 Handle<Object> result;
1478 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 1481 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
1479 Object::ToNumber(isolate, input)); 1482 Object::ToNumber(isolate, input));
1480 return *result; 1483 return *result;
1481 } 1484 }
1482 1485
1483 1486
1487 RUNTIME_FUNCTION(Runtime_ToName) {
1488 HandleScope scope(isolate);
1489 DCHECK_EQ(1, args.length());
1490 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
1491 Handle<Object> result;
1492 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
1493 Object::ToName(isolate, input));
1494 return *result;
1495 }
1496
1497
1484 RUNTIME_FUNCTION(Runtime_StrictEquals) { 1498 RUNTIME_FUNCTION(Runtime_StrictEquals) {
1485 SealHandleScope scope(isolate); 1499 SealHandleScope scope(isolate);
1486 DCHECK_EQ(2, args.length()); 1500 DCHECK_EQ(2, args.length());
1487 CONVERT_ARG_CHECKED(Object, x, 0); 1501 CONVERT_ARG_CHECKED(Object, x, 0);
1488 CONVERT_ARG_CHECKED(Object, y, 1); 1502 CONVERT_ARG_CHECKED(Object, y, 1);
1489 // TODO(bmeurer): Change this at some point to return true/false instead. 1503 // TODO(bmeurer): Change this at some point to return true/false instead.
1490 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL); 1504 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL);
1491 } 1505 }
1492 1506
1493 1507
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 SealHandleScope scope(isolate); 1553 SealHandleScope scope(isolate);
1540 DCHECK_EQ(2, args.length()); 1554 DCHECK_EQ(2, args.length());
1541 CONVERT_ARG_CHECKED(Object, object, 0); 1555 CONVERT_ARG_CHECKED(Object, object, 0);
1542 CONVERT_ARG_CHECKED(Object, prototype, 1); 1556 CONVERT_ARG_CHECKED(Object, prototype, 1);
1543 return isolate->heap()->ToBoolean( 1557 return isolate->heap()->ToBoolean(
1544 object->HasInPrototypeChain(isolate, prototype)); 1558 object->HasInPrototypeChain(isolate, prototype));
1545 } 1559 }
1546 1560
1547 } // namespace internal 1561 } // namespace internal
1548 } // namespace v8 1562 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698