| OLD | NEW |
| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 static MaybeHandle<Object> LoadFromSuper(Isolate* isolate, | 266 static MaybeHandle<Object> LoadFromSuper(Isolate* isolate, |
| 267 Handle<Object> receiver, | 267 Handle<Object> receiver, |
| 268 Handle<JSObject> home_object, | 268 Handle<JSObject> home_object, |
| 269 Handle<Name> name, | 269 Handle<Name> name, |
| 270 LanguageMode language_mode) { | 270 LanguageMode language_mode) { |
| 271 if (home_object->IsAccessCheckNeeded() && | 271 if (home_object->IsAccessCheckNeeded() && |
| 272 !isolate->MayAccess(handle(isolate->context()), home_object)) { | 272 !isolate->MayAccess(handle(isolate->context()), home_object)) { |
| 273 isolate->ReportFailedAccessCheck(home_object); | 273 isolate->ReportFailedAccessCheck(home_object); |
| 274 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 274 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 275 UNREACHABLE(); | |
| 276 } | 275 } |
| 277 | 276 |
| 278 PrototypeIterator iter(isolate, home_object); | 277 PrototypeIterator iter(isolate, home_object); |
| 279 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | 278 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
| 280 if (!proto->IsJSReceiver()) { | 279 if (!proto->IsJSReceiver()) { |
| 281 return Object::ReadAbsentProperty(isolate, proto, name, language_mode); | 280 return Object::ReadAbsentProperty(isolate, proto, name, language_mode); |
| 282 } | 281 } |
| 283 | 282 |
| 284 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); | 283 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); |
| 285 Handle<Object> result; | 284 Handle<Object> result; |
| 286 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, | 285 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, |
| 287 Object::GetProperty(&it, language_mode), Object); | 286 Object::GetProperty(&it, language_mode), Object); |
| 288 return result; | 287 return result; |
| 289 } | 288 } |
| 290 | 289 |
| 291 | 290 |
| 292 static MaybeHandle<Object> LoadElementFromSuper(Isolate* isolate, | 291 static MaybeHandle<Object> LoadElementFromSuper(Isolate* isolate, |
| 293 Handle<Object> receiver, | 292 Handle<Object> receiver, |
| 294 Handle<JSObject> home_object, | 293 Handle<JSObject> home_object, |
| 295 uint32_t index, | 294 uint32_t index, |
| 296 LanguageMode language_mode) { | 295 LanguageMode language_mode) { |
| 297 if (home_object->IsAccessCheckNeeded() && | 296 if (home_object->IsAccessCheckNeeded() && |
| 298 !isolate->MayAccess(handle(isolate->context()), home_object)) { | 297 !isolate->MayAccess(handle(isolate->context()), home_object)) { |
| 299 isolate->ReportFailedAccessCheck(home_object); | 298 isolate->ReportFailedAccessCheck(home_object); |
| 300 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 299 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 301 UNREACHABLE(); | |
| 302 } | 300 } |
| 303 | 301 |
| 304 PrototypeIterator iter(isolate, home_object); | 302 PrototypeIterator iter(isolate, home_object); |
| 305 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | 303 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
| 306 if (!proto->IsJSReceiver()) { | 304 if (!proto->IsJSReceiver()) { |
| 307 Handle<Object> name = isolate->factory()->NewNumberFromUint(index); | 305 Handle<Object> name = isolate->factory()->NewNumberFromUint(index); |
| 308 return Object::ReadAbsentProperty(isolate, proto, name, language_mode); | 306 return Object::ReadAbsentProperty(isolate, proto, name, language_mode); |
| 309 } | 307 } |
| 310 | 308 |
| 311 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto)); | 309 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 367 } |
| 370 | 368 |
| 371 | 369 |
| 372 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, | 370 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, |
| 373 Handle<Object> receiver, Handle<Name> name, | 371 Handle<Object> receiver, Handle<Name> name, |
| 374 Handle<Object> value, LanguageMode language_mode) { | 372 Handle<Object> value, LanguageMode language_mode) { |
| 375 if (home_object->IsAccessCheckNeeded() && | 373 if (home_object->IsAccessCheckNeeded() && |
| 376 !isolate->MayAccess(handle(isolate->context()), home_object)) { | 374 !isolate->MayAccess(handle(isolate->context()), home_object)) { |
| 377 isolate->ReportFailedAccessCheck(home_object); | 375 isolate->ReportFailedAccessCheck(home_object); |
| 378 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 376 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 379 UNREACHABLE(); | |
| 380 } | 377 } |
| 381 | 378 |
| 382 PrototypeIterator iter(isolate, home_object); | 379 PrototypeIterator iter(isolate, home_object); |
| 383 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | 380 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
| 384 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); | 381 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); |
| 385 | 382 |
| 386 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); | 383 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); |
| 387 Handle<Object> result; | 384 Handle<Object> result; |
| 388 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 385 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 389 isolate, result, | 386 isolate, result, |
| 390 Object::SetSuperProperty(&it, value, language_mode, | 387 Object::SetSuperProperty(&it, value, language_mode, |
| 391 Object::CERTAINLY_NOT_STORE_FROM_KEYED)); | 388 Object::CERTAINLY_NOT_STORE_FROM_KEYED)); |
| 392 return *result; | 389 return *result; |
| 393 } | 390 } |
| 394 | 391 |
| 395 | 392 |
| 396 static Object* StoreElementToSuper(Isolate* isolate, | 393 static Object* StoreElementToSuper(Isolate* isolate, |
| 397 Handle<JSObject> home_object, | 394 Handle<JSObject> home_object, |
| 398 Handle<Object> receiver, uint32_t index, | 395 Handle<Object> receiver, uint32_t index, |
| 399 Handle<Object> value, | 396 Handle<Object> value, |
| 400 LanguageMode language_mode) { | 397 LanguageMode language_mode) { |
| 401 if (home_object->IsAccessCheckNeeded() && | 398 if (home_object->IsAccessCheckNeeded() && |
| 402 !isolate->MayAccess(handle(isolate->context()), home_object)) { | 399 !isolate->MayAccess(handle(isolate->context()), home_object)) { |
| 403 isolate->ReportFailedAccessCheck(home_object); | 400 isolate->ReportFailedAccessCheck(home_object); |
| 404 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 401 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 405 UNREACHABLE(); | |
| 406 } | 402 } |
| 407 | 403 |
| 408 PrototypeIterator iter(isolate, home_object); | 404 PrototypeIterator iter(isolate, home_object); |
| 409 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | 405 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
| 410 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); | 406 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); |
| 411 | 407 |
| 412 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto)); | 408 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto)); |
| 413 Handle<Object> result; | 409 Handle<Object> result; |
| 414 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 410 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 415 isolate, result, | 411 isolate, result, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 513 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 518 isolate, result, | 514 isolate, result, |
| 519 Execution::New(isolate, super_constructor, original_constructor, | 515 Execution::New(isolate, super_constructor, original_constructor, |
| 520 argument_count, arguments.get())); | 516 argument_count, arguments.get())); |
| 521 | 517 |
| 522 return *result; | 518 return *result; |
| 523 } | 519 } |
| 524 | 520 |
| 525 } // namespace internal | 521 } // namespace internal |
| 526 } // namespace v8 | 522 } // namespace v8 |
| OLD | NEW |