OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1350 } else if (it->state() == LookupIterator::INTERCEPTOR) { | 1350 } else if (it->state() == LookupIterator::INTERCEPTOR) { |
1351 if (it->GetInterceptor()->all_can_read()) return true; | 1351 if (it->GetInterceptor()->all_can_read()) return true; |
1352 } else if (it->state() == LookupIterator::JSPROXY) { | 1352 } else if (it->state() == LookupIterator::JSPROXY) { |
1353 // Stop lookupiterating. And no, AllCanNotRead. | 1353 // Stop lookupiterating. And no, AllCanNotRead. |
1354 return false; | 1354 return false; |
1355 } | 1355 } |
1356 } | 1356 } |
1357 return false; | 1357 return false; |
1358 } | 1358 } |
1359 | 1359 |
1360 Handle<InterceptorInfo> JSObject::GetInterceptorForFailedAccessCheck( | |
Toon Verwaest
2016/06/22 11:30:16
Seems like this belongs on the LookupIterator, but
| |
1361 LookupIterator* it) { | |
1362 Isolate* isolate = it->isolate(); | |
1363 Handle<JSObject> checked = it->GetHolder<JSObject>(); | |
1364 DisallowHeapAllocation no_gc; | |
1365 AccessCheckInfo* access_check_info = AccessCheckInfo::Get(isolate, checked); | |
1366 if (access_check_info) { | |
1367 if (it->IsElement()) { | |
1368 return handle( | |
1369 InterceptorInfo::cast(access_check_info->indexed_interceptor()), | |
1370 isolate); | |
1371 } else { | |
1372 return handle( | |
1373 InterceptorInfo::cast(access_check_info->named_interceptor()), | |
1374 isolate); | |
1375 } | |
1376 } | |
1377 return Handle<InterceptorInfo>(); | |
1378 } | |
1360 | 1379 |
1361 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( | 1380 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( |
1362 LookupIterator* it) { | 1381 LookupIterator* it) { |
1382 Isolate* isolate = it->isolate(); | |
1363 Handle<JSObject> checked = it->GetHolder<JSObject>(); | 1383 Handle<JSObject> checked = it->GetHolder<JSObject>(); |
1364 while (AllCanRead(it)) { | 1384 Handle<InterceptorInfo> interceptor = GetInterceptorForFailedAccessCheck(it); |
1365 if (it->state() == LookupIterator::ACCESSOR) { | 1385 if (!interceptor.is_null()) { |
Toon Verwaest
2016/06/22 11:30:16
if (interceptor.is_null())? Negation just confuses
| |
1366 return GetPropertyWithAccessor(it); | 1386 MaybeHandle<Object> result; |
1387 bool done; | |
1388 result = GetPropertyWithInterceptorInternal(it, interceptor, &done); | |
1389 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | |
1390 if (done) return result; | |
1391 } else { | |
1392 while (AllCanRead(it)) { | |
1393 if (it->state() == LookupIterator::ACCESSOR) { | |
1394 return GetPropertyWithAccessor(it); | |
1395 } | |
1396 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
1397 bool done; | |
1398 Handle<Object> result; | |
1399 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, | |
1400 GetPropertyWithInterceptor(it, &done), Object); | |
1401 if (done) return result; | |
1367 } | 1402 } |
1368 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
1369 bool done; | |
1370 Handle<Object> result; | |
1371 ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), result, | |
1372 GetPropertyWithInterceptor(it, &done), Object); | |
1373 if (done) return result; | |
1374 } | 1403 } |
1375 | 1404 |
1376 // Cross-Origin [[Get]] of Well-Known Symbols does not throw, and returns | 1405 // Cross-Origin [[Get]] of Well-Known Symbols does not throw, and returns |
1377 // undefined. | 1406 // undefined. |
1378 Handle<Name> name = it->GetName(); | 1407 Handle<Name> name = it->GetName(); |
1379 if (name->IsSymbol() && Symbol::cast(*name)->is_well_known_symbol()) { | 1408 if (name->IsSymbol() && Symbol::cast(*name)->is_well_known_symbol()) { |
1380 return it->factory()->undefined_value(); | 1409 return it->factory()->undefined_value(); |
1381 } | 1410 } |
1382 | 1411 |
1383 it->isolate()->ReportFailedAccessCheck(checked); | 1412 isolate->ReportFailedAccessCheck(checked); |
1384 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); | 1413 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
1385 return it->factory()->undefined_value(); | 1414 return it->factory()->undefined_value(); |
1386 } | 1415 } |
1387 | 1416 |
1388 | 1417 |
1389 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithFailedAccessCheck( | 1418 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithFailedAccessCheck( |
1390 LookupIterator* it) { | 1419 LookupIterator* it) { |
1420 Isolate* isolate = it->isolate(); | |
1391 Handle<JSObject> checked = it->GetHolder<JSObject>(); | 1421 Handle<JSObject> checked = it->GetHolder<JSObject>(); |
1392 while (AllCanRead(it)) { | 1422 Handle<InterceptorInfo> interceptor = GetInterceptorForFailedAccessCheck(it); |
1393 if (it->state() == LookupIterator::ACCESSOR) { | 1423 if (!interceptor.is_null()) { |
1394 return Just(it->property_attributes()); | 1424 Maybe<PropertyAttributes> result = |
1425 GetPropertyAttributesWithInterceptorInternal(it, interceptor); | |
1426 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>()); | |
1427 if (result.FromMaybe(ABSENT) != ABSENT) return result; | |
1428 } else { | |
1429 while (AllCanRead(it)) { | |
1430 if (it->state() == LookupIterator::ACCESSOR) { | |
1431 return Just(it->property_attributes()); | |
1432 } | |
1433 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
1434 auto result = GetPropertyAttributesWithInterceptor(it); | |
1435 if (isolate->has_scheduled_exception()) break; | |
1436 if (result.IsJust() && result.FromJust() != ABSENT) return result; | |
1395 } | 1437 } |
1396 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
1397 auto result = GetPropertyAttributesWithInterceptor(it); | |
1398 if (it->isolate()->has_scheduled_exception()) break; | |
1399 if (result.IsJust() && result.FromJust() != ABSENT) return result; | |
1400 } | 1438 } |
1401 it->isolate()->ReportFailedAccessCheck(checked); | 1439 isolate->ReportFailedAccessCheck(checked); |
1402 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), | 1440 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>()); |
1403 Nothing<PropertyAttributes>()); | |
1404 return Just(ABSENT); | 1441 return Just(ABSENT); |
1405 } | 1442 } |
1406 | 1443 |
1407 | 1444 |
1408 // static | 1445 // static |
1409 bool JSObject::AllCanWrite(LookupIterator* it) { | 1446 bool JSObject::AllCanWrite(LookupIterator* it) { |
1410 for (; it->IsFound() && it->state() != LookupIterator::JSPROXY; it->Next()) { | 1447 for (; it->IsFound() && it->state() != LookupIterator::JSPROXY; it->Next()) { |
1411 if (it->state() == LookupIterator::ACCESSOR) { | 1448 if (it->state() == LookupIterator::ACCESSOR) { |
1412 Handle<Object> accessors = it->GetAccessors(); | 1449 Handle<Object> accessors = it->GetAccessors(); |
1413 if (accessors->IsAccessorInfo()) { | 1450 if (accessors->IsAccessorInfo()) { |
1414 if (AccessorInfo::cast(*accessors)->all_can_write()) return true; | 1451 if (AccessorInfo::cast(*accessors)->all_can_write()) return true; |
1415 } | 1452 } |
1416 } | 1453 } |
1417 } | 1454 } |
1418 return false; | 1455 return false; |
1419 } | 1456 } |
1420 | 1457 |
1421 | 1458 |
1422 Maybe<bool> JSObject::SetPropertyWithFailedAccessCheck( | 1459 Maybe<bool> JSObject::SetPropertyWithFailedAccessCheck( |
1423 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw) { | 1460 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw) { |
1461 Isolate* isolate = it->isolate(); | |
1424 Handle<JSObject> checked = it->GetHolder<JSObject>(); | 1462 Handle<JSObject> checked = it->GetHolder<JSObject>(); |
1425 if (AllCanWrite(it)) { | 1463 Handle<InterceptorInfo> interceptor = GetInterceptorForFailedAccessCheck(it); |
1464 if (!interceptor.is_null()) { | |
1465 Maybe<bool> result = SetPropertyWithInterceptorInternal( | |
1466 it, interceptor, should_throw, value); | |
1467 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | |
1468 if (result.IsJust()) return result; | |
1469 } else if (AllCanWrite(it)) { | |
1426 return SetPropertyWithAccessor(it, value, should_throw); | 1470 return SetPropertyWithAccessor(it, value, should_throw); |
1427 } | 1471 } |
1428 | 1472 |
1429 it->isolate()->ReportFailedAccessCheck(checked); | 1473 isolate->ReportFailedAccessCheck(checked); |
1430 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>()); | 1474 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
1431 return Just(true); | 1475 return Just(true); |
1432 } | 1476 } |
1433 | 1477 |
1434 | 1478 |
1435 void JSObject::SetNormalizedProperty(Handle<JSObject> object, | 1479 void JSObject::SetNormalizedProperty(Handle<JSObject> object, |
1436 Handle<Name> name, | 1480 Handle<Name> name, |
1437 Handle<Object> value, | 1481 Handle<Object> value, |
1438 PropertyDetails details) { | 1482 PropertyDetails details) { |
1439 DCHECK(!object->HasFastProperties()); | 1483 DCHECK(!object->HasFastProperties()); |
1440 if (!name->IsUniqueName()) { | 1484 if (!name->IsUniqueName()) { |
(...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4210 | 4254 |
4211 | 4255 |
4212 // static | 4256 // static |
4213 Handle<Map> Map::Update(Handle<Map> map) { | 4257 Handle<Map> Map::Update(Handle<Map> map) { |
4214 if (!map->is_deprecated()) return map; | 4258 if (!map->is_deprecated()) return map; |
4215 return ReconfigureProperty(map, -1, kData, NONE, Representation::None(), | 4259 return ReconfigureProperty(map, -1, kData, NONE, Representation::None(), |
4216 FieldType::None(map->GetIsolate()), | 4260 FieldType::None(map->GetIsolate()), |
4217 ALLOW_IN_DESCRIPTOR); | 4261 ALLOW_IN_DESCRIPTOR); |
4218 } | 4262 } |
4219 | 4263 |
4220 | 4264 Maybe<bool> JSObject::SetPropertyWithInterceptorInternal( |
Toon Verwaest
2016/06/22 11:30:16
namespace {} helper method?
| |
4221 Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it, | 4265 LookupIterator* it, Handle<InterceptorInfo> interceptor, |
4222 ShouldThrow should_throw, | 4266 ShouldThrow should_throw, Handle<Object> value) { |
4223 Handle<Object> value) { | |
4224 Isolate* isolate = it->isolate(); | 4267 Isolate* isolate = it->isolate(); |
4225 // Make sure that the top context does not change when doing callbacks or | 4268 // Make sure that the top context does not change when doing callbacks or |
4226 // interceptor calls. | 4269 // interceptor calls. |
4227 AssertNoContextChange ncc(isolate); | 4270 AssertNoContextChange ncc(isolate); |
4228 | 4271 |
4229 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
4230 Handle<InterceptorInfo> interceptor(it->GetInterceptor()); | |
4231 if (interceptor->setter()->IsUndefined(isolate)) return Just(false); | 4272 if (interceptor->setter()->IsUndefined(isolate)) return Just(false); |
4232 | 4273 |
4233 Handle<JSObject> holder = it->GetHolder<JSObject>(); | 4274 Handle<JSObject> holder = it->GetHolder<JSObject>(); |
4234 bool result; | 4275 bool result; |
4235 Handle<Object> receiver = it->GetReceiver(); | 4276 Handle<Object> receiver = it->GetReceiver(); |
4236 if (!receiver->IsJSReceiver()) { | 4277 if (!receiver->IsJSReceiver()) { |
4237 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, | 4278 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, |
4238 Object::ConvertReceiver(isolate, receiver), | 4279 Object::ConvertReceiver(isolate, receiver), |
4239 Nothing<bool>()); | 4280 Nothing<bool>()); |
4240 } | 4281 } |
(...skipping 18 matching lines...) Expand all Loading... | |
4259 v8::GenericNamedPropertySetterCallback setter = | 4300 v8::GenericNamedPropertySetterCallback setter = |
4260 v8::ToCData<v8::GenericNamedPropertySetterCallback>( | 4301 v8::ToCData<v8::GenericNamedPropertySetterCallback>( |
4261 interceptor->setter()); | 4302 interceptor->setter()); |
4262 result = !args.Call(setter, name, value).is_null(); | 4303 result = !args.Call(setter, name, value).is_null(); |
4263 } | 4304 } |
4264 | 4305 |
4265 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>()); | 4306 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing<bool>()); |
4266 return Just(result); | 4307 return Just(result); |
4267 } | 4308 } |
4268 | 4309 |
4310 Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it, | |
4311 ShouldThrow should_throw, | |
4312 Handle<Object> value) { | |
4313 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
4314 return SetPropertyWithInterceptorInternal(it, it->GetInterceptor(), | |
4315 should_throw, value); | |
4316 } | |
4269 | 4317 |
4270 MaybeHandle<Object> Object::SetProperty(Handle<Object> object, | 4318 MaybeHandle<Object> Object::SetProperty(Handle<Object> object, |
4271 Handle<Name> name, Handle<Object> value, | 4319 Handle<Name> name, Handle<Object> value, |
4272 LanguageMode language_mode, | 4320 LanguageMode language_mode, |
4273 StoreFromKeyed store_mode) { | 4321 StoreFromKeyed store_mode) { |
4274 LookupIterator it(object, name); | 4322 LookupIterator it(object, name); |
4275 MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_mode)); | 4323 MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_mode)); |
4276 return value; | 4324 return value; |
4277 } | 4325 } |
4278 | 4326 |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5518 | 5566 |
5519 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( | 5567 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( |
5520 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 5568 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
5521 PropertyAttributes attributes) { | 5569 PropertyAttributes attributes) { |
5522 Isolate* isolate = object->GetIsolate(); | 5570 Isolate* isolate = object->GetIsolate(); |
5523 LookupIterator it = LookupIterator::PropertyOrElement( | 5571 LookupIterator it = LookupIterator::PropertyOrElement( |
5524 isolate, object, name, object, LookupIterator::OWN); | 5572 isolate, object, name, object, LookupIterator::OWN); |
5525 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); | 5573 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); |
5526 } | 5574 } |
5527 | 5575 |
5528 | 5576 Maybe<PropertyAttributes> |
5529 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( | 5577 JSObject::GetPropertyAttributesWithInterceptorInternal( |
Toon Verwaest
2016/06/22 11:30:16
Same here?
| |
5530 LookupIterator* it) { | 5578 LookupIterator* it, Handle<InterceptorInfo> interceptor) { |
5531 Isolate* isolate = it->isolate(); | 5579 Isolate* isolate = it->isolate(); |
5532 // Make sure that the top context does not change when doing | 5580 // Make sure that the top context does not change when doing |
5533 // callbacks or interceptor calls. | 5581 // callbacks or interceptor calls. |
5534 AssertNoContextChange ncc(isolate); | 5582 AssertNoContextChange ncc(isolate); |
5535 HandleScope scope(isolate); | 5583 HandleScope scope(isolate); |
5536 | 5584 |
5537 Handle<JSObject> holder = it->GetHolder<JSObject>(); | 5585 Handle<JSObject> holder = it->GetHolder<JSObject>(); |
5538 Handle<InterceptorInfo> interceptor(it->GetInterceptor()); | |
5539 if (!it->IsElement() && it->name()->IsSymbol() && | 5586 if (!it->IsElement() && it->name()->IsSymbol() && |
5540 !interceptor->can_intercept_symbols()) { | 5587 !interceptor->can_intercept_symbols()) { |
5541 return Just(ABSENT); | 5588 return Just(ABSENT); |
5542 } | 5589 } |
5543 Handle<Object> receiver = it->GetReceiver(); | 5590 Handle<Object> receiver = it->GetReceiver(); |
5544 if (!receiver->IsJSReceiver()) { | 5591 if (!receiver->IsJSReceiver()) { |
5545 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, | 5592 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, |
5546 Object::ConvertReceiver(isolate, receiver), | 5593 Object::ConvertReceiver(isolate, receiver), |
5547 Nothing<PropertyAttributes>()); | 5594 Nothing<PropertyAttributes>()); |
5548 } | 5595 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5584 interceptor->getter()); | 5631 interceptor->getter()); |
5585 result = args.Call(getter, name); | 5632 result = args.Call(getter, name); |
5586 } | 5633 } |
5587 if (!result.is_null()) return Just(DONT_ENUM); | 5634 if (!result.is_null()) return Just(DONT_ENUM); |
5588 } | 5635 } |
5589 | 5636 |
5590 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>()); | 5637 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>()); |
5591 return Just(ABSENT); | 5638 return Just(ABSENT); |
5592 } | 5639 } |
5593 | 5640 |
5641 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( | |
5642 LookupIterator* it) { | |
5643 return GetPropertyAttributesWithInterceptorInternal(it, it->GetInterceptor()); | |
5644 } | |
5594 | 5645 |
5595 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( | 5646 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( |
5596 LookupIterator* it) { | 5647 LookupIterator* it) { |
5597 for (; it->IsFound(); it->Next()) { | 5648 for (; it->IsFound(); it->Next()) { |
5598 switch (it->state()) { | 5649 switch (it->state()) { |
5599 case LookupIterator::NOT_FOUND: | 5650 case LookupIterator::NOT_FOUND: |
5600 case LookupIterator::TRANSITION: | 5651 case LookupIterator::TRANSITION: |
5601 UNREACHABLE(); | 5652 UNREACHABLE(); |
5602 case LookupIterator::JSPROXY: | 5653 case LookupIterator::JSPROXY: |
5603 return JSProxy::GetPropertyAttributes(it); | 5654 return JSProxy::GetPropertyAttributes(it); |
(...skipping 9844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15448 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); | 15499 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); |
15449 for (int i = 0; i < capacity; i++) { | 15500 for (int i = 0; i < capacity; i++) { |
15450 Object* k = this->KeyAt(i); | 15501 Object* k = this->KeyAt(i); |
15451 if (this->IsKey(isolate, k)) { | 15502 if (this->IsKey(isolate, k)) { |
15452 elements->set(pos++, this->ValueAt(i), mode); | 15503 elements->set(pos++, this->ValueAt(i), mode); |
15453 } | 15504 } |
15454 } | 15505 } |
15455 DCHECK(pos == elements->length()); | 15506 DCHECK(pos == elements->length()); |
15456 } | 15507 } |
15457 | 15508 |
15458 | 15509 MaybeHandle<Object> JSObject::GetPropertyWithInterceptorInternal( |
15459 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it, | 15510 LookupIterator* it, Handle<InterceptorInfo> interceptor, bool* done) { |
15460 bool* done) { | |
15461 *done = false; | 15511 *done = false; |
15462 Isolate* isolate = it->isolate(); | 15512 Isolate* isolate = it->isolate(); |
15463 // Make sure that the top context does not change when doing callbacks or | 15513 // Make sure that the top context does not change when doing callbacks or |
15464 // interceptor calls. | 15514 // interceptor calls. |
15465 AssertNoContextChange ncc(isolate); | 15515 AssertNoContextChange ncc(isolate); |
15466 | 15516 |
15467 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
15468 Handle<InterceptorInfo> interceptor = it->GetInterceptor(); | |
15469 if (interceptor->getter()->IsUndefined(isolate)) { | 15517 if (interceptor->getter()->IsUndefined(isolate)) { |
15470 return isolate->factory()->undefined_value(); | 15518 return isolate->factory()->undefined_value(); |
15471 } | 15519 } |
15472 | 15520 |
15473 Handle<JSObject> holder = it->GetHolder<JSObject>(); | 15521 Handle<JSObject> holder = it->GetHolder<JSObject>(); |
15474 Handle<Object> result; | 15522 Handle<Object> result; |
15475 Handle<Object> receiver = it->GetReceiver(); | 15523 Handle<Object> receiver = it->GetReceiver(); |
15476 if (!receiver->IsJSReceiver()) { | 15524 if (!receiver->IsJSReceiver()) { |
15477 ASSIGN_RETURN_ON_EXCEPTION( | 15525 ASSIGN_RETURN_ON_EXCEPTION( |
15478 isolate, receiver, Object::ConvertReceiver(isolate, receiver), Object); | 15526 isolate, receiver, Object::ConvertReceiver(isolate, receiver), Object); |
(...skipping 20 matching lines...) Expand all Loading... | |
15499 result = args.Call(getter, name); | 15547 result = args.Call(getter, name); |
15500 } | 15548 } |
15501 | 15549 |
15502 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 15550 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
15503 if (result.is_null()) return isolate->factory()->undefined_value(); | 15551 if (result.is_null()) return isolate->factory()->undefined_value(); |
15504 *done = true; | 15552 *done = true; |
15505 // Rebox handle before return | 15553 // Rebox handle before return |
15506 return handle(*result, isolate); | 15554 return handle(*result, isolate); |
15507 } | 15555 } |
15508 | 15556 |
15557 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it, | |
15558 bool* done) { | |
15559 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | |
15560 return GetPropertyWithInterceptorInternal(it, it->GetInterceptor(), done); | |
15561 } | |
15509 | 15562 |
15510 Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object, | 15563 Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object, |
15511 Handle<Name> name) { | 15564 Handle<Name> name) { |
15512 LookupIterator it = LookupIterator::PropertyOrElement( | 15565 LookupIterator it = LookupIterator::PropertyOrElement( |
15513 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); | 15566 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); |
15514 return HasProperty(&it); | 15567 return HasProperty(&it); |
15515 } | 15568 } |
15516 | 15569 |
15517 | 15570 |
15518 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, | 15571 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, |
(...skipping 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
18856 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 18909 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
18857 Handle<Object> new_value) { | 18910 Handle<Object> new_value) { |
18858 if (cell->value() != *new_value) { | 18911 if (cell->value() != *new_value) { |
18859 cell->set_value(*new_value); | 18912 cell->set_value(*new_value); |
18860 Isolate* isolate = cell->GetIsolate(); | 18913 Isolate* isolate = cell->GetIsolate(); |
18861 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18914 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
18862 isolate, DependentCode::kPropertyCellChangedGroup); | 18915 isolate, DependentCode::kPropertyCellChangedGroup); |
18863 } | 18916 } |
18864 } | 18917 } |
18865 | 18918 |
18919 // static | |
18920 AccessCheckInfo* AccessCheckInfo::Get(Isolate* isolate, | |
18921 Handle<JSObject> receiver) { | |
18922 Object* maybe_constructor = receiver->map()->GetConstructor(); | |
18923 if (!maybe_constructor->IsJSFunction()) return NULL; | |
Toon Verwaest
2016/06/22 11:30:16
Shouldn't this be a DCHECK; in addition to a DCHEC
jochen (gone - plz use gerrit)
2016/06/22 12:28:22
it's null for detached global proxies
| |
18924 JSFunction* constructor = JSFunction::cast(maybe_constructor); | |
18925 if (!constructor->shared()->IsApiFunction()) return NULL; | |
Toon Verwaest
2016/06/22 11:30:16
In which case this has to be an API function, so a
jochen (gone - plz use gerrit)
2016/06/22 12:28:22
it's not for the debug context.
| |
18926 | |
18927 Object* data_obj = | |
18928 constructor->shared()->get_api_func_data()->access_check_info(); | |
Toon Verwaest
2016/06/22 11:30:16
Unrelated to this particular CL, but we should pro
| |
18929 if (data_obj->IsUndefined(isolate)) return NULL; | |
18930 | |
18931 return AccessCheckInfo::cast(data_obj); | |
18932 } | |
18933 | |
18866 } // namespace internal | 18934 } // namespace internal |
18867 } // namespace v8 | 18935 } // namespace v8 |
OLD | NEW |