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