| 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 i::Handle<i::FunctionTemplateInfo>::cast(struct_obj); | 1003 i::Handle<i::FunctionTemplateInfo>::cast(struct_obj); |
| 1004 InitializeFunctionTemplate(obj); | 1004 InitializeFunctionTemplate(obj); |
| 1005 obj->set_do_not_cache(do_not_cache); | 1005 obj->set_do_not_cache(do_not_cache); |
| 1006 int next_serial_number = 0; | 1006 int next_serial_number = 0; |
| 1007 if (!do_not_cache) { | 1007 if (!do_not_cache) { |
| 1008 next_serial_number = isolate->next_serial_number() + 1; | 1008 next_serial_number = isolate->next_serial_number() + 1; |
| 1009 isolate->set_next_serial_number(next_serial_number); | 1009 isolate->set_next_serial_number(next_serial_number); |
| 1010 } | 1010 } |
| 1011 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); | 1011 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); |
| 1012 if (callback != 0) { | 1012 if (callback != 0) { |
| 1013 if (data.IsEmpty()) data = v8::Undefined(); | 1013 if (data.IsEmpty()) { |
| 1014 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1015 } |
| 1014 Utils::ToLocal(obj)->SetCallHandler(callback, data); | 1016 Utils::ToLocal(obj)->SetCallHandler(callback, data); |
| 1015 } | 1017 } |
| 1016 obj->set_length(length); | 1018 obj->set_length(length); |
| 1017 obj->set_undetectable(false); | 1019 obj->set_undetectable(false); |
| 1018 obj->set_needs_access_check(false); | 1020 obj->set_needs_access_check(false); |
| 1019 if (!signature.IsEmpty()) | 1021 if (!signature.IsEmpty()) |
| 1020 obj->set_signature(*Utils::OpenHandle(*signature)); | 1022 obj->set_signature(*Utils::OpenHandle(*signature)); |
| 1021 return Utils::ToLocal(obj); | 1023 return Utils::ToLocal(obj); |
| 1022 } | 1024 } |
| 1023 | 1025 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 void FunctionTemplate::SetCallHandler(FunctionCallback callback, | 1229 void FunctionTemplate::SetCallHandler(FunctionCallback callback, |
| 1228 v8::Handle<Value> data) { | 1230 v8::Handle<Value> data) { |
| 1229 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1231 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1230 ENTER_V8(isolate); | 1232 ENTER_V8(isolate); |
| 1231 i::HandleScope scope(isolate); | 1233 i::HandleScope scope(isolate); |
| 1232 i::Handle<i::Struct> struct_obj = | 1234 i::Handle<i::Struct> struct_obj = |
| 1233 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); | 1235 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); |
| 1234 i::Handle<i::CallHandlerInfo> obj = | 1236 i::Handle<i::CallHandlerInfo> obj = |
| 1235 i::Handle<i::CallHandlerInfo>::cast(struct_obj); | 1237 i::Handle<i::CallHandlerInfo>::cast(struct_obj); |
| 1236 SET_FIELD_WRAPPED(obj, set_callback, callback); | 1238 SET_FIELD_WRAPPED(obj, set_callback, callback); |
| 1237 if (data.IsEmpty()) data = v8::Undefined(); | 1239 if (data.IsEmpty()) { |
| 1240 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1241 } |
| 1238 obj->set_data(*Utils::OpenHandle(*data)); | 1242 obj->set_data(*Utils::OpenHandle(*data)); |
| 1239 Utils::OpenHandle(this)->set_call_code(*obj); | 1243 Utils::OpenHandle(this)->set_call_code(*obj); |
| 1240 } | 1244 } |
| 1241 | 1245 |
| 1242 | 1246 |
| 1243 static i::Handle<i::AccessorInfo> SetAccessorInfoProperties( | 1247 static i::Handle<i::AccessorInfo> SetAccessorInfoProperties( |
| 1244 i::Handle<i::AccessorInfo> obj, | 1248 i::Handle<i::AccessorInfo> obj, |
| 1245 v8::Handle<String> name, | 1249 v8::Handle<String> name, |
| 1246 v8::AccessControl settings, | 1250 v8::AccessControl settings, |
| 1247 v8::PropertyAttribute attributes, | 1251 v8::PropertyAttribute attributes, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1265 Setter setter, | 1269 Setter setter, |
| 1266 v8::Handle<Value> data, | 1270 v8::Handle<Value> data, |
| 1267 v8::AccessControl settings, | 1271 v8::AccessControl settings, |
| 1268 v8::PropertyAttribute attributes, | 1272 v8::PropertyAttribute attributes, |
| 1269 v8::Handle<AccessorSignature> signature) { | 1273 v8::Handle<AccessorSignature> signature) { |
| 1270 i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate(); | 1274 i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate(); |
| 1271 i::Handle<i::ExecutableAccessorInfo> obj = | 1275 i::Handle<i::ExecutableAccessorInfo> obj = |
| 1272 isolate->factory()->NewExecutableAccessorInfo(); | 1276 isolate->factory()->NewExecutableAccessorInfo(); |
| 1273 SET_FIELD_WRAPPED(obj, set_getter, getter); | 1277 SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1274 SET_FIELD_WRAPPED(obj, set_setter, setter); | 1278 SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1275 if (data.IsEmpty()) data = v8::Undefined(); | 1279 if (data.IsEmpty()) { |
| 1280 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1281 } |
| 1276 obj->set_data(*Utils::OpenHandle(*data)); | 1282 obj->set_data(*Utils::OpenHandle(*data)); |
| 1277 return SetAccessorInfoProperties(obj, name, settings, attributes, signature); | 1283 return SetAccessorInfoProperties(obj, name, settings, attributes, signature); |
| 1278 } | 1284 } |
| 1279 | 1285 |
| 1280 | 1286 |
| 1281 static i::Handle<i::AccessorInfo> MakeAccessorInfo( | 1287 static i::Handle<i::AccessorInfo> MakeAccessorInfo( |
| 1282 v8::Handle<String> name, | 1288 v8::Handle<String> name, |
| 1283 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor, | 1289 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor, |
| 1284 void* setter_ignored, | 1290 void* setter_ignored, |
| 1285 void* data_ignored, | 1291 void* data_ignored, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1499 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
| 1494 i::Handle<i::InterceptorInfo> obj = | 1500 i::Handle<i::InterceptorInfo> obj = |
| 1495 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1501 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
| 1496 | 1502 |
| 1497 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1503 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1498 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1504 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1499 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1505 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
| 1500 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1506 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
| 1501 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1507 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
| 1502 | 1508 |
| 1503 if (data.IsEmpty()) data = v8::Undefined(); | 1509 if (data.IsEmpty()) { |
| 1510 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1511 } |
| 1504 obj->set_data(*Utils::OpenHandle(*data)); | 1512 obj->set_data(*Utils::OpenHandle(*data)); |
| 1505 cons->set_named_property_handler(*obj); | 1513 cons->set_named_property_handler(*obj); |
| 1506 } | 1514 } |
| 1507 | 1515 |
| 1508 | 1516 |
| 1509 void ObjectTemplate::MarkAsUndetectable() { | 1517 void ObjectTemplate::MarkAsUndetectable() { |
| 1510 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1518 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1511 ENTER_V8(isolate); | 1519 ENTER_V8(isolate); |
| 1512 i::HandleScope scope(isolate); | 1520 i::HandleScope scope(isolate); |
| 1513 EnsureConstructor(this); | 1521 EnsureConstructor(this); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1529 EnsureConstructor(this); | 1537 EnsureConstructor(this); |
| 1530 | 1538 |
| 1531 i::Handle<i::Struct> struct_info = | 1539 i::Handle<i::Struct> struct_info = |
| 1532 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); | 1540 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); |
| 1533 i::Handle<i::AccessCheckInfo> info = | 1541 i::Handle<i::AccessCheckInfo> info = |
| 1534 i::Handle<i::AccessCheckInfo>::cast(struct_info); | 1542 i::Handle<i::AccessCheckInfo>::cast(struct_info); |
| 1535 | 1543 |
| 1536 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); | 1544 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); |
| 1537 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); | 1545 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); |
| 1538 | 1546 |
| 1539 if (data.IsEmpty()) data = v8::Undefined(); | 1547 if (data.IsEmpty()) { |
| 1548 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1549 } |
| 1540 info->set_data(*Utils::OpenHandle(*data)); | 1550 info->set_data(*Utils::OpenHandle(*data)); |
| 1541 | 1551 |
| 1542 i::FunctionTemplateInfo* constructor = | 1552 i::FunctionTemplateInfo* constructor = |
| 1543 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); | 1553 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); |
| 1544 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1554 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1545 cons->set_access_check_info(*info); | 1555 cons->set_access_check_info(*info); |
| 1546 cons->set_needs_access_check(turned_on_by_default); | 1556 cons->set_needs_access_check(turned_on_by_default); |
| 1547 } | 1557 } |
| 1548 | 1558 |
| 1549 | 1559 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1565 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1575 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
| 1566 i::Handle<i::InterceptorInfo> obj = | 1576 i::Handle<i::InterceptorInfo> obj = |
| 1567 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1577 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
| 1568 | 1578 |
| 1569 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1579 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
| 1570 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1580 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
| 1571 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1581 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
| 1572 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1582 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
| 1573 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1583 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
| 1574 | 1584 |
| 1575 if (data.IsEmpty()) data = v8::Undefined(); | 1585 if (data.IsEmpty()) { |
| 1586 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1587 } |
| 1576 obj->set_data(*Utils::OpenHandle(*data)); | 1588 obj->set_data(*Utils::OpenHandle(*data)); |
| 1577 cons->set_indexed_property_handler(*obj); | 1589 cons->set_indexed_property_handler(*obj); |
| 1578 } | 1590 } |
| 1579 | 1591 |
| 1580 | 1592 |
| 1581 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, | 1593 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, |
| 1582 Handle<Value> data) { | 1594 Handle<Value> data) { |
| 1583 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1595 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1584 ENTER_V8(isolate); | 1596 ENTER_V8(isolate); |
| 1585 i::HandleScope scope(isolate); | 1597 i::HandleScope scope(isolate); |
| 1586 EnsureConstructor(this); | 1598 EnsureConstructor(this); |
| 1587 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1599 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( |
| 1588 Utils::OpenHandle(this)->constructor()); | 1600 Utils::OpenHandle(this)->constructor()); |
| 1589 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1601 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1590 i::Handle<i::Struct> struct_obj = | 1602 i::Handle<i::Struct> struct_obj = |
| 1591 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); | 1603 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); |
| 1592 i::Handle<i::CallHandlerInfo> obj = | 1604 i::Handle<i::CallHandlerInfo> obj = |
| 1593 i::Handle<i::CallHandlerInfo>::cast(struct_obj); | 1605 i::Handle<i::CallHandlerInfo>::cast(struct_obj); |
| 1594 SET_FIELD_WRAPPED(obj, set_callback, callback); | 1606 SET_FIELD_WRAPPED(obj, set_callback, callback); |
| 1595 if (data.IsEmpty()) data = v8::Undefined(); | 1607 if (data.IsEmpty()) { |
| 1608 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1609 } |
| 1596 obj->set_data(*Utils::OpenHandle(*data)); | 1610 obj->set_data(*Utils::OpenHandle(*data)); |
| 1597 cons->set_instance_call_handler(*obj); | 1611 cons->set_instance_call_handler(*obj); |
| 1598 } | 1612 } |
| 1599 | 1613 |
| 1600 | 1614 |
| 1601 int ObjectTemplate::InternalFieldCount() { | 1615 int ObjectTemplate::InternalFieldCount() { |
| 1602 return i::Smi::cast(Utils::OpenHandle(this)->internal_field_count())->value(); | 1616 return i::Smi::cast(Utils::OpenHandle(this)->internal_field_count())->value(); |
| 1603 } | 1617 } |
| 1604 | 1618 |
| 1605 | 1619 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 name_obj = Utils::OpenHandle(*origin->ResourceName()); | 1704 name_obj = Utils::OpenHandle(*origin->ResourceName()); |
| 1691 } | 1705 } |
| 1692 if (!origin->ResourceLineOffset().IsEmpty()) { | 1706 if (!origin->ResourceLineOffset().IsEmpty()) { |
| 1693 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); | 1707 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); |
| 1694 } | 1708 } |
| 1695 if (!origin->ResourceColumnOffset().IsEmpty()) { | 1709 if (!origin->ResourceColumnOffset().IsEmpty()) { |
| 1696 column_offset = | 1710 column_offset = |
| 1697 static_cast<int>(origin->ResourceColumnOffset()->Value()); | 1711 static_cast<int>(origin->ResourceColumnOffset()->Value()); |
| 1698 } | 1712 } |
| 1699 if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) { | 1713 if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) { |
| 1714 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 1700 is_shared_cross_origin = | 1715 is_shared_cross_origin = |
| 1701 origin->ResourceIsSharedCrossOrigin() == v8::True(); | 1716 origin->ResourceIsSharedCrossOrigin() == v8::True(v8_isolate); |
| 1702 } | 1717 } |
| 1703 } | 1718 } |
| 1704 EXCEPTION_PREAMBLE(isolate); | 1719 EXCEPTION_PREAMBLE(isolate); |
| 1705 i::ScriptDataImpl* pre_data_impl = | 1720 i::ScriptDataImpl* pre_data_impl = |
| 1706 static_cast<i::ScriptDataImpl*>(pre_data); | 1721 static_cast<i::ScriptDataImpl*>(pre_data); |
| 1707 // We assert that the pre-data is sane, even though we can actually | 1722 // We assert that the pre-data is sane, even though we can actually |
| 1708 // handle it if it turns out not to be in release mode. | 1723 // handle it if it turns out not to be in release mode. |
| 1709 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | 1724 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
| 1710 // If the pre-data isn't sane we simply ignore it | 1725 // If the pre-data isn't sane we simply ignore it |
| 1711 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | 1726 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 | 1951 |
| 1937 | 1952 |
| 1938 bool v8::TryCatch::HasTerminated() const { | 1953 bool v8::TryCatch::HasTerminated() const { |
| 1939 return has_terminated_; | 1954 return has_terminated_; |
| 1940 } | 1955 } |
| 1941 | 1956 |
| 1942 | 1957 |
| 1943 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { | 1958 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { |
| 1944 if (!HasCaught()) return v8::Local<v8::Value>(); | 1959 if (!HasCaught()) return v8::Local<v8::Value>(); |
| 1945 rethrow_ = true; | 1960 rethrow_ = true; |
| 1946 return v8::Undefined(); | 1961 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 1947 } | 1962 } |
| 1948 | 1963 |
| 1949 | 1964 |
| 1950 v8::Local<Value> v8::TryCatch::Exception() const { | 1965 v8::Local<Value> v8::TryCatch::Exception() const { |
| 1951 ASSERT(isolate_ == i::Isolate::Current()); | 1966 ASSERT(isolate_ == i::Isolate::Current()); |
| 1952 if (HasCaught()) { | 1967 if (HasCaught()) { |
| 1953 // Check for out of memory exception. | 1968 // Check for out of memory exception. |
| 1954 i::Object* exception = reinterpret_cast<i::Object*>(exception_); | 1969 i::Object* exception = reinterpret_cast<i::Object*>(exception_); |
| 1955 return v8::Utils::ToLocal(i::Handle<i::Object>(exception, isolate_)); | 1970 return v8::Utils::ToLocal(i::Handle<i::Object>(exception, isolate_)); |
| 1956 } else { | 1971 } else { |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4106 if (func->shared()->script()->IsScript()) { | 4121 if (func->shared()->script()->IsScript()) { |
| 4107 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4122 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4108 return i::GetScriptColumnNumber(script, func->shared()->start_position()); | 4123 return i::GetScriptColumnNumber(script, func->shared()->start_position()); |
| 4109 } | 4124 } |
| 4110 return kLineOffsetNotFound; | 4125 return kLineOffsetNotFound; |
| 4111 } | 4126 } |
| 4112 | 4127 |
| 4113 | 4128 |
| 4114 Handle<Value> Function::GetScriptId() const { | 4129 Handle<Value> Function::GetScriptId() const { |
| 4115 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4130 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4116 if (!func->shared()->script()->IsScript()) | 4131 i::Isolate* isolate = func->GetIsolate(); |
| 4117 return v8::Undefined(); | 4132 if (!func->shared()->script()->IsScript()) { |
| 4133 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 4134 } |
| 4118 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4135 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4119 return Utils::ToLocal(i::Handle<i::Object>(script->id(), func->GetIsolate())); | 4136 return Utils::ToLocal(i::Handle<i::Object>(script->id(), isolate)); |
| 4120 } | 4137 } |
| 4121 | 4138 |
| 4122 | 4139 |
| 4123 int Function::ScriptId() const { | 4140 int Function::ScriptId() const { |
| 4124 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4141 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4125 if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId; | 4142 if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId; |
| 4126 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4143 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4127 return script->id()->value(); | 4144 return script->id()->value(); |
| 4128 } | 4145 } |
| 4129 | 4146 |
| (...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6355 v8::Local<Value> Isolate::ThrowException(v8::Local<v8::Value> value) { | 6372 v8::Local<Value> Isolate::ThrowException(v8::Local<v8::Value> value) { |
| 6356 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6373 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6357 ENTER_V8(isolate); | 6374 ENTER_V8(isolate); |
| 6358 // If we're passed an empty handle, we throw an undefined exception | 6375 // If we're passed an empty handle, we throw an undefined exception |
| 6359 // to deal more gracefully with out of memory situations. | 6376 // to deal more gracefully with out of memory situations. |
| 6360 if (value.IsEmpty()) { | 6377 if (value.IsEmpty()) { |
| 6361 isolate->ScheduleThrow(isolate->heap()->undefined_value()); | 6378 isolate->ScheduleThrow(isolate->heap()->undefined_value()); |
| 6362 } else { | 6379 } else { |
| 6363 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); | 6380 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); |
| 6364 } | 6381 } |
| 6365 return v8::Undefined(); | 6382 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 6366 } | 6383 } |
| 6367 | 6384 |
| 6368 | 6385 |
| 6369 void Isolate::SetObjectGroupId(const Persistent<Value>& object, | 6386 void Isolate::SetObjectGroupId(const Persistent<Value>& object, |
| 6370 UniqueId id) { | 6387 UniqueId id) { |
| 6371 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6388 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6372 internal_isolate->global_handles()->SetObjectGroupId( | 6389 internal_isolate->global_handles()->SetObjectGroupId( |
| 6373 Utils::OpenPersistent(object).location(), | 6390 Utils::OpenPersistent(object).location(), |
| 6374 id); | 6391 id); |
| 6375 } | 6392 } |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7106 case i::HeapGraphEdge::kShortcut: | 7123 case i::HeapGraphEdge::kShortcut: |
| 7107 return ToApiHandle<String>( | 7124 return ToApiHandle<String>( |
| 7108 isolate->factory()->InternalizeUtf8String(edge->name())); | 7125 isolate->factory()->InternalizeUtf8String(edge->name())); |
| 7109 case i::HeapGraphEdge::kElement: | 7126 case i::HeapGraphEdge::kElement: |
| 7110 case i::HeapGraphEdge::kHidden: | 7127 case i::HeapGraphEdge::kHidden: |
| 7111 case i::HeapGraphEdge::kWeak: | 7128 case i::HeapGraphEdge::kWeak: |
| 7112 return ToApiHandle<Number>( | 7129 return ToApiHandle<Number>( |
| 7113 isolate->factory()->NewNumberFromInt(edge->index())); | 7130 isolate->factory()->NewNumberFromInt(edge->index())); |
| 7114 default: UNREACHABLE(); | 7131 default: UNREACHABLE(); |
| 7115 } | 7132 } |
| 7116 return v8::Undefined(); | 7133 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 7117 } | 7134 } |
| 7118 | 7135 |
| 7119 | 7136 |
| 7120 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { | 7137 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { |
| 7121 const i::HeapEntry* from = ToInternal(this)->from(); | 7138 const i::HeapEntry* from = ToInternal(this)->from(); |
| 7122 return reinterpret_cast<const HeapGraphNode*>(from); | 7139 return reinterpret_cast<const HeapGraphNode*>(from); |
| 7123 } | 7140 } |
| 7124 | 7141 |
| 7125 | 7142 |
| 7126 const HeapGraphNode* HeapGraphEdge::GetToNode() const { | 7143 const HeapGraphNode* HeapGraphEdge::GetToNode() const { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7549 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7550 Address callback_address = | 7567 Address callback_address = |
| 7551 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7552 VMState<EXTERNAL> state(isolate); | 7569 VMState<EXTERNAL> state(isolate); |
| 7553 ExternalCallbackScope call_scope(isolate, callback_address); | 7570 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7554 callback(info); | 7571 callback(info); |
| 7555 } | 7572 } |
| 7556 | 7573 |
| 7557 | 7574 |
| 7558 } } // namespace v8::internal | 7575 } } // namespace v8::internal |
| OLD | NEW |