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 11537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11548 | 11548 |
11549 LookupResult result(isolate); | 11549 LookupResult result(isolate); |
11550 LocalLookupRealNamedProperty(key, &result); | 11550 LocalLookupRealNamedProperty(key, &result); |
11551 return result.IsFound() && !result.IsInterceptor(); | 11551 return result.IsFound() && !result.IsInterceptor(); |
11552 } | 11552 } |
11553 | 11553 |
11554 | 11554 |
11555 bool JSObject::HasRealElementProperty(uint32_t index) { | 11555 bool JSObject::HasRealElementProperty(uint32_t index) { |
11556 // Check access rights if needed. | 11556 // Check access rights if needed. |
11557 if (IsAccessCheckNeeded()) { | 11557 if (IsAccessCheckNeeded()) { |
11558 Heap* heap = GetHeap(); | 11558 Isolate* isolate = GetIsolate(); |
Toon Verwaest
2013/04/04 13:06:17
Since this function is only called from the API, w
adamk
2013/04/04 19:09:47
Done, and added the Isolate argument to the other
| |
11559 if (!heap->isolate()->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { | 11559 if (!isolate->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { |
11560 heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 11560 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
11561 return false; | 11561 return false; |
11562 } | 11562 } |
11563 } | 11563 } |
11564 | 11564 |
11565 // Handle [] on String objects. | 11565 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 } | 11566 } |
11617 | 11567 |
11618 | 11568 |
11619 bool JSObject::HasRealNamedCallbackProperty(Name* key) { | 11569 bool JSObject::HasRealNamedCallbackProperty(Name* key) { |
11620 // Check access rights if needed. | 11570 // Check access rights if needed. |
11621 Isolate* isolate = GetIsolate(); | 11571 Isolate* isolate = GetIsolate(); |
11622 if (IsAccessCheckNeeded()) { | 11572 if (IsAccessCheckNeeded()) { |
11623 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { | 11573 if (!isolate->MayNamedAccess(this, key, v8::ACCESS_HAS)) { |
11624 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 11574 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
11625 return false; | 11575 return false; |
(...skipping 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14509 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14459 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
14510 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14460 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
14511 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14461 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
14512 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14462 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
14513 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14463 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
14514 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14464 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
14515 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14465 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
14516 } | 14466 } |
14517 | 14467 |
14518 } } // namespace v8::internal | 14468 } } // namespace v8::internal |
OLD | NEW |