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

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

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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-liveedit.cc ('k') | test/cctest/compiler/test-run-jsobjects.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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 while (callable->IsJSBoundFunction()) { 1051 while (callable->IsJSBoundFunction()) {
1052 callable = 1052 callable =
1053 handle(Handle<JSBoundFunction>::cast(callable)->bound_target_function(), 1053 handle(Handle<JSBoundFunction>::cast(callable)->bound_target_function(),
1054 isolate); 1054 isolate);
1055 } 1055 }
1056 DCHECK(callable->IsCallable()); 1056 DCHECK(callable->IsCallable());
1057 // Get the "prototype" of {callable}; raise an error if it's not a receiver. 1057 // Get the "prototype" of {callable}; raise an error if it's not a receiver.
1058 Handle<Object> prototype; 1058 Handle<Object> prototype;
1059 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1059 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1060 isolate, prototype, 1060 isolate, prototype,
1061 Object::GetProperty(callable, isolate->factory()->prototype_string())); 1061 JSReceiver::GetProperty(Handle<JSReceiver>::cast(callable),
1062 isolate->factory()->prototype_string()));
1062 if (!prototype->IsJSReceiver()) { 1063 if (!prototype->IsJSReceiver()) {
1063 THROW_NEW_ERROR_RETURN_FAILURE( 1064 THROW_NEW_ERROR_RETURN_FAILURE(
1064 isolate, 1065 isolate,
1065 NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype)); 1066 NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype));
1066 } 1067 }
1067 // Return whether or not {prototype} is in the prototype chain of {object}. 1068 // Return whether or not {prototype} is in the prototype chain of {object}.
1068 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); 1069 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
1069 Maybe<bool> result = 1070 Maybe<bool> result =
1070 JSReceiver::HasInPrototypeChain(isolate, receiver, prototype); 1071 JSReceiver::HasInPrototypeChain(isolate, receiver, prototype);
1071 MAYBE_RETURN(result, isolate->heap()->exception()); 1072 MAYBE_RETURN(result, isolate->heap()->exception());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 DCHECK(args.length() == 2); 1123 DCHECK(args.length() == 2);
1123 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1124 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1124 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1125 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1125 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1126 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1126 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); 1127 isolate, o, JSReceiver::DefineProperties(isolate, o, properties));
1127 return *o; 1128 return *o;
1128 } 1129 }
1129 1130
1130 } // namespace internal 1131 } // namespace internal
1131 } // namespace v8 1132 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-liveedit.cc ('k') | test/cctest/compiler/test-run-jsobjects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698