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

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

Issue 1295433002: [runtime] Remove useless IN builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE again. Remove unused ReplaceWithBuiltinCall. 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-numbers.cc ('k') | test/cctest/compiler/test-run-inlining.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 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/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 // Well, there is one exception: Handle [] on strings. 746 // Well, there is one exception: Handle [] on strings.
747 Handle<String> string = Handle<String>::cast(object); 747 Handle<String> string = Handle<String>::cast(object);
748 if (index < static_cast<uint32_t>(string->length())) { 748 if (index < static_cast<uint32_t>(string->length())) {
749 return isolate->heap()->true_value(); 749 return isolate->heap()->true_value();
750 } 750 }
751 } 751 }
752 return isolate->heap()->false_value(); 752 return isolate->heap()->false_value();
753 } 753 }
754 754
755 755
756 // ES6 section 12.9.3, operator in.
756 RUNTIME_FUNCTION(Runtime_HasProperty) { 757 RUNTIME_FUNCTION(Runtime_HasProperty) {
757 HandleScope scope(isolate); 758 HandleScope scope(isolate);
758 DCHECK(args.length() == 2); 759 DCHECK_EQ(2, args.length());
759 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); 760 CONVERT_ARG_HANDLE_CHECKED(Object, key, 0);
760 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 761 CONVERT_ARG_HANDLE_CHECKED(Object, object, 1);
761 762
763 // Check that {object} is actually a receiver.
764 if (!object->IsJSReceiver()) {
765 THROW_NEW_ERROR_RETURN_FAILURE(
766 isolate,
767 NewTypeError(MessageTemplate::kInvalidInOperatorUse, key, object));
768 }
769 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
770
771 // Convert the {key} to a name.
762 Handle<Name> name; 772 Handle<Name> name;
763 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, 773 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
764 Object::ToName(isolate, key)); 774 Object::ToName(isolate, key));
775
776 // Lookup the {name} on {receiver}.
765 Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name); 777 Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name);
766 if (!maybe.IsJust()) return isolate->heap()->exception(); 778 if (!maybe.IsJust()) return isolate->heap()->exception();
767 return isolate->heap()->ToBoolean(maybe.FromJust()); 779 return isolate->heap()->ToBoolean(maybe.FromJust());
768 } 780 }
769
770
771 RUNTIME_FUNCTION(Runtime_HasElement) {
772 HandleScope scope(isolate);
773 DCHECK(args.length() == 2);
774 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
775 CONVERT_SMI_ARG_CHECKED(index, 1);
776
777 Maybe<bool> maybe = JSReceiver::HasElement(receiver, index);
778 if (!maybe.IsJust()) return isolate->heap()->exception();
779 return isolate->heap()->ToBoolean(maybe.FromJust());
780 }
781 781
782 782
783 RUNTIME_FUNCTION(Runtime_IsPropertyEnumerable) { 783 RUNTIME_FUNCTION(Runtime_IsPropertyEnumerable) {
784 HandleScope scope(isolate); 784 HandleScope scope(isolate);
785 DCHECK(args.length() == 2); 785 DCHECK(args.length() == 2);
786 786
787 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 787 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
788 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); 788 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
789 789
790 Maybe<PropertyAttributes> maybe = 790 Maybe<PropertyAttributes> maybe =
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { 1563 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) {
1564 HandleScope scope(isolate); 1564 HandleScope scope(isolate);
1565 DCHECK_EQ(2, args.length()); 1565 DCHECK_EQ(2, args.length());
1566 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); 1566 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
1567 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); 1567 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1);
1568 return *isolate->factory()->NewJSIteratorResult(value, done); 1568 return *isolate->factory()->NewJSIteratorResult(value, done);
1569 } 1569 }
1570 1570
1571 } // namespace internal 1571 } // namespace internal
1572 } // namespace v8 1572 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-numbers.cc ('k') | test/cctest/compiler/test-run-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698