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