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