| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 if (!constructor.IsEmpty()) | 1458 if (!constructor.IsEmpty()) |
| 1459 obj->set_constructor(*Utils::OpenHandle(*constructor)); | 1459 obj->set_constructor(*Utils::OpenHandle(*constructor)); |
| 1460 obj->set_internal_field_count(i::Smi::FromInt(0)); | 1460 obj->set_internal_field_count(i::Smi::FromInt(0)); |
| 1461 return Utils::ToLocal(obj); | 1461 return Utils::ToLocal(obj); |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 | 1464 |
| 1465 // Ensure that the object template has a constructor. If no | 1465 // Ensure that the object template has a constructor. If no |
| 1466 // constructor is available we create one. | 1466 // constructor is available we create one. |
| 1467 static i::Handle<i::FunctionTemplateInfo> EnsureConstructor( | 1467 static i::Handle<i::FunctionTemplateInfo> EnsureConstructor( |
| 1468 i::Isolate* isolate, |
| 1468 ObjectTemplate* object_template) { | 1469 ObjectTemplate* object_template) { |
| 1469 i::Object* obj = Utils::OpenHandle(object_template)->constructor(); | 1470 i::Object* obj = Utils::OpenHandle(object_template)->constructor(); |
| 1470 if (!obj ->IsUndefined()) { | 1471 if (!obj ->IsUndefined()) { |
| 1471 i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj); | 1472 i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj); |
| 1472 return i::Handle<i::FunctionTemplateInfo>(info, info->GetIsolate()); | 1473 return i::Handle<i::FunctionTemplateInfo>(info, isolate); |
| 1473 } | 1474 } |
| 1474 Local<FunctionTemplate> templ = FunctionTemplate::New(); | 1475 Local<FunctionTemplate> templ = |
| 1476 FunctionTemplate::New(reinterpret_cast<Isolate*>(isolate)); |
| 1475 i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ); | 1477 i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ); |
| 1476 constructor->set_instance_template(*Utils::OpenHandle(object_template)); | 1478 constructor->set_instance_template(*Utils::OpenHandle(object_template)); |
| 1477 Utils::OpenHandle(object_template)->set_constructor(*constructor); | 1479 Utils::OpenHandle(object_template)->set_constructor(*constructor); |
| 1478 return constructor; | 1480 return constructor; |
| 1479 } | 1481 } |
| 1480 | 1482 |
| 1481 | 1483 |
| 1482 static inline void AddPropertyToTemplate( | 1484 static inline void AddPropertyToTemplate( |
| 1483 i::Handle<i::TemplateInfo> info, | 1485 i::Handle<i::TemplateInfo> info, |
| 1484 i::Handle<i::AccessorInfo> obj) { | 1486 i::Handle<i::AccessorInfo> obj) { |
| 1485 i::Handle<i::Object> list(info->property_accessors(), info->GetIsolate()); | 1487 i::Handle<i::Object> list(info->property_accessors(), info->GetIsolate()); |
| 1486 if (list->IsUndefined()) { | 1488 if (list->IsUndefined()) { |
| 1487 list = NeanderArray().value(); | 1489 list = NeanderArray().value(); |
| 1488 info->set_property_accessors(*list); | 1490 info->set_property_accessors(*list); |
| 1489 } | 1491 } |
| 1490 NeanderArray array(list); | 1492 NeanderArray array(list); |
| 1491 array.add(obj); | 1493 array.add(obj); |
| 1492 } | 1494 } |
| 1493 | 1495 |
| 1494 | 1496 |
| 1495 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( | 1497 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( |
| 1498 i::Isolate* isolate, |
| 1496 Template* template_obj) { | 1499 Template* template_obj) { |
| 1497 return Utils::OpenHandle(template_obj); | 1500 return Utils::OpenHandle(template_obj); |
| 1498 } | 1501 } |
| 1499 | 1502 |
| 1500 | 1503 |
| 1501 // TODO(dcarney): remove this with ObjectTemplate::SetAccessor | 1504 // TODO(dcarney): remove this with ObjectTemplate::SetAccessor |
| 1502 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( | 1505 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( |
| 1506 i::Isolate* isolate, |
| 1503 ObjectTemplate* object_template) { | 1507 ObjectTemplate* object_template) { |
| 1504 EnsureConstructor(object_template); | 1508 EnsureConstructor(isolate, object_template); |
| 1505 return Utils::OpenHandle(object_template); | 1509 return Utils::OpenHandle(object_template); |
| 1506 } | 1510 } |
| 1507 | 1511 |
| 1508 | 1512 |
| 1509 template<typename Setter, typename Getter, typename Data, typename Template> | 1513 template<typename Setter, typename Getter, typename Data, typename Template> |
| 1510 static bool TemplateSetAccessor( | 1514 static bool TemplateSetAccessor( |
| 1511 Template* template_obj, | 1515 Template* template_obj, |
| 1512 v8::Local<String> name, | 1516 v8::Local<String> name, |
| 1513 Getter getter, | 1517 Getter getter, |
| 1514 Setter setter, | 1518 Setter setter, |
| 1515 Data data, | 1519 Data data, |
| 1516 AccessControl settings, | 1520 AccessControl settings, |
| 1517 PropertyAttribute attribute, | 1521 PropertyAttribute attribute, |
| 1518 v8::Local<AccessorSignature> signature) { | 1522 v8::Local<AccessorSignature> signature) { |
| 1519 i::Isolate* isolate = Utils::OpenHandle(template_obj)->GetIsolate(); | 1523 i::Isolate* isolate = Utils::OpenHandle(template_obj)->GetIsolate(); |
| 1520 ENTER_V8(isolate); | 1524 ENTER_V8(isolate); |
| 1521 i::HandleScope scope(isolate); | 1525 i::HandleScope scope(isolate); |
| 1522 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo( | 1526 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo( |
| 1523 name, getter, setter, data, settings, attribute, signature); | 1527 name, getter, setter, data, settings, attribute, signature); |
| 1524 if (obj.is_null()) return false; | 1528 if (obj.is_null()) return false; |
| 1525 i::Handle<i::TemplateInfo> info = GetTemplateInfo(template_obj); | 1529 i::Handle<i::TemplateInfo> info = GetTemplateInfo(isolate, template_obj); |
| 1526 AddPropertyToTemplate(info, obj); | 1530 AddPropertyToTemplate(info, obj); |
| 1527 return true; | 1531 return true; |
| 1528 } | 1532 } |
| 1529 | 1533 |
| 1530 | 1534 |
| 1531 bool Template::SetDeclaredAccessor( | 1535 bool Template::SetDeclaredAccessor( |
| 1532 Local<String> name, | 1536 Local<String> name, |
| 1533 Local<DeclaredAccessorDescriptor> descriptor, | 1537 Local<DeclaredAccessorDescriptor> descriptor, |
| 1534 PropertyAttribute attribute, | 1538 PropertyAttribute attribute, |
| 1535 Local<AccessorSignature> signature, | 1539 Local<AccessorSignature> signature, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 void ObjectTemplate::SetNamedPropertyHandler( | 1571 void ObjectTemplate::SetNamedPropertyHandler( |
| 1568 NamedPropertyGetterCallback getter, | 1572 NamedPropertyGetterCallback getter, |
| 1569 NamedPropertySetterCallback setter, | 1573 NamedPropertySetterCallback setter, |
| 1570 NamedPropertyQueryCallback query, | 1574 NamedPropertyQueryCallback query, |
| 1571 NamedPropertyDeleterCallback remover, | 1575 NamedPropertyDeleterCallback remover, |
| 1572 NamedPropertyEnumeratorCallback enumerator, | 1576 NamedPropertyEnumeratorCallback enumerator, |
| 1573 Handle<Value> data) { | 1577 Handle<Value> data) { |
| 1574 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1578 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1575 ENTER_V8(isolate); | 1579 ENTER_V8(isolate); |
| 1576 i::HandleScope scope(isolate); | 1580 i::HandleScope scope(isolate); |
| 1577 EnsureConstructor(this); | 1581 EnsureConstructor(isolate, this); |
| 1578 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1582 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( |
| 1579 Utils::OpenHandle(this)->constructor()); | 1583 Utils::OpenHandle(this)->constructor()); |
| 1580 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1584 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1581 i::Handle<i::Struct> struct_obj = | 1585 i::Handle<i::Struct> struct_obj = |
| 1582 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1586 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
| 1583 i::Handle<i::InterceptorInfo> obj = | 1587 i::Handle<i::InterceptorInfo> obj = |
| 1584 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1588 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
| 1585 | 1589 |
| 1586 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1590 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1587 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1591 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1588 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1592 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
| 1589 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1593 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
| 1590 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1594 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
| 1591 | 1595 |
| 1592 if (data.IsEmpty()) { | 1596 if (data.IsEmpty()) { |
| 1593 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1597 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1594 } | 1598 } |
| 1595 obj->set_data(*Utils::OpenHandle(*data)); | 1599 obj->set_data(*Utils::OpenHandle(*data)); |
| 1596 cons->set_named_property_handler(*obj); | 1600 cons->set_named_property_handler(*obj); |
| 1597 } | 1601 } |
| 1598 | 1602 |
| 1599 | 1603 |
| 1600 void ObjectTemplate::MarkAsUndetectable() { | 1604 void ObjectTemplate::MarkAsUndetectable() { |
| 1601 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1605 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1602 ENTER_V8(isolate); | 1606 ENTER_V8(isolate); |
| 1603 i::HandleScope scope(isolate); | 1607 i::HandleScope scope(isolate); |
| 1604 EnsureConstructor(this); | 1608 EnsureConstructor(isolate, this); |
| 1605 i::FunctionTemplateInfo* constructor = | 1609 i::FunctionTemplateInfo* constructor = |
| 1606 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); | 1610 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); |
| 1607 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1611 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1608 cons->set_undetectable(true); | 1612 cons->set_undetectable(true); |
| 1609 } | 1613 } |
| 1610 | 1614 |
| 1611 | 1615 |
| 1612 void ObjectTemplate::SetAccessCheckCallbacks( | 1616 void ObjectTemplate::SetAccessCheckCallbacks( |
| 1613 NamedSecurityCallback named_callback, | 1617 NamedSecurityCallback named_callback, |
| 1614 IndexedSecurityCallback indexed_callback, | 1618 IndexedSecurityCallback indexed_callback, |
| 1615 Handle<Value> data, | 1619 Handle<Value> data, |
| 1616 bool turned_on_by_default) { | 1620 bool turned_on_by_default) { |
| 1617 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1621 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1618 ENTER_V8(isolate); | 1622 ENTER_V8(isolate); |
| 1619 i::HandleScope scope(isolate); | 1623 i::HandleScope scope(isolate); |
| 1620 EnsureConstructor(this); | 1624 EnsureConstructor(isolate, this); |
| 1621 | 1625 |
| 1622 i::Handle<i::Struct> struct_info = | 1626 i::Handle<i::Struct> struct_info = |
| 1623 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); | 1627 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); |
| 1624 i::Handle<i::AccessCheckInfo> info = | 1628 i::Handle<i::AccessCheckInfo> info = |
| 1625 i::Handle<i::AccessCheckInfo>::cast(struct_info); | 1629 i::Handle<i::AccessCheckInfo>::cast(struct_info); |
| 1626 | 1630 |
| 1627 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); | 1631 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); |
| 1628 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); | 1632 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); |
| 1629 | 1633 |
| 1630 if (data.IsEmpty()) { | 1634 if (data.IsEmpty()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1643 void ObjectTemplate::SetIndexedPropertyHandler( | 1647 void ObjectTemplate::SetIndexedPropertyHandler( |
| 1644 IndexedPropertyGetterCallback getter, | 1648 IndexedPropertyGetterCallback getter, |
| 1645 IndexedPropertySetterCallback setter, | 1649 IndexedPropertySetterCallback setter, |
| 1646 IndexedPropertyQueryCallback query, | 1650 IndexedPropertyQueryCallback query, |
| 1647 IndexedPropertyDeleterCallback remover, | 1651 IndexedPropertyDeleterCallback remover, |
| 1648 IndexedPropertyEnumeratorCallback enumerator, | 1652 IndexedPropertyEnumeratorCallback enumerator, |
| 1649 Handle<Value> data) { | 1653 Handle<Value> data) { |
| 1650 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1654 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1651 ENTER_V8(isolate); | 1655 ENTER_V8(isolate); |
| 1652 i::HandleScope scope(isolate); | 1656 i::HandleScope scope(isolate); |
| 1653 EnsureConstructor(this); | 1657 EnsureConstructor(isolate, this); |
| 1654 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1658 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( |
| 1655 Utils::OpenHandle(this)->constructor()); | 1659 Utils::OpenHandle(this)->constructor()); |
| 1656 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1660 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1657 i::Handle<i::Struct> struct_obj = | 1661 i::Handle<i::Struct> struct_obj = |
| 1658 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1662 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
| 1659 i::Handle<i::InterceptorInfo> obj = | 1663 i::Handle<i::InterceptorInfo> obj = |
| 1660 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1664 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
| 1661 | 1665 |
| 1662 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1666 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1663 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1667 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1664 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1668 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
| 1665 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1669 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
| 1666 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1670 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
| 1667 | 1671 |
| 1668 if (data.IsEmpty()) { | 1672 if (data.IsEmpty()) { |
| 1669 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1673 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1670 } | 1674 } |
| 1671 obj->set_data(*Utils::OpenHandle(*data)); | 1675 obj->set_data(*Utils::OpenHandle(*data)); |
| 1672 cons->set_indexed_property_handler(*obj); | 1676 cons->set_indexed_property_handler(*obj); |
| 1673 } | 1677 } |
| 1674 | 1678 |
| 1675 | 1679 |
| 1676 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, | 1680 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, |
| 1677 Handle<Value> data) { | 1681 Handle<Value> data) { |
| 1678 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1682 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1679 ENTER_V8(isolate); | 1683 ENTER_V8(isolate); |
| 1680 i::HandleScope scope(isolate); | 1684 i::HandleScope scope(isolate); |
| 1681 EnsureConstructor(this); | 1685 EnsureConstructor(isolate, this); |
| 1682 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1686 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( |
| 1683 Utils::OpenHandle(this)->constructor()); | 1687 Utils::OpenHandle(this)->constructor()); |
| 1684 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1688 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1685 i::Handle<i::Struct> struct_obj = | 1689 i::Handle<i::Struct> struct_obj = |
| 1686 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); | 1690 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); |
| 1687 i::Handle<i::CallHandlerInfo> obj = | 1691 i::Handle<i::CallHandlerInfo> obj = |
| 1688 i::Handle<i::CallHandlerInfo>::cast(struct_obj); | 1692 i::Handle<i::CallHandlerInfo>::cast(struct_obj); |
| 1689 SET_FIELD_WRAPPED(obj, set_callback, callback); | 1693 SET_FIELD_WRAPPED(obj, set_callback, callback); |
| 1690 if (data.IsEmpty()) { | 1694 if (data.IsEmpty()) { |
| 1691 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1695 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1705 if (!ApiCheck(i::Smi::IsValid(value), | 1709 if (!ApiCheck(i::Smi::IsValid(value), |
| 1706 "v8::ObjectTemplate::SetInternalFieldCount()", | 1710 "v8::ObjectTemplate::SetInternalFieldCount()", |
| 1707 "Invalid internal field count")) { | 1711 "Invalid internal field count")) { |
| 1708 return; | 1712 return; |
| 1709 } | 1713 } |
| 1710 ENTER_V8(isolate); | 1714 ENTER_V8(isolate); |
| 1711 if (value > 0) { | 1715 if (value > 0) { |
| 1712 // The internal field count is set by the constructor function's | 1716 // The internal field count is set by the constructor function's |
| 1713 // construct code, so we ensure that there is a constructor | 1717 // construct code, so we ensure that there is a constructor |
| 1714 // function to do the setting. | 1718 // function to do the setting. |
| 1715 EnsureConstructor(this); | 1719 EnsureConstructor(isolate, this); |
| 1716 } | 1720 } |
| 1717 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); | 1721 Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); |
| 1718 } | 1722 } |
| 1719 | 1723 |
| 1720 | 1724 |
| 1721 // --- S c r i p t D a t a --- | 1725 // --- S c r i p t D a t a --- |
| 1722 | 1726 |
| 1723 | 1727 |
| 1724 ScriptData* ScriptData::PreCompile(v8::Isolate* isolate, | 1728 ScriptData* ScriptData::PreCompile(v8::Isolate* isolate, |
| 1725 const char* input, | 1729 const char* input, |
| (...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5271 | 5275 |
| 5272 // Enter V8 via an ENTER_V8 scope. | 5276 // Enter V8 via an ENTER_V8 scope. |
| 5273 { | 5277 { |
| 5274 ENTER_V8(isolate); | 5278 ENTER_V8(isolate); |
| 5275 v8::Handle<ObjectTemplate> proxy_template = global_template; | 5279 v8::Handle<ObjectTemplate> proxy_template = global_template; |
| 5276 i::Handle<i::FunctionTemplateInfo> proxy_constructor; | 5280 i::Handle<i::FunctionTemplateInfo> proxy_constructor; |
| 5277 i::Handle<i::FunctionTemplateInfo> global_constructor; | 5281 i::Handle<i::FunctionTemplateInfo> global_constructor; |
| 5278 | 5282 |
| 5279 if (!global_template.IsEmpty()) { | 5283 if (!global_template.IsEmpty()) { |
| 5280 // Make sure that the global_template has a constructor. | 5284 // Make sure that the global_template has a constructor. |
| 5281 global_constructor = EnsureConstructor(*global_template); | 5285 global_constructor = EnsureConstructor(isolate, *global_template); |
| 5282 | 5286 |
| 5283 // Create a fresh template for the global proxy object. | 5287 // Create a fresh template for the global proxy object. |
| 5284 proxy_template = ObjectTemplate::New(); | 5288 proxy_template = ObjectTemplate::New(); |
| 5285 proxy_constructor = EnsureConstructor(*proxy_template); | 5289 proxy_constructor = EnsureConstructor(isolate, *proxy_template); |
| 5286 | 5290 |
| 5287 // Set the global template to be the prototype template of | 5291 // Set the global template to be the prototype template of |
| 5288 // global proxy template. | 5292 // global proxy template. |
| 5289 proxy_constructor->set_prototype_template( | 5293 proxy_constructor->set_prototype_template( |
| 5290 *Utils::OpenHandle(*global_template)); | 5294 *Utils::OpenHandle(*global_template)); |
| 5291 | 5295 |
| 5292 // Migrate security handlers from global_template to | 5296 // Migrate security handlers from global_template to |
| 5293 // proxy_template. Temporarily removing access check | 5297 // proxy_template. Temporarily removing access check |
| 5294 // information from the global template. | 5298 // information from the global template. |
| 5295 if (!global_constructor->access_check_info()->IsUndefined()) { | 5299 if (!global_constructor->access_check_info()->IsUndefined()) { |
| (...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7779 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7783 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7780 Address callback_address = | 7784 Address callback_address = |
| 7781 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7785 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7782 VMState<EXTERNAL> state(isolate); | 7786 VMState<EXTERNAL> state(isolate); |
| 7783 ExternalCallbackScope call_scope(isolate, callback_address); | 7787 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7784 callback(info); | 7788 callback(info); |
| 7785 } | 7789 } |
| 7786 | 7790 |
| 7787 | 7791 |
| 7788 } } // namespace v8::internal | 7792 } } // namespace v8::internal |
| OLD | NEW |