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

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

Issue 1402973002: Move some code from Runtime_GetPrototype into a new Object::GetPrototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 5 years, 2 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-debug.cc ('k') | test/cctest/test-api.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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 return Object::SetProperty(&it, value, language_mode, 151 return Object::SetProperty(&it, value, language_mode,
152 Object::MAY_BE_STORE_FROM_KEYED); 152 Object::MAY_BE_STORE_FROM_KEYED);
153 } 153 }
154 154
155 155
156 RUNTIME_FUNCTION(Runtime_GetPrototype) { 156 RUNTIME_FUNCTION(Runtime_GetPrototype) {
157 HandleScope scope(isolate); 157 HandleScope scope(isolate);
158 DCHECK(args.length() == 1); 158 DCHECK(args.length() == 1);
159 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); 159 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
160 // We don't expect access checks to be needed on JSProxy objects. 160 return *Object::GetPrototype(isolate, obj);
161 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
162 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
163 Handle<Context> context(isolate->context());
164 do {
165 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() &&
166 !isolate->MayAccess(context,
167 PrototypeIterator::GetCurrent<JSObject>(iter))) {
168 return isolate->heap()->null_value();
169 }
170 iter.AdvanceIgnoringProxies();
171 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
172 return *PrototypeIterator::GetCurrent(iter);
173 }
174 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
175 return *PrototypeIterator::GetCurrent(iter);
176 } 161 }
177 162
178 163
179 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { 164 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) {
180 HandleScope scope(isolate); 165 HandleScope scope(isolate);
181 DCHECK(args.length() == 2); 166 DCHECK(args.length() == 2);
182 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 167 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
183 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); 168 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
184 Handle<Object> result; 169 Handle<Object> result;
185 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 170 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1573
1589 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1574 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1590 HandleScope scope(isolate); 1575 HandleScope scope(isolate);
1591 DCHECK(args.length() == 2); 1576 DCHECK(args.length() == 2);
1592 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1577 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1593 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1578 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1594 return JSReceiver::DefineProperties(isolate, o, properties); 1579 return JSReceiver::DefineProperties(isolate, o, properties);
1595 } 1580 }
1596 } // namespace internal 1581 } // namespace internal
1597 } // namespace v8 1582 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698