| 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 auto_enable_(false) { | 541 auto_enable_(false) { |
| 542 CHECK(source != NULL || source_length_ == 0); | 542 CHECK(source != NULL || source_length_ == 0); |
| 543 } | 543 } |
| 544 | 544 |
| 545 | 545 |
| 546 v8::Handle<Primitive> Undefined() { | 546 v8::Handle<Primitive> Undefined() { |
| 547 i::Isolate* isolate = i::Isolate::Current(); | 547 i::Isolate* isolate = i::Isolate::Current(); |
| 548 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) { | 548 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) { |
| 549 return v8::Handle<v8::Primitive>(); | 549 return v8::Handle<v8::Primitive>(); |
| 550 } | 550 } |
| 551 return v8::Handle<Primitive>(ToApi<Primitive>( | 551 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); |
| 552 isolate->factory()->undefined_value())); | |
| 553 } | 552 } |
| 554 | 553 |
| 555 | 554 |
| 556 v8::Handle<Primitive> Null() { | 555 v8::Handle<Primitive> Null() { |
| 557 i::Isolate* isolate = i::Isolate::Current(); | 556 i::Isolate* isolate = i::Isolate::Current(); |
| 558 if (!EnsureInitializedForIsolate(isolate, "v8::Null()")) { | 557 if (!EnsureInitializedForIsolate(isolate, "v8::Null()")) { |
| 559 return v8::Handle<v8::Primitive>(); | 558 return v8::Handle<v8::Primitive>(); |
| 560 } | 559 } |
| 561 return v8::Handle<Primitive>( | 560 return ToApiHandle<Primitive>(isolate->factory()->null_value()); |
| 562 ToApi<Primitive>(isolate->factory()->null_value())); | |
| 563 } | 561 } |
| 564 | 562 |
| 565 | 563 |
| 566 v8::Handle<Boolean> True() { | 564 v8::Handle<Boolean> True() { |
| 567 i::Isolate* isolate = i::Isolate::Current(); | 565 i::Isolate* isolate = i::Isolate::Current(); |
| 568 if (!EnsureInitializedForIsolate(isolate, "v8::True()")) { | 566 if (!EnsureInitializedForIsolate(isolate, "v8::True()")) { |
| 569 return v8::Handle<Boolean>(); | 567 return v8::Handle<Boolean>(); |
| 570 } | 568 } |
| 571 return v8::Handle<Boolean>( | 569 return ToApiHandle<Boolean>(isolate->factory()->true_value()); |
| 572 ToApi<Boolean>(isolate->factory()->true_value())); | |
| 573 } | 570 } |
| 574 | 571 |
| 575 | 572 |
| 576 v8::Handle<Boolean> False() { | 573 v8::Handle<Boolean> False() { |
| 577 i::Isolate* isolate = i::Isolate::Current(); | 574 i::Isolate* isolate = i::Isolate::Current(); |
| 578 if (!EnsureInitializedForIsolate(isolate, "v8::False()")) { | 575 if (!EnsureInitializedForIsolate(isolate, "v8::False()")) { |
| 579 return v8::Handle<Boolean>(); | 576 return v8::Handle<Boolean>(); |
| 580 } | 577 } |
| 581 return v8::Handle<Boolean>( | 578 return ToApiHandle<Boolean>(isolate->factory()->false_value()); |
| 582 ToApi<Boolean>(isolate->factory()->false_value())); | |
| 583 } | 579 } |
| 584 | 580 |
| 585 | 581 |
| 586 ResourceConstraints::ResourceConstraints() | 582 ResourceConstraints::ResourceConstraints() |
| 587 : max_young_space_size_(0), | 583 : max_young_space_size_(0), |
| 588 max_old_space_size_(0), | 584 max_old_space_size_(0), |
| 589 max_executable_size_(0), | 585 max_executable_size_(0), |
| 590 stack_limit_(NULL) { } | 586 stack_limit_(NULL) { } |
| 591 | 587 |
| 592 | 588 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) { | 938 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) { |
| 943 return Local<ObjectTemplate>(); | 939 return Local<ObjectTemplate>(); |
| 944 } | 940 } |
| 945 ENTER_V8(isolate); | 941 ENTER_V8(isolate); |
| 946 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), | 942 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), |
| 947 isolate); | 943 isolate); |
| 948 if (result->IsUndefined()) { | 944 if (result->IsUndefined()) { |
| 949 result = Utils::OpenHandle(*ObjectTemplate::New()); | 945 result = Utils::OpenHandle(*ObjectTemplate::New()); |
| 950 Utils::OpenHandle(this)->set_prototype_template(*result); | 946 Utils::OpenHandle(this)->set_prototype_template(*result); |
| 951 } | 947 } |
| 952 return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result)); | 948 return ToApiHandle<ObjectTemplate>(result); |
| 953 } | 949 } |
| 954 | 950 |
| 955 | 951 |
| 956 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { | 952 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { |
| 957 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 953 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 958 if (IsDeadCheck(isolate, "v8::FunctionTemplate::Inherit()")) return; | 954 if (IsDeadCheck(isolate, "v8::FunctionTemplate::Inherit()")) return; |
| 959 ENTER_V8(isolate); | 955 ENTER_V8(isolate); |
| 960 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value)); | 956 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value)); |
| 961 } | 957 } |
| 962 | 958 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 Local<AccessorSignature> AccessorSignature::New( | 1033 Local<AccessorSignature> AccessorSignature::New( |
| 1038 Handle<FunctionTemplate> receiver) { | 1034 Handle<FunctionTemplate> receiver) { |
| 1039 return Utils::AccessorSignatureToLocal(Utils::OpenHandle(*receiver)); | 1035 return Utils::AccessorSignatureToLocal(Utils::OpenHandle(*receiver)); |
| 1040 } | 1036 } |
| 1041 | 1037 |
| 1042 | 1038 |
| 1043 template<typename Operation> | 1039 template<typename Operation> |
| 1044 static Local<Operation> NewDescriptor( | 1040 static Local<Operation> NewDescriptor( |
| 1045 Isolate* isolate, | 1041 Isolate* isolate, |
| 1046 const i::DeclaredAccessorDescriptorData& data, | 1042 const i::DeclaredAccessorDescriptorData& data, |
| 1047 Data* previous_descriptor | 1043 Data* previous_descriptor) { |
| 1048 ) { | |
| 1049 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 1044 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 1050 i::Handle<i::DeclaredAccessorDescriptor> previous = | 1045 i::Handle<i::DeclaredAccessorDescriptor> previous = |
| 1051 i::Handle<i::DeclaredAccessorDescriptor>(); | 1046 i::Handle<i::DeclaredAccessorDescriptor>(); |
| 1052 if (previous_descriptor != NULL) { | 1047 if (previous_descriptor != NULL) { |
| 1053 previous = Utils::OpenHandle( | 1048 previous = Utils::OpenHandle( |
| 1054 static_cast<DeclaredAccessorDescriptor*>(previous_descriptor)); | 1049 static_cast<DeclaredAccessorDescriptor*>(previous_descriptor)); |
| 1055 } | 1050 } |
| 1056 i::Handle<i::DeclaredAccessorDescriptor> descriptor = | 1051 i::Handle<i::DeclaredAccessorDescriptor> descriptor = |
| 1057 i::DeclaredAccessorDescriptor::Create(internal_isolate, data, previous); | 1052 i::DeclaredAccessorDescriptor::Create(internal_isolate, data, previous); |
| 1058 return Local<Operation>( | 1053 return Utils::Convert<i::DeclaredAccessorDescriptor, Operation>(descriptor); |
| 1059 reinterpret_cast<Operation*>(*Utils::ToLocal(descriptor))); | |
| 1060 } | 1054 } |
| 1061 | 1055 |
| 1062 | 1056 |
| 1063 Local<RawOperationDescriptor> | 1057 Local<RawOperationDescriptor> |
| 1064 ObjectOperationDescriptor::NewInternalFieldDereference( | 1058 ObjectOperationDescriptor::NewInternalFieldDereference( |
| 1065 Isolate* isolate, | 1059 Isolate* isolate, |
| 1066 int internal_field) { | 1060 int internal_field) { |
| 1067 i::DeclaredAccessorDescriptorData data; | 1061 i::DeclaredAccessorDescriptorData data; |
| 1068 data.type = i::kDescriptorObjectDereference; | 1062 data.type = i::kDescriptorObjectDereference; |
| 1069 data.object_dereference_descriptor.internal_field = internal_field; | 1063 data.object_dereference_descriptor.internal_field = internal_field; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 return SetAccessorInfoProperties(obj, name, settings, attributes, signature); | 1284 return SetAccessorInfoProperties(obj, name, settings, attributes, signature); |
| 1291 } | 1285 } |
| 1292 | 1286 |
| 1293 | 1287 |
| 1294 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() { | 1288 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() { |
| 1295 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1289 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1296 if (IsDeadCheck(isolate, "v8::FunctionTemplate::InstanceTemplate()") | 1290 if (IsDeadCheck(isolate, "v8::FunctionTemplate::InstanceTemplate()") |
| 1297 || EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this)) | 1291 || EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this)) |
| 1298 return Local<ObjectTemplate>(); | 1292 return Local<ObjectTemplate>(); |
| 1299 ENTER_V8(isolate); | 1293 ENTER_V8(isolate); |
| 1300 if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) { | 1294 i::Handle<i::FunctionTemplateInfo> handle = Utils::OpenHandle(this); |
| 1295 if (handle->instance_template()->IsUndefined()) { |
| 1301 Local<ObjectTemplate> templ = | 1296 Local<ObjectTemplate> templ = |
| 1302 ObjectTemplate::New(v8::Handle<FunctionTemplate>(this)); | 1297 ObjectTemplate::New(ToApiHandle<FunctionTemplate>(handle)); |
| 1303 Utils::OpenHandle(this)->set_instance_template(*Utils::OpenHandle(*templ)); | 1298 handle->set_instance_template(*Utils::OpenHandle(*templ)); |
| 1304 } | 1299 } |
| 1305 i::Handle<i::ObjectTemplateInfo> result(i::ObjectTemplateInfo::cast( | 1300 i::Handle<i::ObjectTemplateInfo> result( |
| 1306 Utils::OpenHandle(this)->instance_template())); | 1301 i::ObjectTemplateInfo::cast(handle->instance_template())); |
| 1307 return Utils::ToLocal(result); | 1302 return Utils::ToLocal(result); |
| 1308 } | 1303 } |
| 1309 | 1304 |
| 1310 | 1305 |
| 1311 void FunctionTemplate::SetLength(int length) { | 1306 void FunctionTemplate::SetLength(int length) { |
| 1312 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1307 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1313 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetLength()")) return; | 1308 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetLength()")) return; |
| 1314 ENTER_V8(isolate); | 1309 ENTER_V8(isolate); |
| 1315 Utils::OpenHandle(this)->set_length(length); | 1310 Utils::OpenHandle(this)->set_length(length); |
| 1316 } | 1311 } |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 isolate->global_context(), | 1889 isolate->global_context(), |
| 1895 NULL, | 1890 NULL, |
| 1896 pre_data_impl, | 1891 pre_data_impl, |
| 1897 Utils::OpenHandle(*script_data, true), | 1892 Utils::OpenHandle(*script_data, true), |
| 1898 i::NOT_NATIVES_CODE); | 1893 i::NOT_NATIVES_CODE); |
| 1899 has_pending_exception = result.is_null(); | 1894 has_pending_exception = result.is_null(); |
| 1900 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1895 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1901 raw_result = *result; | 1896 raw_result = *result; |
| 1902 } | 1897 } |
| 1903 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); | 1898 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| 1904 return Local<Script>(ToApi<Script>(result)); | 1899 return ToApiHandle<Script>(result); |
| 1905 } | 1900 } |
| 1906 | 1901 |
| 1907 | 1902 |
| 1908 Local<Script> Script::New(v8::Handle<String> source, | 1903 Local<Script> Script::New(v8::Handle<String> source, |
| 1909 v8::Handle<Value> file_name) { | 1904 v8::Handle<Value> file_name) { |
| 1910 ScriptOrigin origin(file_name); | 1905 ScriptOrigin origin(file_name); |
| 1911 return New(source, &origin); | 1906 return New(source, &origin); |
| 1912 } | 1907 } |
| 1913 | 1908 |
| 1914 | 1909 |
| 1915 Local<Script> Script::Compile(v8::Handle<String> source, | 1910 Local<Script> Script::Compile(v8::Handle<String> source, |
| 1916 v8::ScriptOrigin* origin, | 1911 v8::ScriptOrigin* origin, |
| 1917 v8::ScriptData* pre_data, | 1912 v8::ScriptData* pre_data, |
| 1918 v8::Handle<String> script_data) { | 1913 v8::Handle<String> script_data) { |
| 1919 i::Isolate* isolate = i::Isolate::Current(); | 1914 i::Isolate* isolate = i::Isolate::Current(); |
| 1920 ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>()); | 1915 ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>()); |
| 1921 LOG_API(isolate, "Script::Compile"); | 1916 LOG_API(isolate, "Script::Compile"); |
| 1922 ENTER_V8(isolate); | 1917 ENTER_V8(isolate); |
| 1923 Local<Script> generic = New(source, origin, pre_data, script_data); | 1918 Local<Script> generic = New(source, origin, pre_data, script_data); |
| 1924 if (generic.IsEmpty()) | 1919 if (generic.IsEmpty()) |
| 1925 return generic; | 1920 return generic; |
| 1926 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); | 1921 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); |
| 1927 i::Handle<i::SharedFunctionInfo> function = | 1922 i::Handle<i::SharedFunctionInfo> function = |
| 1928 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); | 1923 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); |
| 1929 i::Handle<i::JSFunction> result = | 1924 i::Handle<i::JSFunction> result = |
| 1930 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1925 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1931 function, | 1926 function, |
| 1932 isolate->global_context()); | 1927 isolate->global_context()); |
| 1933 return Local<Script>(ToApi<Script>(result)); | 1928 return ToApiHandle<Script>(result); |
| 1934 } | 1929 } |
| 1935 | 1930 |
| 1936 | 1931 |
| 1937 Local<Script> Script::Compile(v8::Handle<String> source, | 1932 Local<Script> Script::Compile(v8::Handle<String> source, |
| 1938 v8::Handle<Value> file_name, | 1933 v8::Handle<Value> file_name, |
| 1939 v8::Handle<String> script_data) { | 1934 v8::Handle<String> script_data) { |
| 1940 ScriptOrigin origin(file_name); | 1935 ScriptOrigin origin(file_name); |
| 1941 return Compile(source, &origin, 0, script_data); | 1936 return Compile(source, &origin, 0, script_data); |
| 1942 } | 1937 } |
| 1943 | 1938 |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2766 i::Isolate* isolate = i::Isolate::Current(); | 2761 i::Isolate* isolate = i::Isolate::Current(); |
| 2767 if (IsDeadCheck(isolate, "v8::Value::ToString()")) { | 2762 if (IsDeadCheck(isolate, "v8::Value::ToString()")) { |
| 2768 return Local<String>(); | 2763 return Local<String>(); |
| 2769 } | 2764 } |
| 2770 LOG_API(isolate, "ToString"); | 2765 LOG_API(isolate, "ToString"); |
| 2771 ENTER_V8(isolate); | 2766 ENTER_V8(isolate); |
| 2772 EXCEPTION_PREAMBLE(isolate); | 2767 EXCEPTION_PREAMBLE(isolate); |
| 2773 str = i::Execution::ToString(obj, &has_pending_exception); | 2768 str = i::Execution::ToString(obj, &has_pending_exception); |
| 2774 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); | 2769 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |
| 2775 } | 2770 } |
| 2776 return Local<String>(ToApi<String>(str)); | 2771 return ToApiHandle<String>(str); |
| 2777 } | 2772 } |
| 2778 | 2773 |
| 2779 | 2774 |
| 2780 Local<String> Value::ToDetailString() const { | 2775 Local<String> Value::ToDetailString() const { |
| 2781 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2776 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2782 i::Handle<i::Object> str; | 2777 i::Handle<i::Object> str; |
| 2783 if (obj->IsString()) { | 2778 if (obj->IsString()) { |
| 2784 str = obj; | 2779 str = obj; |
| 2785 } else { | 2780 } else { |
| 2786 i::Isolate* isolate = i::Isolate::Current(); | 2781 i::Isolate* isolate = i::Isolate::Current(); |
| 2787 if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) { | 2782 if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) { |
| 2788 return Local<String>(); | 2783 return Local<String>(); |
| 2789 } | 2784 } |
| 2790 LOG_API(isolate, "ToDetailString"); | 2785 LOG_API(isolate, "ToDetailString"); |
| 2791 ENTER_V8(isolate); | 2786 ENTER_V8(isolate); |
| 2792 EXCEPTION_PREAMBLE(isolate); | 2787 EXCEPTION_PREAMBLE(isolate); |
| 2793 str = i::Execution::ToDetailString(obj, &has_pending_exception); | 2788 str = i::Execution::ToDetailString(obj, &has_pending_exception); |
| 2794 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); | 2789 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |
| 2795 } | 2790 } |
| 2796 return Local<String>(ToApi<String>(str)); | 2791 return ToApiHandle<String>(str); |
| 2797 } | 2792 } |
| 2798 | 2793 |
| 2799 | 2794 |
| 2800 Local<v8::Object> Value::ToObject() const { | 2795 Local<v8::Object> Value::ToObject() const { |
| 2801 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2796 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2802 i::Handle<i::Object> val; | 2797 i::Handle<i::Object> val; |
| 2803 if (obj->IsJSObject()) { | 2798 if (obj->IsJSObject()) { |
| 2804 val = obj; | 2799 val = obj; |
| 2805 } else { | 2800 } else { |
| 2806 i::Isolate* isolate = i::Isolate::Current(); | 2801 i::Isolate* isolate = i::Isolate::Current(); |
| 2807 if (IsDeadCheck(isolate, "v8::Value::ToObject()")) { | 2802 if (IsDeadCheck(isolate, "v8::Value::ToObject()")) { |
| 2808 return Local<v8::Object>(); | 2803 return Local<v8::Object>(); |
| 2809 } | 2804 } |
| 2810 LOG_API(isolate, "ToObject"); | 2805 LOG_API(isolate, "ToObject"); |
| 2811 ENTER_V8(isolate); | 2806 ENTER_V8(isolate); |
| 2812 EXCEPTION_PREAMBLE(isolate); | 2807 EXCEPTION_PREAMBLE(isolate); |
| 2813 val = i::Execution::ToObject(obj, &has_pending_exception); | 2808 val = i::Execution::ToObject(obj, &has_pending_exception); |
| 2814 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 2809 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |
| 2815 } | 2810 } |
| 2816 return Local<v8::Object>(ToApi<Object>(val)); | 2811 return ToApiHandle<Object>(val); |
| 2817 } | 2812 } |
| 2818 | 2813 |
| 2819 | 2814 |
| 2820 Local<Boolean> Value::ToBoolean() const { | 2815 Local<Boolean> Value::ToBoolean() const { |
| 2821 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2816 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2822 if (obj->IsBoolean()) { | 2817 if (obj->IsBoolean()) { |
| 2823 return Local<Boolean>(ToApi<Boolean>(obj)); | 2818 return ToApiHandle<Boolean>(obj); |
| 2824 } else { | 2819 } else { |
| 2825 i::Isolate* isolate = i::Isolate::Current(); | 2820 i::Isolate* isolate = i::Isolate::Current(); |
| 2826 if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) { | 2821 if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) { |
| 2827 return Local<Boolean>(); | 2822 return Local<Boolean>(); |
| 2828 } | 2823 } |
| 2829 LOG_API(isolate, "ToBoolean"); | 2824 LOG_API(isolate, "ToBoolean"); |
| 2830 ENTER_V8(isolate); | 2825 ENTER_V8(isolate); |
| 2831 i::Handle<i::Object> val = | 2826 i::Handle<i::Object> val = |
| 2832 isolate->factory()->ToBoolean(obj->BooleanValue()); | 2827 isolate->factory()->ToBoolean(obj->BooleanValue()); |
| 2833 return Local<Boolean>(ToApi<Boolean>(val)); | 2828 return ToApiHandle<Boolean>(val); |
| 2834 } | 2829 } |
| 2835 } | 2830 } |
| 2836 | 2831 |
| 2837 | 2832 |
| 2838 Local<Number> Value::ToNumber() const { | 2833 Local<Number> Value::ToNumber() const { |
| 2839 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2834 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2840 i::Handle<i::Object> num; | 2835 i::Handle<i::Object> num; |
| 2841 if (obj->IsNumber()) { | 2836 if (obj->IsNumber()) { |
| 2842 num = obj; | 2837 num = obj; |
| 2843 } else { | 2838 } else { |
| 2844 i::Isolate* isolate = i::Isolate::Current(); | 2839 i::Isolate* isolate = i::Isolate::Current(); |
| 2845 if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) { | 2840 if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) { |
| 2846 return Local<Number>(); | 2841 return Local<Number>(); |
| 2847 } | 2842 } |
| 2848 LOG_API(isolate, "ToNumber"); | 2843 LOG_API(isolate, "ToNumber"); |
| 2849 ENTER_V8(isolate); | 2844 ENTER_V8(isolate); |
| 2850 EXCEPTION_PREAMBLE(isolate); | 2845 EXCEPTION_PREAMBLE(isolate); |
| 2851 num = i::Execution::ToNumber(obj, &has_pending_exception); | 2846 num = i::Execution::ToNumber(obj, &has_pending_exception); |
| 2852 EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>()); | 2847 EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>()); |
| 2853 } | 2848 } |
| 2854 return Local<Number>(ToApi<Number>(num)); | 2849 return ToApiHandle<Number>(num); |
| 2855 } | 2850 } |
| 2856 | 2851 |
| 2857 | 2852 |
| 2858 Local<Integer> Value::ToInteger() const { | 2853 Local<Integer> Value::ToInteger() const { |
| 2859 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2854 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2860 i::Handle<i::Object> num; | 2855 i::Handle<i::Object> num; |
| 2861 if (obj->IsSmi()) { | 2856 if (obj->IsSmi()) { |
| 2862 num = obj; | 2857 num = obj; |
| 2863 } else { | 2858 } else { |
| 2864 i::Isolate* isolate = i::Isolate::Current(); | 2859 i::Isolate* isolate = i::Isolate::Current(); |
| 2865 if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>(); | 2860 if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>(); |
| 2866 LOG_API(isolate, "ToInteger"); | 2861 LOG_API(isolate, "ToInteger"); |
| 2867 ENTER_V8(isolate); | 2862 ENTER_V8(isolate); |
| 2868 EXCEPTION_PREAMBLE(isolate); | 2863 EXCEPTION_PREAMBLE(isolate); |
| 2869 num = i::Execution::ToInteger(obj, &has_pending_exception); | 2864 num = i::Execution::ToInteger(obj, &has_pending_exception); |
| 2870 EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); | 2865 EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); |
| 2871 } | 2866 } |
| 2872 return Local<Integer>(ToApi<Integer>(num)); | 2867 return ToApiHandle<Integer>(num); |
| 2873 } | 2868 } |
| 2874 | 2869 |
| 2875 | 2870 |
| 2876 void External::CheckCast(v8::Value* that) { | 2871 void External::CheckCast(v8::Value* that) { |
| 2877 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Cast()")) return; | 2872 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Cast()")) return; |
| 2878 ApiCheck(Utils::OpenHandle(that)->IsExternal(), | 2873 ApiCheck(Utils::OpenHandle(that)->IsExternal(), |
| 2879 "v8::External::Cast()", | 2874 "v8::External::Cast()", |
| 2880 "Could not convert to external"); | 2875 "Could not convert to external"); |
| 2881 } | 2876 } |
| 2882 | 2877 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 num = obj; | 3087 num = obj; |
| 3093 } else { | 3088 } else { |
| 3094 i::Isolate* isolate = i::Isolate::Current(); | 3089 i::Isolate* isolate = i::Isolate::Current(); |
| 3095 if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>(); | 3090 if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>(); |
| 3096 LOG_API(isolate, "ToInt32"); | 3091 LOG_API(isolate, "ToInt32"); |
| 3097 ENTER_V8(isolate); | 3092 ENTER_V8(isolate); |
| 3098 EXCEPTION_PREAMBLE(isolate); | 3093 EXCEPTION_PREAMBLE(isolate); |
| 3099 num = i::Execution::ToInt32(obj, &has_pending_exception); | 3094 num = i::Execution::ToInt32(obj, &has_pending_exception); |
| 3100 EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>()); | 3095 EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>()); |
| 3101 } | 3096 } |
| 3102 return Local<Int32>(ToApi<Int32>(num)); | 3097 return ToApiHandle<Int32>(num); |
| 3103 } | 3098 } |
| 3104 | 3099 |
| 3105 | 3100 |
| 3106 Local<Uint32> Value::ToUint32() const { | 3101 Local<Uint32> Value::ToUint32() const { |
| 3107 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3102 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3108 i::Handle<i::Object> num; | 3103 i::Handle<i::Object> num; |
| 3109 if (obj->IsSmi()) { | 3104 if (obj->IsSmi()) { |
| 3110 num = obj; | 3105 num = obj; |
| 3111 } else { | 3106 } else { |
| 3112 i::Isolate* isolate = i::Isolate::Current(); | 3107 i::Isolate* isolate = i::Isolate::Current(); |
| 3113 if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>(); | 3108 if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>(); |
| 3114 LOG_API(isolate, "ToUInt32"); | 3109 LOG_API(isolate, "ToUInt32"); |
| 3115 ENTER_V8(isolate); | 3110 ENTER_V8(isolate); |
| 3116 EXCEPTION_PREAMBLE(isolate); | 3111 EXCEPTION_PREAMBLE(isolate); |
| 3117 num = i::Execution::ToUint32(obj, &has_pending_exception); | 3112 num = i::Execution::ToUint32(obj, &has_pending_exception); |
| 3118 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); | 3113 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); |
| 3119 } | 3114 } |
| 3120 return Local<Uint32>(ToApi<Uint32>(num)); | 3115 return ToApiHandle<Uint32>(num); |
| 3121 } | 3116 } |
| 3122 | 3117 |
| 3123 | 3118 |
| 3124 Local<Uint32> Value::ToArrayIndex() const { | 3119 Local<Uint32> Value::ToArrayIndex() const { |
| 3125 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3120 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3126 if (obj->IsSmi()) { | 3121 if (obj->IsSmi()) { |
| 3127 if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); | 3122 if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); |
| 3128 return Local<Uint32>(); | 3123 return Local<Uint32>(); |
| 3129 } | 3124 } |
| 3130 i::Isolate* isolate = i::Isolate::Current(); | 3125 i::Isolate* isolate = i::Isolate::Current(); |
| (...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5352 global_constructor->set_needs_access_check( | 5347 global_constructor->set_needs_access_check( |
| 5353 proxy_constructor->needs_access_check()); | 5348 proxy_constructor->needs_access_check()); |
| 5354 } | 5349 } |
| 5355 isolate->runtime_profiler()->Reset(); | 5350 isolate->runtime_profiler()->Reset(); |
| 5356 } | 5351 } |
| 5357 // Leave V8. | 5352 // Leave V8. |
| 5358 | 5353 |
| 5359 return env; | 5354 return env; |
| 5360 } | 5355 } |
| 5361 | 5356 |
| 5362 | 5357 #ifdef V8_USE_UNSAFE_HANDLES |
| 5363 Persistent<Context> v8::Context::New( | 5358 Persistent<Context> v8::Context::New( |
| 5364 v8::ExtensionConfiguration* extensions, | 5359 v8::ExtensionConfiguration* extensions, |
| 5365 v8::Handle<ObjectTemplate> global_template, | 5360 v8::Handle<ObjectTemplate> global_template, |
| 5366 v8::Handle<Value> global_object) { | 5361 v8::Handle<Value> global_object) { |
| 5367 i::Isolate::EnsureDefaultIsolate(); | 5362 i::Isolate::EnsureDefaultIsolate(); |
| 5368 i::Isolate* isolate = i::Isolate::Current(); | 5363 i::Isolate* isolate = i::Isolate::Current(); |
| 5369 Isolate* external_isolate = reinterpret_cast<Isolate*>(isolate); | 5364 Isolate* external_isolate = reinterpret_cast<Isolate*>(isolate); |
| 5370 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | 5365 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); |
| 5371 LOG_API(isolate, "Context::New"); | 5366 LOG_API(isolate, "Context::New"); |
| 5372 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>()); | 5367 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>()); |
| 5373 i::HandleScope scope(isolate); | 5368 i::HandleScope scope(isolate); |
| 5374 i::Handle<i::Context> env = | 5369 i::Handle<i::Context> env = |
| 5375 CreateEnvironment(isolate, extensions, global_template, global_object); | 5370 CreateEnvironment(isolate, extensions, global_template, global_object); |
| 5376 if (env.is_null()) return Persistent<Context>(); | 5371 if (env.is_null()) return Persistent<Context>(); |
| 5377 return Persistent<Context>::New(external_isolate, Utils::ToLocal(env)); | 5372 return Persistent<Context>::New(external_isolate, Utils::ToLocal(env)); |
| 5378 } | 5373 } |
| 5374 #endif |
| 5379 | 5375 |
| 5380 | 5376 |
| 5381 Local<Context> v8::Context::New( | 5377 Local<Context> v8::Context::New( |
| 5382 v8::Isolate* external_isolate, | 5378 v8::Isolate* external_isolate, |
| 5383 v8::ExtensionConfiguration* extensions, | 5379 v8::ExtensionConfiguration* extensions, |
| 5384 v8::Handle<ObjectTemplate> global_template, | 5380 v8::Handle<ObjectTemplate> global_template, |
| 5385 v8::Handle<Value> global_object) { | 5381 v8::Handle<Value> global_object) { |
| 5386 i::Isolate::EnsureDefaultIsolate(); | 5382 i::Isolate::EnsureDefaultIsolate(); |
| 5387 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); | 5383 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); |
| 5388 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); | 5384 EnsureInitializedForIsolate(isolate, "v8::Context::New()"); |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6542 if (current.is_null()) return Local<Context>(); | 6538 if (current.is_null()) return Local<Context>(); |
| 6543 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current); | 6539 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current); |
| 6544 return Utils::ToLocal(context); | 6540 return Utils::ToLocal(context); |
| 6545 } | 6541 } |
| 6546 | 6542 |
| 6547 | 6543 |
| 6548 void Isolate::SetObjectGroupId(const Persistent<Value>& object, | 6544 void Isolate::SetObjectGroupId(const Persistent<Value>& object, |
| 6549 UniqueId id) { | 6545 UniqueId id) { |
| 6550 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6546 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6551 internal_isolate->global_handles()->SetObjectGroupId( | 6547 internal_isolate->global_handles()->SetObjectGroupId( |
| 6552 reinterpret_cast<i::Object**>(*object), id); | 6548 Utils::OpenPersistent(object).location(), |
| 6549 id); |
| 6553 } | 6550 } |
| 6554 | 6551 |
| 6555 | 6552 |
| 6556 void Isolate::SetReferenceFromGroup(UniqueId id, | 6553 void Isolate::SetReferenceFromGroup(UniqueId id, |
| 6557 const Persistent<Value>& object) { | 6554 const Persistent<Value>& object) { |
| 6558 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6555 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6559 internal_isolate->global_handles() | 6556 internal_isolate->global_handles()->SetReferenceFromGroup( |
| 6560 ->SetReferenceFromGroup(id, reinterpret_cast<i::Object**>(*object)); | 6557 id, |
| 6558 Utils::OpenPersistent(object).location()); |
| 6561 } | 6559 } |
| 6562 | 6560 |
| 6563 | 6561 |
| 6564 void Isolate::SetReference(const Persistent<Object>& parent, | 6562 void Isolate::SetReference(const Persistent<Object>& parent, |
| 6565 const Persistent<Value>& child) { | 6563 const Persistent<Value>& child) { |
| 6566 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6564 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6565 i::Object** parent_location = Utils::OpenPersistent(parent).location(); |
| 6567 internal_isolate->global_handles()->SetReference( | 6566 internal_isolate->global_handles()->SetReference( |
| 6568 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(), | 6567 reinterpret_cast<i::HeapObject**>(parent_location), |
| 6569 reinterpret_cast<i::Object**>(*child)); | 6568 Utils::OpenPersistent(child).location()); |
| 6570 } | 6569 } |
| 6571 | 6570 |
| 6572 | 6571 |
| 6573 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { | 6572 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { |
| 6574 i::Isolate* isolate = i::Isolate::Current(); | 6573 i::Isolate* isolate = i::Isolate::Current(); |
| 6575 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return; | 6574 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return; |
| 6576 isolate->heap()->SetGlobalGCPrologueCallback(callback); | 6575 isolate->heap()->SetGlobalGCPrologueCallback(callback); |
| 6577 } | 6576 } |
| 6578 | 6577 |
| 6579 | 6578 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7164 | 7163 |
| 7165 #endif // ENABLE_DEBUGGER_SUPPORT | 7164 #endif // ENABLE_DEBUGGER_SUPPORT |
| 7166 | 7165 |
| 7167 | 7166 |
| 7168 Handle<String> CpuProfileNode::GetFunctionName() const { | 7167 Handle<String> CpuProfileNode::GetFunctionName() const { |
| 7169 i::Isolate* isolate = i::Isolate::Current(); | 7168 i::Isolate* isolate = i::Isolate::Current(); |
| 7170 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName"); | 7169 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName"); |
| 7171 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 7170 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 7172 const i::CodeEntry* entry = node->entry(); | 7171 const i::CodeEntry* entry = node->entry(); |
| 7173 if (!entry->has_name_prefix()) { | 7172 if (!entry->has_name_prefix()) { |
| 7174 return Handle<String>(ToApi<String>( | 7173 return ToApiHandle<String>( |
| 7174 isolate->factory()->InternalizeUtf8String(entry->name())); |
| 7175 } else { |
| 7176 return ToApiHandle<String>(isolate->factory()->NewConsString( |
| 7177 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), |
| 7175 isolate->factory()->InternalizeUtf8String(entry->name()))); | 7178 isolate->factory()->InternalizeUtf8String(entry->name()))); |
| 7176 } else { | |
| 7177 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString( | |
| 7178 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), | |
| 7179 isolate->factory()->InternalizeUtf8String(entry->name())))); | |
| 7180 } | 7179 } |
| 7181 } | 7180 } |
| 7182 | 7181 |
| 7183 | 7182 |
| 7184 Handle<String> CpuProfileNode::GetScriptResourceName() const { | 7183 Handle<String> CpuProfileNode::GetScriptResourceName() const { |
| 7185 i::Isolate* isolate = i::Isolate::Current(); | 7184 i::Isolate* isolate = i::Isolate::Current(); |
| 7186 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); | 7185 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); |
| 7187 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 7186 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 7188 return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String( | 7187 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
| 7189 node->entry()->resource_name()))); | 7188 node->entry()->resource_name())); |
| 7190 } | 7189 } |
| 7191 | 7190 |
| 7192 | 7191 |
| 7193 int CpuProfileNode::GetLineNumber() const { | 7192 int CpuProfileNode::GetLineNumber() const { |
| 7194 i::Isolate* isolate = i::Isolate::Current(); | 7193 i::Isolate* isolate = i::Isolate::Current(); |
| 7195 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); | 7194 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); |
| 7196 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); | 7195 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); |
| 7197 } | 7196 } |
| 7198 | 7197 |
| 7199 | 7198 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7270 i::Isolate* isolate = i::Isolate::Current(); | 7269 i::Isolate* isolate = i::Isolate::Current(); |
| 7271 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); | 7270 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); |
| 7272 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); | 7271 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); |
| 7273 } | 7272 } |
| 7274 | 7273 |
| 7275 | 7274 |
| 7276 Handle<String> CpuProfile::GetTitle() const { | 7275 Handle<String> CpuProfile::GetTitle() const { |
| 7277 i::Isolate* isolate = i::Isolate::Current(); | 7276 i::Isolate* isolate = i::Isolate::Current(); |
| 7278 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); | 7277 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); |
| 7279 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7278 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
| 7280 return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String( | 7279 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
| 7281 profile->title()))); | 7280 profile->title())); |
| 7282 } | 7281 } |
| 7283 | 7282 |
| 7284 | 7283 |
| 7285 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { | 7284 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { |
| 7286 i::Isolate* isolate = i::Isolate::Current(); | 7285 i::Isolate* isolate = i::Isolate::Current(); |
| 7287 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); | 7286 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); |
| 7288 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7287 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
| 7289 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); | 7288 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); |
| 7290 } | 7289 } |
| 7291 | 7290 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7439 | 7438 |
| 7440 Handle<Value> HeapGraphEdge::GetName() const { | 7439 Handle<Value> HeapGraphEdge::GetName() const { |
| 7441 i::Isolate* isolate = i::Isolate::Current(); | 7440 i::Isolate* isolate = i::Isolate::Current(); |
| 7442 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName"); | 7441 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName"); |
| 7443 i::HeapGraphEdge* edge = ToInternal(this); | 7442 i::HeapGraphEdge* edge = ToInternal(this); |
| 7444 switch (edge->type()) { | 7443 switch (edge->type()) { |
| 7445 case i::HeapGraphEdge::kContextVariable: | 7444 case i::HeapGraphEdge::kContextVariable: |
| 7446 case i::HeapGraphEdge::kInternal: | 7445 case i::HeapGraphEdge::kInternal: |
| 7447 case i::HeapGraphEdge::kProperty: | 7446 case i::HeapGraphEdge::kProperty: |
| 7448 case i::HeapGraphEdge::kShortcut: | 7447 case i::HeapGraphEdge::kShortcut: |
| 7449 return Handle<String>(ToApi<String>( | 7448 return ToApiHandle<String>( |
| 7450 isolate->factory()->InternalizeUtf8String(edge->name()))); | 7449 isolate->factory()->InternalizeUtf8String(edge->name())); |
| 7451 case i::HeapGraphEdge::kElement: | 7450 case i::HeapGraphEdge::kElement: |
| 7452 case i::HeapGraphEdge::kHidden: | 7451 case i::HeapGraphEdge::kHidden: |
| 7453 return Handle<Number>(ToApi<Number>( | 7452 return ToApiHandle<Number>( |
| 7454 isolate->factory()->NewNumberFromInt(edge->index()))); | 7453 isolate->factory()->NewNumberFromInt(edge->index())); |
| 7455 default: UNREACHABLE(); | 7454 default: UNREACHABLE(); |
| 7456 } | 7455 } |
| 7457 return v8::Undefined(); | 7456 return v8::Undefined(); |
| 7458 } | 7457 } |
| 7459 | 7458 |
| 7460 | 7459 |
| 7461 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { | 7460 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { |
| 7462 i::Isolate* isolate = i::Isolate::Current(); | 7461 i::Isolate* isolate = i::Isolate::Current(); |
| 7463 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); | 7462 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); |
| 7464 const i::HeapEntry* from = ToInternal(this)->from(); | 7463 const i::HeapEntry* from = ToInternal(this)->from(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7483 HeapGraphNode::Type HeapGraphNode::GetType() const { | 7482 HeapGraphNode::Type HeapGraphNode::GetType() const { |
| 7484 i::Isolate* isolate = i::Isolate::Current(); | 7483 i::Isolate* isolate = i::Isolate::Current(); |
| 7485 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); | 7484 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); |
| 7486 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); | 7485 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); |
| 7487 } | 7486 } |
| 7488 | 7487 |
| 7489 | 7488 |
| 7490 Handle<String> HeapGraphNode::GetName() const { | 7489 Handle<String> HeapGraphNode::GetName() const { |
| 7491 i::Isolate* isolate = i::Isolate::Current(); | 7490 i::Isolate* isolate = i::Isolate::Current(); |
| 7492 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); | 7491 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); |
| 7493 return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String( | 7492 return ToApiHandle<String>( |
| 7494 ToInternal(this)->name()))); | 7493 isolate->factory()->InternalizeUtf8String(ToInternal(this)->name())); |
| 7495 } | 7494 } |
| 7496 | 7495 |
| 7497 | 7496 |
| 7498 SnapshotObjectId HeapGraphNode::GetId() const { | 7497 SnapshotObjectId HeapGraphNode::GetId() const { |
| 7499 i::Isolate* isolate = i::Isolate::Current(); | 7498 i::Isolate* isolate = i::Isolate::Current(); |
| 7500 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); | 7499 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); |
| 7501 return ToInternal(this)->id(); | 7500 return ToInternal(this)->id(); |
| 7502 } | 7501 } |
| 7503 | 7502 |
| 7504 | 7503 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 7521 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild"); | 7520 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild"); |
| 7522 return reinterpret_cast<const HeapGraphEdge*>( | 7521 return reinterpret_cast<const HeapGraphEdge*>( |
| 7523 ToInternal(this)->children()[index]); | 7522 ToInternal(this)->children()[index]); |
| 7524 } | 7523 } |
| 7525 | 7524 |
| 7526 | 7525 |
| 7527 v8::Handle<v8::Value> HeapGraphNode::GetHeapValue() const { | 7526 v8::Handle<v8::Value> HeapGraphNode::GetHeapValue() const { |
| 7528 i::Isolate* isolate = i::Isolate::Current(); | 7527 i::Isolate* isolate = i::Isolate::Current(); |
| 7529 IsDeadCheck(isolate, "v8::HeapGraphNode::GetHeapValue"); | 7528 IsDeadCheck(isolate, "v8::HeapGraphNode::GetHeapValue"); |
| 7530 i::Handle<i::HeapObject> object = ToInternal(this)->GetHeapObject(); | 7529 i::Handle<i::HeapObject> object = ToInternal(this)->GetHeapObject(); |
| 7531 return v8::Handle<Value>(!object.is_null() ? | 7530 return !object.is_null() ? |
| 7532 ToApi<Value>(object) : ToApi<Value>( | 7531 ToApiHandle<Value>(object) : |
| 7533 isolate->factory()->undefined_value())); | 7532 ToApiHandle<Value>(isolate->factory()->undefined_value()); |
| 7534 } | 7533 } |
| 7535 | 7534 |
| 7536 | 7535 |
| 7537 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { | 7536 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { |
| 7538 return const_cast<i::HeapSnapshot*>( | 7537 return const_cast<i::HeapSnapshot*>( |
| 7539 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); | 7538 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); |
| 7540 } | 7539 } |
| 7541 | 7540 |
| 7542 | 7541 |
| 7543 void HeapSnapshot::Delete() { | 7542 void HeapSnapshot::Delete() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7562 unsigned HeapSnapshot::GetUid() const { | 7561 unsigned HeapSnapshot::GetUid() const { |
| 7563 i::Isolate* isolate = i::Isolate::Current(); | 7562 i::Isolate* isolate = i::Isolate::Current(); |
| 7564 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); | 7563 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); |
| 7565 return ToInternal(this)->uid(); | 7564 return ToInternal(this)->uid(); |
| 7566 } | 7565 } |
| 7567 | 7566 |
| 7568 | 7567 |
| 7569 Handle<String> HeapSnapshot::GetTitle() const { | 7568 Handle<String> HeapSnapshot::GetTitle() const { |
| 7570 i::Isolate* isolate = i::Isolate::Current(); | 7569 i::Isolate* isolate = i::Isolate::Current(); |
| 7571 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); | 7570 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); |
| 7572 return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String( | 7571 return ToApiHandle<String>( |
| 7573 ToInternal(this)->title()))); | 7572 isolate->factory()->InternalizeUtf8String(ToInternal(this)->title())); |
| 7574 } | 7573 } |
| 7575 | 7574 |
| 7576 | 7575 |
| 7577 const HeapGraphNode* HeapSnapshot::GetRoot() const { | 7576 const HeapGraphNode* HeapSnapshot::GetRoot() const { |
| 7578 i::Isolate* isolate = i::Isolate::Current(); | 7577 i::Isolate* isolate = i::Isolate::Current(); |
| 7579 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead"); | 7578 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead"); |
| 7580 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); | 7579 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); |
| 7581 } | 7580 } |
| 7582 | 7581 |
| 7583 | 7582 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7996 | 7995 |
| 7997 v->VisitPointers(blocks_.first(), first_block_limit_); | 7996 v->VisitPointers(blocks_.first(), first_block_limit_); |
| 7998 | 7997 |
| 7999 for (int i = 1; i < blocks_.length(); i++) { | 7998 for (int i = 1; i < blocks_.length(); i++) { |
| 8000 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7999 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
| 8001 } | 8000 } |
| 8002 } | 8001 } |
| 8003 | 8002 |
| 8004 | 8003 |
| 8005 } } // namespace v8::internal | 8004 } } // namespace v8::internal |
| OLD | NEW |