| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 11518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11529 | 11529 |
| 11530 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( | 11530 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( |
| 11531 *receiver_handle, | 11531 *receiver_handle, |
| 11532 *name_handle, | 11532 *name_handle, |
| 11533 attributes); | 11533 attributes); |
| 11534 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 11534 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 11535 return result; | 11535 return result; |
| 11536 } | 11536 } |
| 11537 | 11537 |
| 11538 | 11538 |
| 11539 bool JSObject::HasRealNamedProperty(Name* key) { | 11539 bool JSObject::HasRealNamedProperty(Isolate* isolate, Name* key) { |
| 11540 // Check access rights if needed. | 11540 // Check access rights if needed. |
| 11541 Isolate* isolate = GetIsolate(); | |
| 11542 if (IsAccessCheckNeeded()) { | 11541 if (IsAccessCheckNeeded()) { |
| 11543 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { | 11542 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { |
| 11544 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 11543 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| 11545 return false; | 11544 return false; |
| 11546 } | 11545 } |
| 11547 } | 11546 } |
| 11548 | 11547 |
| 11549 LookupResult result(isolate); | 11548 LookupResult result(isolate); |
| 11550 LocalLookupRealNamedProperty(key, &result); | 11549 LocalLookupRealNamedProperty(key, &result); |
| 11551 return result.IsFound() && !result.IsInterceptor(); | 11550 return result.IsFound() && !result.IsInterceptor(); |
| 11552 } | 11551 } |
| 11553 | 11552 |
| 11554 | 11553 |
| 11555 bool JSObject::HasRealElementProperty(uint32_t index) { | 11554 bool JSObject::HasRealElementProperty(Isolate* isolate, uint32_t index) { |
| 11556 // Check access rights if needed. | 11555 // Check access rights if needed. |
| 11557 if (IsAccessCheckNeeded()) { | 11556 if (IsAccessCheckNeeded()) { |
| 11558 Heap* heap = GetHeap(); | 11557 if (!isolate->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { |
| 11559 if (!heap->isolate()->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { | 11558 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| 11560 heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | |
| 11561 return false; | 11559 return false; |
| 11562 } | 11560 } |
| 11563 } | 11561 } |
| 11564 | 11562 |
| 11565 // Handle [] on String objects. | 11563 return GetElementAttributeWithoutInterceptor(this, index, false) != ABSENT; |
| 11566 if (this->IsStringObjectWithCharacterAt(index)) return true; | |
| 11567 | |
| 11568 switch (GetElementsKind()) { | |
| 11569 case FAST_SMI_ELEMENTS: | |
| 11570 case FAST_ELEMENTS: | |
| 11571 case FAST_HOLEY_SMI_ELEMENTS: | |
| 11572 case FAST_HOLEY_ELEMENTS: { | |
| 11573 uint32_t length = IsJSArray() ? | |
| 11574 static_cast<uint32_t>( | |
| 11575 Smi::cast(JSArray::cast(this)->length())->value()) : | |
| 11576 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | |
| 11577 return (index < length) && | |
| 11578 !FixedArray::cast(elements())->get(index)->IsTheHole(); | |
| 11579 } | |
| 11580 case FAST_DOUBLE_ELEMENTS: | |
| 11581 case FAST_HOLEY_DOUBLE_ELEMENTS: { | |
| 11582 uint32_t length = IsJSArray() ? | |
| 11583 static_cast<uint32_t>( | |
| 11584 Smi::cast(JSArray::cast(this)->length())->value()) : | |
| 11585 static_cast<uint32_t>(FixedDoubleArray::cast(elements())->length()); | |
| 11586 return (index < length) && | |
| 11587 !FixedDoubleArray::cast(elements())->is_the_hole(index); | |
| 11588 break; | |
| 11589 } | |
| 11590 case EXTERNAL_PIXEL_ELEMENTS: { | |
| 11591 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); | |
| 11592 return index < static_cast<uint32_t>(pixels->length()); | |
| 11593 } | |
| 11594 case EXTERNAL_BYTE_ELEMENTS: | |
| 11595 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | |
| 11596 case EXTERNAL_SHORT_ELEMENTS: | |
| 11597 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | |
| 11598 case EXTERNAL_INT_ELEMENTS: | |
| 11599 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | |
| 11600 case EXTERNAL_FLOAT_ELEMENTS: | |
| 11601 case EXTERNAL_DOUBLE_ELEMENTS: { | |
| 11602 ExternalArray* array = ExternalArray::cast(elements()); | |
| 11603 return index < static_cast<uint32_t>(array->length()); | |
| 11604 } | |
| 11605 case DICTIONARY_ELEMENTS: { | |
| 11606 return element_dictionary()->FindEntry(index) | |
| 11607 != SeededNumberDictionary::kNotFound; | |
| 11608 } | |
| 11609 case NON_STRICT_ARGUMENTS_ELEMENTS: | |
| 11610 UNIMPLEMENTED(); | |
| 11611 break; | |
| 11612 } | |
| 11613 // All possibilities have been handled above already. | |
| 11614 UNREACHABLE(); | |
| 11615 return GetHeap()->null_value(); | |
| 11616 } | 11564 } |
| 11617 | 11565 |
| 11618 | 11566 |
| 11619 bool JSObject::HasRealNamedCallbackProperty(Name* key) { | 11567 bool JSObject::HasRealNamedCallbackProperty(Isolate* isolate, Name* key) { |
| 11620 // Check access rights if needed. | 11568 // Check access rights if needed. |
| 11621 Isolate* isolate = GetIsolate(); | |
| 11622 if (IsAccessCheckNeeded()) { | 11569 if (IsAccessCheckNeeded()) { |
| 11623 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { | 11570 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { |
| 11624 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 11571 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| 11625 return false; | 11572 return false; |
| 11626 } | 11573 } |
| 11627 } | 11574 } |
| 11628 | 11575 |
| 11629 LookupResult result(isolate); | 11576 LookupResult result(isolate); |
| 11630 LocalLookupRealNamedProperty(key, &result); | 11577 LocalLookupRealNamedProperty(key, &result); |
| 11631 return result.IsPropertyCallbacks(); | 11578 return result.IsPropertyCallbacks(); |
| (...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14509 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14456 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 14510 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14457 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 14511 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14458 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 14512 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14459 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 14513 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14460 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 14514 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14461 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 14515 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14462 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 14516 } | 14463 } |
| 14517 | 14464 |
| 14518 } } // namespace v8::internal | 14465 } } // namespace v8::internal |
| OLD | NEW |