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

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

Issue 1398093002: Pass the context from which a given receiver is accessed explicitly (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/objects.cc ('k') | src/runtime/runtime-object.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 <stdlib.h> 7 #include <stdlib.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 source, Handle<Smi>::cast(start_position)->value(), 262 source, Handle<Smi>::cast(start_position)->value(),
263 Handle<Smi>::cast(end_position)->value()); 263 Handle<Smi>::cast(end_position)->value());
264 } 264 }
265 265
266 266
267 static MaybeHandle<Object> LoadFromSuper(Isolate* isolate, 267 static MaybeHandle<Object> LoadFromSuper(Isolate* isolate,
268 Handle<Object> receiver, 268 Handle<Object> receiver,
269 Handle<JSObject> home_object, 269 Handle<JSObject> home_object,
270 Handle<Name> name, 270 Handle<Name> name,
271 LanguageMode language_mode) { 271 LanguageMode language_mode) {
272 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { 272 if (home_object->IsAccessCheckNeeded() &&
273 !isolate->MayAccess(handle(isolate->context()), home_object)) {
273 isolate->ReportFailedAccessCheck(home_object); 274 isolate->ReportFailedAccessCheck(home_object);
274 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 275 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
275 } 276 }
276 277
277 PrototypeIterator iter(isolate, home_object); 278 PrototypeIterator iter(isolate, home_object);
278 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 279 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
279 if (!proto->IsJSReceiver()) { 280 if (!proto->IsJSReceiver()) {
280 return Object::ReadAbsentProperty(isolate, proto, name, language_mode); 281 return Object::ReadAbsentProperty(isolate, proto, name, language_mode);
281 } 282 }
282 283
283 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); 284 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
284 Handle<Object> result; 285 Handle<Object> result;
285 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, 286 ASSIGN_RETURN_ON_EXCEPTION(isolate, result,
286 Object::GetProperty(&it, language_mode), Object); 287 Object::GetProperty(&it, language_mode), Object);
287 return result; 288 return result;
288 } 289 }
289 290
290 291
291 static MaybeHandle<Object> LoadElementFromSuper(Isolate* isolate, 292 static MaybeHandle<Object> LoadElementFromSuper(Isolate* isolate,
292 Handle<Object> receiver, 293 Handle<Object> receiver,
293 Handle<JSObject> home_object, 294 Handle<JSObject> home_object,
294 uint32_t index, 295 uint32_t index,
295 LanguageMode language_mode) { 296 LanguageMode language_mode) {
296 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { 297 if (home_object->IsAccessCheckNeeded() &&
298 !isolate->MayAccess(handle(isolate->context()), home_object)) {
297 isolate->ReportFailedAccessCheck(home_object); 299 isolate->ReportFailedAccessCheck(home_object);
298 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 300 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
299 } 301 }
300 302
301 PrototypeIterator iter(isolate, home_object); 303 PrototypeIterator iter(isolate, home_object);
302 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 304 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
303 if (!proto->IsJSReceiver()) { 305 if (!proto->IsJSReceiver()) {
304 Handle<Object> name = isolate->factory()->NewNumberFromUint(index); 306 Handle<Object> name = isolate->factory()->NewNumberFromUint(index);
305 return Object::ReadAbsentProperty(isolate, proto, name, language_mode); 307 return Object::ReadAbsentProperty(isolate, proto, name, language_mode);
306 } 308 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 364 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
363 isolate, result, 365 isolate, result,
364 LoadFromSuper(isolate, receiver, home_object, name, language_mode)); 366 LoadFromSuper(isolate, receiver, home_object, name, language_mode));
365 return *result; 367 return *result;
366 } 368 }
367 369
368 370
369 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, 371 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
370 Handle<Object> receiver, Handle<Name> name, 372 Handle<Object> receiver, Handle<Name> name,
371 Handle<Object> value, LanguageMode language_mode) { 373 Handle<Object> value, LanguageMode language_mode) {
372 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { 374 if (home_object->IsAccessCheckNeeded() &&
375 !isolate->MayAccess(handle(isolate->context()), home_object)) {
373 isolate->ReportFailedAccessCheck(home_object); 376 isolate->ReportFailedAccessCheck(home_object);
374 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 377 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
375 } 378 }
376 379
377 PrototypeIterator iter(isolate, home_object); 380 PrototypeIterator iter(isolate, home_object);
378 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 381 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
379 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 382 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
380 383
381 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); 384 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
382 Handle<Object> result; 385 Handle<Object> result;
383 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 386 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
384 isolate, result, 387 isolate, result,
385 Object::SetSuperProperty(&it, value, language_mode, 388 Object::SetSuperProperty(&it, value, language_mode,
386 Object::CERTAINLY_NOT_STORE_FROM_KEYED)); 389 Object::CERTAINLY_NOT_STORE_FROM_KEYED));
387 return *result; 390 return *result;
388 } 391 }
389 392
390 393
391 static Object* StoreElementToSuper(Isolate* isolate, 394 static Object* StoreElementToSuper(Isolate* isolate,
392 Handle<JSObject> home_object, 395 Handle<JSObject> home_object,
393 Handle<Object> receiver, uint32_t index, 396 Handle<Object> receiver, uint32_t index,
394 Handle<Object> value, 397 Handle<Object> value,
395 LanguageMode language_mode) { 398 LanguageMode language_mode) {
396 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { 399 if (home_object->IsAccessCheckNeeded() &&
400 !isolate->MayAccess(handle(isolate->context()), home_object)) {
397 isolate->ReportFailedAccessCheck(home_object); 401 isolate->ReportFailedAccessCheck(home_object);
398 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 402 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
399 } 403 }
400 404
401 PrototypeIterator iter(isolate, home_object); 405 PrototypeIterator iter(isolate, home_object);
402 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 406 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
403 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 407 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
404 408
405 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto)); 409 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto));
406 Handle<Object> result; 410 Handle<Object> result;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 514 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
511 isolate, result, 515 isolate, result,
512 Execution::New(isolate, super_constructor, original_constructor, 516 Execution::New(isolate, super_constructor, original_constructor,
513 argument_count, arguments.get())); 517 argument_count, arguments.get()));
514 518
515 return *result; 519 return *result;
516 } 520 }
517 521
518 } // namespace internal 522 } // namespace internal
519 } // namespace v8 523 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698