| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 MaybeObject* value = GetProperty(receiver, &result, name, attributes); | 153 MaybeObject* value = GetProperty(receiver, &result, name, attributes); |
| 154 ASSERT(*attributes <= ABSENT); | 154 ASSERT(*attributes <= ABSENT); |
| 155 return value; | 155 return value; |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 MaybeObject* Object::GetPropertyWithCallback(Object* receiver, | 159 MaybeObject* Object::GetPropertyWithCallback(Object* receiver, |
| 160 Object* structure, | 160 Object* structure, |
| 161 String* name, | 161 String* name, |
| 162 Object* holder) { | 162 Object* holder) { |
| 163 Isolate* isolate = name->GetIsolate(); |
| 163 // To accommodate both the old and the new api we switch on the | 164 // To accommodate both the old and the new api we switch on the |
| 164 // data structure used to store the callbacks. Eventually proxy | 165 // data structure used to store the callbacks. Eventually proxy |
| 165 // callbacks should be phased out. | 166 // callbacks should be phased out. |
| 166 if (structure->IsProxy()) { | 167 if (structure->IsProxy()) { |
| 167 AccessorDescriptor* callback = | 168 AccessorDescriptor* callback = |
| 168 reinterpret_cast<AccessorDescriptor*>(Proxy::cast(structure)->proxy()); | 169 reinterpret_cast<AccessorDescriptor*>(Proxy::cast(structure)->proxy()); |
| 169 MaybeObject* value = (callback->getter)(receiver, callback->data); | 170 MaybeObject* value = (callback->getter)(receiver, callback->data); |
| 170 RETURN_IF_SCHEDULED_EXCEPTION(); | 171 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 171 return value; | 172 return value; |
| 172 } | 173 } |
| 173 | 174 |
| 174 Isolate* isolate = name->GetIsolate(); | |
| 175 | |
| 176 // api style callbacks. | 175 // api style callbacks. |
| 177 if (structure->IsAccessorInfo()) { | 176 if (structure->IsAccessorInfo()) { |
| 178 AccessorInfo* data = AccessorInfo::cast(structure); | 177 AccessorInfo* data = AccessorInfo::cast(structure); |
| 179 Object* fun_obj = data->getter(); | 178 Object* fun_obj = data->getter(); |
| 180 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); | 179 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); |
| 181 HandleScope scope; | 180 HandleScope scope; |
| 182 JSObject* self = JSObject::cast(receiver); | 181 JSObject* self = JSObject::cast(receiver); |
| 183 JSObject* holder_handle = JSObject::cast(holder); | 182 JSObject* holder_handle = JSObject::cast(holder); |
| 184 Handle<String> key(name); | 183 Handle<String> key(name); |
| 185 LOG(ApiNamedPropertyAccess("load", self, name)); | 184 LOG(ApiNamedPropertyAccess("load", self, name)); |
| 186 CustomArguments args(isolate, data->data(), self, holder_handle); | 185 CustomArguments args(isolate, data->data(), self, holder_handle); |
| 187 v8::AccessorInfo info(args.end()); | 186 v8::AccessorInfo info(args.end()); |
| 188 v8::Handle<v8::Value> result; | 187 v8::Handle<v8::Value> result; |
| 189 { | 188 { |
| 190 // Leaving JavaScript. | 189 // Leaving JavaScript. |
| 191 VMState state(isolate, EXTERNAL); | 190 VMState state(isolate, EXTERNAL); |
| 192 result = call_fun(v8::Utils::ToLocal(key), info); | 191 result = call_fun(v8::Utils::ToLocal(key), info); |
| 193 } | 192 } |
| 194 RETURN_IF_SCHEDULED_EXCEPTION(); | 193 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 195 if (result.IsEmpty()) { | 194 if (result.IsEmpty()) { |
| 196 return isolate->heap()->undefined_value(); | 195 return isolate->heap()->undefined_value(); |
| 197 } | 196 } |
| 198 return *v8::Utils::OpenHandle(*result); | 197 return *v8::Utils::OpenHandle(*result); |
| 199 } | 198 } |
| 200 | 199 |
| 201 // __defineGetter__ callback | 200 // __defineGetter__ callback |
| 202 if (structure->IsFixedArray()) { | 201 if (structure->IsFixedArray()) { |
| 203 Object* getter = FixedArray::cast(structure)->get(kGetterIndex); | 202 Object* getter = FixedArray::cast(structure)->get(kGetterIndex); |
| 204 if (getter->IsJSFunction()) { | 203 if (getter->IsJSFunction()) { |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 // Leaving JavaScript. | 1599 // Leaving JavaScript. |
| 1601 VMState state(isolate, EXTERNAL); | 1600 VMState state(isolate, EXTERNAL); |
| 1602 Handle<Object> value_unhole(value->IsTheHole() ? | 1601 Handle<Object> value_unhole(value->IsTheHole() ? |
| 1603 isolate->heap()->undefined_value() : | 1602 isolate->heap()->undefined_value() : |
| 1604 value, | 1603 value, |
| 1605 isolate); | 1604 isolate); |
| 1606 result = setter(v8::Utils::ToLocal(name_handle), | 1605 result = setter(v8::Utils::ToLocal(name_handle), |
| 1607 v8::Utils::ToLocal(value_unhole), | 1606 v8::Utils::ToLocal(value_unhole), |
| 1608 info); | 1607 info); |
| 1609 } | 1608 } |
| 1610 RETURN_IF_SCHEDULED_EXCEPTION(); | 1609 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1611 if (!result.IsEmpty()) return *value_handle; | 1610 if (!result.IsEmpty()) return *value_handle; |
| 1612 } | 1611 } |
| 1613 MaybeObject* raw_result = | 1612 MaybeObject* raw_result = |
| 1614 this_handle->SetPropertyPostInterceptor(*name_handle, | 1613 this_handle->SetPropertyPostInterceptor(*name_handle, |
| 1615 *value_handle, | 1614 *value_handle, |
| 1616 attributes); | 1615 attributes); |
| 1617 RETURN_IF_SCHEDULED_EXCEPTION(); | 1616 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1618 return raw_result; | 1617 return raw_result; |
| 1619 } | 1618 } |
| 1620 | 1619 |
| 1621 | 1620 |
| 1622 MaybeObject* JSObject::SetProperty(String* name, | 1621 MaybeObject* JSObject::SetProperty(String* name, |
| 1623 Object* value, | 1622 Object* value, |
| 1624 PropertyAttributes attributes) { | 1623 PropertyAttributes attributes) { |
| 1625 LookupResult result; | 1624 LookupResult result; |
| 1626 LocalLookup(name, &result); | 1625 LocalLookup(name, &result); |
| 1627 return SetProperty(&result, name, value, attributes); | 1626 return SetProperty(&result, name, value, attributes); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1640 ASSERT(!value->IsTheHole()); | 1639 ASSERT(!value->IsTheHole()); |
| 1641 Handle<Object> value_handle(value, isolate); | 1640 Handle<Object> value_handle(value, isolate); |
| 1642 | 1641 |
| 1643 // To accommodate both the old and the new api we switch on the | 1642 // To accommodate both the old and the new api we switch on the |
| 1644 // data structure used to store the callbacks. Eventually proxy | 1643 // data structure used to store the callbacks. Eventually proxy |
| 1645 // callbacks should be phased out. | 1644 // callbacks should be phased out. |
| 1646 if (structure->IsProxy()) { | 1645 if (structure->IsProxy()) { |
| 1647 AccessorDescriptor* callback = | 1646 AccessorDescriptor* callback = |
| 1648 reinterpret_cast<AccessorDescriptor*>(Proxy::cast(structure)->proxy()); | 1647 reinterpret_cast<AccessorDescriptor*>(Proxy::cast(structure)->proxy()); |
| 1649 MaybeObject* obj = (callback->setter)(this, value, callback->data); | 1648 MaybeObject* obj = (callback->setter)(this, value, callback->data); |
| 1650 RETURN_IF_SCHEDULED_EXCEPTION(); | 1649 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1651 if (obj->IsFailure()) return obj; | 1650 if (obj->IsFailure()) return obj; |
| 1652 return *value_handle; | 1651 return *value_handle; |
| 1653 } | 1652 } |
| 1654 | 1653 |
| 1655 if (structure->IsAccessorInfo()) { | 1654 if (structure->IsAccessorInfo()) { |
| 1656 // api style callbacks | 1655 // api style callbacks |
| 1657 AccessorInfo* data = AccessorInfo::cast(structure); | 1656 AccessorInfo* data = AccessorInfo::cast(structure); |
| 1658 Object* call_obj = data->setter(); | 1657 Object* call_obj = data->setter(); |
| 1659 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); | 1658 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); |
| 1660 if (call_fun == NULL) return value; | 1659 if (call_fun == NULL) return value; |
| 1661 Handle<String> key(name); | 1660 Handle<String> key(name); |
| 1662 LOG(ApiNamedPropertyAccess("store", this, name)); | 1661 LOG(ApiNamedPropertyAccess("store", this, name)); |
| 1663 CustomArguments args(isolate, data->data(), this, JSObject::cast(holder)); | 1662 CustomArguments args(isolate, data->data(), this, JSObject::cast(holder)); |
| 1664 v8::AccessorInfo info(args.end()); | 1663 v8::AccessorInfo info(args.end()); |
| 1665 { | 1664 { |
| 1666 // Leaving JavaScript. | 1665 // Leaving JavaScript. |
| 1667 VMState state(isolate, EXTERNAL); | 1666 VMState state(isolate, EXTERNAL); |
| 1668 call_fun(v8::Utils::ToLocal(key), | 1667 call_fun(v8::Utils::ToLocal(key), |
| 1669 v8::Utils::ToLocal(value_handle), | 1668 v8::Utils::ToLocal(value_handle), |
| 1670 info); | 1669 info); |
| 1671 } | 1670 } |
| 1672 RETURN_IF_SCHEDULED_EXCEPTION(); | 1671 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1673 return *value_handle; | 1672 return *value_handle; |
| 1674 } | 1673 } |
| 1675 | 1674 |
| 1676 if (structure->IsFixedArray()) { | 1675 if (structure->IsFixedArray()) { |
| 1677 Object* setter = FixedArray::cast(structure)->get(kSetterIndex); | 1676 Object* setter = FixedArray::cast(structure)->get(kSetterIndex); |
| 1678 if (setter->IsJSFunction()) { | 1677 if (setter->IsJSFunction()) { |
| 1679 return SetPropertyWithDefinedSetter(JSFunction::cast(setter), value); | 1678 return SetPropertyWithDefinedSetter(JSFunction::cast(setter), value); |
| 1680 } else { | 1679 } else { |
| 1681 Handle<String> key(name); | 1680 Handle<String> key(name); |
| 1682 Handle<Object> holder_handle(holder, isolate); | 1681 Handle<Object> holder_handle(holder, isolate); |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter()); | 2502 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter()); |
| 2504 LOG(ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name)); | 2503 LOG(ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name)); |
| 2505 CustomArguments args(isolate, interceptor->data(), this, this); | 2504 CustomArguments args(isolate, interceptor->data(), this, this); |
| 2506 v8::AccessorInfo info(args.end()); | 2505 v8::AccessorInfo info(args.end()); |
| 2507 v8::Handle<v8::Boolean> result; | 2506 v8::Handle<v8::Boolean> result; |
| 2508 { | 2507 { |
| 2509 // Leaving JavaScript. | 2508 // Leaving JavaScript. |
| 2510 VMState state(isolate, EXTERNAL); | 2509 VMState state(isolate, EXTERNAL); |
| 2511 result = deleter(v8::Utils::ToLocal(name_handle), info); | 2510 result = deleter(v8::Utils::ToLocal(name_handle), info); |
| 2512 } | 2511 } |
| 2513 RETURN_IF_SCHEDULED_EXCEPTION(); | 2512 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 2514 if (!result.IsEmpty()) { | 2513 if (!result.IsEmpty()) { |
| 2515 ASSERT(result->IsBoolean()); | 2514 ASSERT(result->IsBoolean()); |
| 2516 return *v8::Utils::OpenHandle(*result); | 2515 return *v8::Utils::OpenHandle(*result); |
| 2517 } | 2516 } |
| 2518 } | 2517 } |
| 2519 MaybeObject* raw_result = | 2518 MaybeObject* raw_result = |
| 2520 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); | 2519 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); |
| 2521 RETURN_IF_SCHEDULED_EXCEPTION(); | 2520 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 2522 return raw_result; | 2521 return raw_result; |
| 2523 } | 2522 } |
| 2524 | 2523 |
| 2525 | 2524 |
| 2526 MaybeObject* JSObject::DeleteElementPostInterceptor(uint32_t index, | 2525 MaybeObject* JSObject::DeleteElementPostInterceptor(uint32_t index, |
| 2527 DeleteMode mode) { | 2526 DeleteMode mode) { |
| 2528 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); | 2527 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); |
| 2529 Heap* heap = GetHeap(); | 2528 Heap* heap = GetHeap(); |
| 2530 switch (GetElementsKind()) { | 2529 switch (GetElementsKind()) { |
| 2531 case FAST_ELEMENTS: { | 2530 case FAST_ELEMENTS: { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2571 Handle<JSObject> this_handle(this); | 2570 Handle<JSObject> this_handle(this); |
| 2572 LOG(ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); | 2571 LOG(ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); |
| 2573 CustomArguments args(isolate, interceptor->data(), this, this); | 2572 CustomArguments args(isolate, interceptor->data(), this, this); |
| 2574 v8::AccessorInfo info(args.end()); | 2573 v8::AccessorInfo info(args.end()); |
| 2575 v8::Handle<v8::Boolean> result; | 2574 v8::Handle<v8::Boolean> result; |
| 2576 { | 2575 { |
| 2577 // Leaving JavaScript. | 2576 // Leaving JavaScript. |
| 2578 VMState state(isolate, EXTERNAL); | 2577 VMState state(isolate, EXTERNAL); |
| 2579 result = deleter(index, info); | 2578 result = deleter(index, info); |
| 2580 } | 2579 } |
| 2581 RETURN_IF_SCHEDULED_EXCEPTION(); | 2580 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 2582 if (!result.IsEmpty()) { | 2581 if (!result.IsEmpty()) { |
| 2583 ASSERT(result->IsBoolean()); | 2582 ASSERT(result->IsBoolean()); |
| 2584 return *v8::Utils::OpenHandle(*result); | 2583 return *v8::Utils::OpenHandle(*result); |
| 2585 } | 2584 } |
| 2586 MaybeObject* raw_result = | 2585 MaybeObject* raw_result = |
| 2587 this_handle->DeleteElementPostInterceptor(index, NORMAL_DELETION); | 2586 this_handle->DeleteElementPostInterceptor(index, NORMAL_DELETION); |
| 2588 RETURN_IF_SCHEDULED_EXCEPTION(); | 2587 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 2589 return raw_result; | 2588 return raw_result; |
| 2590 } | 2589 } |
| 2591 | 2590 |
| 2592 | 2591 |
| 2593 MaybeObject* JSObject::DeleteElement(uint32_t index, DeleteMode mode) { | 2592 MaybeObject* JSObject::DeleteElement(uint32_t index, DeleteMode mode) { |
| 2594 Isolate* isolate = GetIsolate(); | 2593 Isolate* isolate = GetIsolate(); |
| 2595 // Check access rights if needed. | 2594 // Check access rights if needed. |
| 2596 if (IsAccessCheckNeeded() && | 2595 if (IsAccessCheckNeeded() && |
| 2597 !isolate->MayIndexedAccess(this, index, v8::ACCESS_DELETE)) { | 2596 !isolate->MayIndexedAccess(this, index, v8::ACCESS_DELETE)) { |
| 2598 isolate->ReportFailedAccessCheck(this, v8::ACCESS_DELETE); | 2597 isolate->ReportFailedAccessCheck(this, v8::ACCESS_DELETE); |
| (...skipping 3922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6521 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter()); | 6520 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter()); |
| 6522 LOG(ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); | 6521 LOG(ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); |
| 6523 CustomArguments args(isolate, interceptor->data(), this, this); | 6522 CustomArguments args(isolate, interceptor->data(), this, this); |
| 6524 v8::AccessorInfo info(args.end()); | 6523 v8::AccessorInfo info(args.end()); |
| 6525 v8::Handle<v8::Value> result; | 6524 v8::Handle<v8::Value> result; |
| 6526 { | 6525 { |
| 6527 // Leaving JavaScript. | 6526 // Leaving JavaScript. |
| 6528 VMState state(isolate, EXTERNAL); | 6527 VMState state(isolate, EXTERNAL); |
| 6529 result = setter(index, v8::Utils::ToLocal(value_handle), info); | 6528 result = setter(index, v8::Utils::ToLocal(value_handle), info); |
| 6530 } | 6529 } |
| 6531 RETURN_IF_SCHEDULED_EXCEPTION(); | 6530 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 6532 if (!result.IsEmpty()) return *value_handle; | 6531 if (!result.IsEmpty()) return *value_handle; |
| 6533 } | 6532 } |
| 6534 MaybeObject* raw_result = | 6533 MaybeObject* raw_result = |
| 6535 this_handle->SetElementWithoutInterceptor(index, *value_handle); | 6534 this_handle->SetElementWithoutInterceptor(index, *value_handle); |
| 6536 RETURN_IF_SCHEDULED_EXCEPTION(); | 6535 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 6537 return raw_result; | 6536 return raw_result; |
| 6538 } | 6537 } |
| 6539 | 6538 |
| 6540 | 6539 |
| 6541 MaybeObject* JSObject::GetElementWithCallback(Object* receiver, | 6540 MaybeObject* JSObject::GetElementWithCallback(Object* receiver, |
| 6542 Object* structure, | 6541 Object* structure, |
| 6543 uint32_t index, | 6542 uint32_t index, |
| 6544 Object* holder) { | 6543 Object* holder) { |
| 6545 Isolate* isolate = GetIsolate(); | 6544 Isolate* isolate = GetIsolate(); |
| 6546 ASSERT(!structure->IsProxy()); | 6545 ASSERT(!structure->IsProxy()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 6557 Handle<String> key(isolate->factory()->NumberToString(number)); | 6556 Handle<String> key(isolate->factory()->NumberToString(number)); |
| 6558 LOG(ApiNamedPropertyAccess("load", *self, *key)); | 6557 LOG(ApiNamedPropertyAccess("load", *self, *key)); |
| 6559 CustomArguments args(isolate, data->data(), *self, *holder_handle); | 6558 CustomArguments args(isolate, data->data(), *self, *holder_handle); |
| 6560 v8::AccessorInfo info(args.end()); | 6559 v8::AccessorInfo info(args.end()); |
| 6561 v8::Handle<v8::Value> result; | 6560 v8::Handle<v8::Value> result; |
| 6562 { | 6561 { |
| 6563 // Leaving JavaScript. | 6562 // Leaving JavaScript. |
| 6564 VMState state(isolate, EXTERNAL); | 6563 VMState state(isolate, EXTERNAL); |
| 6565 result = call_fun(v8::Utils::ToLocal(key), info); | 6564 result = call_fun(v8::Utils::ToLocal(key), info); |
| 6566 } | 6565 } |
| 6567 RETURN_IF_SCHEDULED_EXCEPTION(); | 6566 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 6568 if (result.IsEmpty()) return isolate->heap()->undefined_value(); | 6567 if (result.IsEmpty()) return isolate->heap()->undefined_value(); |
| 6569 return *v8::Utils::OpenHandle(*result); | 6568 return *v8::Utils::OpenHandle(*result); |
| 6570 } | 6569 } |
| 6571 | 6570 |
| 6572 // __defineGetter__ callback | 6571 // __defineGetter__ callback |
| 6573 if (structure->IsFixedArray()) { | 6572 if (structure->IsFixedArray()) { |
| 6574 Object* getter = FixedArray::cast(structure)->get(kGetterIndex); | 6573 Object* getter = FixedArray::cast(structure)->get(kGetterIndex); |
| 6575 if (getter->IsJSFunction()) { | 6574 if (getter->IsJSFunction()) { |
| 6576 return Object::GetPropertyWithDefinedGetter(receiver, | 6575 return Object::GetPropertyWithDefinedGetter(receiver, |
| 6577 JSFunction::cast(getter)); | 6576 JSFunction::cast(getter)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6613 LOG(ApiNamedPropertyAccess("store", this, *key)); | 6612 LOG(ApiNamedPropertyAccess("store", this, *key)); |
| 6614 CustomArguments args(isolate, data->data(), this, JSObject::cast(holder)); | 6613 CustomArguments args(isolate, data->data(), this, JSObject::cast(holder)); |
| 6615 v8::AccessorInfo info(args.end()); | 6614 v8::AccessorInfo info(args.end()); |
| 6616 { | 6615 { |
| 6617 // Leaving JavaScript. | 6616 // Leaving JavaScript. |
| 6618 VMState state(isolate, EXTERNAL); | 6617 VMState state(isolate, EXTERNAL); |
| 6619 call_fun(v8::Utils::ToLocal(key), | 6618 call_fun(v8::Utils::ToLocal(key), |
| 6620 v8::Utils::ToLocal(value_handle), | 6619 v8::Utils::ToLocal(value_handle), |
| 6621 info); | 6620 info); |
| 6622 } | 6621 } |
| 6623 RETURN_IF_SCHEDULED_EXCEPTION(); | 6622 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 6624 return *value_handle; | 6623 return *value_handle; |
| 6625 } | 6624 } |
| 6626 | 6625 |
| 6627 if (structure->IsFixedArray()) { | 6626 if (structure->IsFixedArray()) { |
| 6628 Object* setter = FixedArray::cast(structure)->get(kSetterIndex); | 6627 Object* setter = FixedArray::cast(structure)->get(kSetterIndex); |
| 6629 if (setter->IsJSFunction()) { | 6628 if (setter->IsJSFunction()) { |
| 6630 return SetPropertyWithDefinedSetter(JSFunction::cast(setter), value); | 6629 return SetPropertyWithDefinedSetter(JSFunction::cast(setter), value); |
| 6631 } else { | 6630 } else { |
| 6632 Handle<Object> holder_handle(holder, isolate); | 6631 Handle<Object> holder_handle(holder, isolate); |
| 6633 Handle<Object> key(isolate->factory()->NewNumberFromUint(index)); | 6632 Handle<Object> key(isolate->factory()->NewNumberFromUint(index)); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6951 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); | 6950 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); |
| 6952 LOG(ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); | 6951 LOG(ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); |
| 6953 CustomArguments args(isolate, interceptor->data(), receiver, this); | 6952 CustomArguments args(isolate, interceptor->data(), receiver, this); |
| 6954 v8::AccessorInfo info(args.end()); | 6953 v8::AccessorInfo info(args.end()); |
| 6955 v8::Handle<v8::Value> result; | 6954 v8::Handle<v8::Value> result; |
| 6956 { | 6955 { |
| 6957 // Leaving JavaScript. | 6956 // Leaving JavaScript. |
| 6958 VMState state(isolate, EXTERNAL); | 6957 VMState state(isolate, EXTERNAL); |
| 6959 result = getter(index, info); | 6958 result = getter(index, info); |
| 6960 } | 6959 } |
| 6961 RETURN_IF_SCHEDULED_EXCEPTION(); | 6960 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 6962 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result); | 6961 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result); |
| 6963 } | 6962 } |
| 6964 | 6963 |
| 6965 MaybeObject* raw_result = | 6964 MaybeObject* raw_result = |
| 6966 holder_handle->GetElementPostInterceptor(*this_handle, index); | 6965 holder_handle->GetElementPostInterceptor(*this_handle, index); |
| 6967 RETURN_IF_SCHEDULED_EXCEPTION(); | 6966 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 6968 return raw_result; | 6967 return raw_result; |
| 6969 } | 6968 } |
| 6970 | 6969 |
| 6971 | 6970 |
| 6972 MaybeObject* JSObject::GetElementWithReceiver(JSObject* receiver, | 6971 MaybeObject* JSObject::GetElementWithReceiver(JSObject* receiver, |
| 6973 uint32_t index) { | 6972 uint32_t index) { |
| 6974 Heap* heap = GetHeap(); | 6973 Heap* heap = GetHeap(); |
| 6975 // Check access rights if needed. | 6974 // Check access rights if needed. |
| 6976 if (IsAccessCheckNeeded() && | 6975 if (IsAccessCheckNeeded() && |
| 6977 !heap->isolate()->MayIndexedAccess(this, index, v8::ACCESS_GET)) { | 6976 !heap->isolate()->MayIndexedAccess(this, index, v8::ACCESS_GET)) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7272 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 7271 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
| 7273 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 7272 LOG(ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
| 7274 CustomArguments args(isolate, interceptor->data(), receiver, this); | 7273 CustomArguments args(isolate, interceptor->data(), receiver, this); |
| 7275 v8::AccessorInfo info(args.end()); | 7274 v8::AccessorInfo info(args.end()); |
| 7276 v8::Handle<v8::Value> result; | 7275 v8::Handle<v8::Value> result; |
| 7277 { | 7276 { |
| 7278 // Leaving JavaScript. | 7277 // Leaving JavaScript. |
| 7279 VMState state(isolate, EXTERNAL); | 7278 VMState state(isolate, EXTERNAL); |
| 7280 result = getter(v8::Utils::ToLocal(name_handle), info); | 7279 result = getter(v8::Utils::ToLocal(name_handle), info); |
| 7281 } | 7280 } |
| 7282 RETURN_IF_SCHEDULED_EXCEPTION(); | 7281 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 7283 if (!result.IsEmpty()) { | 7282 if (!result.IsEmpty()) { |
| 7284 *attributes = NONE; | 7283 *attributes = NONE; |
| 7285 return *v8::Utils::OpenHandle(*result); | 7284 return *v8::Utils::OpenHandle(*result); |
| 7286 } | 7285 } |
| 7287 } | 7286 } |
| 7288 | 7287 |
| 7289 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( | 7288 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( |
| 7290 *receiver_handle, | 7289 *receiver_handle, |
| 7291 *name_handle, | 7290 *name_handle, |
| 7292 attributes); | 7291 attributes); |
| 7293 RETURN_IF_SCHEDULED_EXCEPTION(); | 7292 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 7294 return result; | 7293 return result; |
| 7295 } | 7294 } |
| 7296 | 7295 |
| 7297 | 7296 |
| 7298 bool JSObject::HasRealNamedProperty(String* key) { | 7297 bool JSObject::HasRealNamedProperty(String* key) { |
| 7299 Heap* heap = GetHeap(); | 7298 Heap* heap = GetHeap(); |
| 7300 // Check access rights if needed. | 7299 // Check access rights if needed. |
| 7301 if (IsAccessCheckNeeded() && | 7300 if (IsAccessCheckNeeded() && |
| 7302 !heap->isolate()->MayNamedAccess(this, key, v8::ACCESS_HAS)) { | 7301 !heap->isolate()->MayNamedAccess(this, key, v8::ACCESS_HAS)) { |
| 7303 heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); | 7302 heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| (...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9446 if (break_point_objects()->IsUndefined()) return 0; | 9445 if (break_point_objects()->IsUndefined()) return 0; |
| 9447 // Single beak point. | 9446 // Single beak point. |
| 9448 if (!break_point_objects()->IsFixedArray()) return 1; | 9447 if (!break_point_objects()->IsFixedArray()) return 1; |
| 9449 // Multiple break points. | 9448 // Multiple break points. |
| 9450 return FixedArray::cast(break_point_objects())->length(); | 9449 return FixedArray::cast(break_point_objects())->length(); |
| 9451 } | 9450 } |
| 9452 #endif | 9451 #endif |
| 9453 | 9452 |
| 9454 | 9453 |
| 9455 } } // namespace v8::internal | 9454 } } // namespace v8::internal |
| OLD | NEW |