| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (!maybe_result.is_null()) return maybe_result; | 142 if (!maybe_result.is_null()) return maybe_result; |
| 143 if (it->isolate()->has_pending_exception()) return maybe_result; | 143 if (it->isolate()->has_pending_exception()) return maybe_result; |
| 144 break; | 144 break; |
| 145 } | 145 } |
| 146 case LookupIterator::ACCESS_CHECK: { | 146 case LookupIterator::ACCESS_CHECK: { |
| 147 if (it->HasAccess(v8::ACCESS_GET)) break; | 147 if (it->HasAccess(v8::ACCESS_GET)) break; |
| 148 return JSObject::GetPropertyWithFailedAccessCheck(it); | 148 return JSObject::GetPropertyWithFailedAccessCheck(it); |
| 149 } | 149 } |
| 150 case LookupIterator::PROPERTY: | 150 case LookupIterator::PROPERTY: |
| 151 if (it->HasProperty()) { | 151 if (it->HasProperty()) { |
| 152 switch (it->property_type()) { | 152 switch (it->property_kind()) { |
| 153 case LookupIterator::ACCESSORS: | 153 case LookupIterator::ACCESSOR: |
| 154 return GetPropertyWithAccessor( | 154 return GetPropertyWithAccessor( |
| 155 it->GetReceiver(), it->name(), | 155 it->GetReceiver(), it->name(), |
| 156 it->GetHolder(), it->GetAccessors()); | 156 it->GetHolder(), it->GetAccessors()); |
| 157 case LookupIterator::DATA: | 157 case LookupIterator::DATA: |
| 158 return it->GetDataValue(); | 158 return it->GetDataValue(); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 break; | 161 break; |
| 162 } | 162 } |
| 163 } | 163 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 Execution::Call(isolate, setter, receiver, ARRAY_SIZE(argv), argv), | 563 Execution::Call(isolate, setter, receiver, ARRAY_SIZE(argv), argv), |
| 564 Object); | 564 Object); |
| 565 return value; | 565 return value; |
| 566 } | 566 } |
| 567 | 567 |
| 568 | 568 |
| 569 static bool FindAllCanReadHolder(LookupIterator* it) { | 569 static bool FindAllCanReadHolder(LookupIterator* it) { |
| 570 for (; it->IsFound(); it->Next()) { | 570 for (; it->IsFound(); it->Next()) { |
| 571 if (it->state() == LookupIterator::PROPERTY && | 571 if (it->state() == LookupIterator::PROPERTY && |
| 572 it->HasProperty() && | 572 it->HasProperty() && |
| 573 it->property_type() == LookupIterator::ACCESSORS) { | 573 it->property_kind() == LookupIterator::ACCESSOR) { |
| 574 Handle<Object> accessors = it->GetAccessors(); | 574 Handle<Object> accessors = it->GetAccessors(); |
| 575 if (accessors->IsAccessorInfo()) { | 575 if (accessors->IsAccessorInfo()) { |
| 576 if (AccessorInfo::cast(*accessors)->all_can_read()) return true; | 576 if (AccessorInfo::cast(*accessors)->all_can_read()) return true; |
| 577 } else if (accessors->IsAccessorPair()) { | 577 } else if (accessors->IsAccessorPair()) { |
| 578 if (AccessorPair::cast(*accessors)->all_can_read()) return true; | 578 if (AccessorPair::cast(*accessors)->all_can_read()) return true; |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 return false; | 582 return false; |
| 583 } | 583 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 594 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); | 594 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); |
| 595 return it->factory()->undefined_value(); | 595 return it->factory()->undefined_value(); |
| 596 } | 596 } |
| 597 | 597 |
| 598 | 598 |
| 599 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( | 599 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( |
| 600 Handle<JSObject> object, | 600 Handle<JSObject> object, |
| 601 LookupResult* result, | 601 LookupResult* result, |
| 602 Handle<Name> name, | 602 Handle<Name> name, |
| 603 bool check_prototype) { | 603 bool check_prototype) { |
| 604 LookupIterator::Type type = check_prototype | 604 LookupIterator::Configuration configuration = check_prototype |
| 605 ? LookupIterator::CHECK_DERIVED | 605 ? LookupIterator::CHECK_DERIVED |
| 606 : LookupIterator::CHECK_OWN_REAL; | 606 : LookupIterator::CHECK_OWN_REAL; |
| 607 LookupIterator it(object, name, object, type); | 607 LookupIterator it(object, name, object, configuration); |
| 608 if (FindAllCanReadHolder(&it)) return it.property_details().attributes(); | 608 if (FindAllCanReadHolder(&it)) return it.property_details().attributes(); |
| 609 it.isolate()->ReportFailedAccessCheck(object, v8::ACCESS_HAS); | 609 it.isolate()->ReportFailedAccessCheck(object, v8::ACCESS_HAS); |
| 610 // TODO(yangguo): Issue 3269, check for scheduled exception missing? | 610 // TODO(yangguo): Issue 3269, check for scheduled exception missing? |
| 611 return ABSENT; | 611 return ABSENT; |
| 612 } | 612 } |
| 613 | 613 |
| 614 | 614 |
| 615 static bool FindAllCanWriteHolder(LookupResult* result, | 615 static bool FindAllCanWriteHolder(LookupResult* result, |
| 616 Handle<Name> name, | 616 Handle<Name> name, |
| 617 bool check_prototype) { | 617 bool check_prototype) { |
| (...skipping 16490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17108 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17108 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 17109 static const char* error_messages_[] = { | 17109 static const char* error_messages_[] = { |
| 17110 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17110 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 17111 }; | 17111 }; |
| 17112 #undef ERROR_MESSAGES_TEXTS | 17112 #undef ERROR_MESSAGES_TEXTS |
| 17113 return error_messages_[reason]; | 17113 return error_messages_[reason]; |
| 17114 } | 17114 } |
| 17115 | 17115 |
| 17116 | 17116 |
| 17117 } } // namespace v8::internal | 17117 } } // namespace v8::internal |
| OLD | NEW |