Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: src/api.cc

Issue 12300018: Made Isolate a mandatory parameter for everything Handle-related. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Even less Isolate::Current Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 i::HandleScope::DeleteExtensions(isolate_); 696 i::HandleScope::DeleteExtensions(isolate_);
697 } 697 }
698 698
699 #ifdef DEBUG 699 #ifdef DEBUG
700 i::HandleScope::ZapRange(prev_next_, prev_limit_); 700 i::HandleScope::ZapRange(prev_next_, prev_limit_);
701 #endif 701 #endif
702 } 702 }
703 703
704 704
705 int HandleScope::NumberOfHandles() { 705 int HandleScope::NumberOfHandles() {
706 EnsureInitializedForIsolate( 706 i::Isolate* isolate = i::Isolate::Current();
707 i::Isolate::Current(), "HandleScope::NumberOfHandles"); 707 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) {
708 return i::HandleScope::NumberOfHandles(); 708 return 0;
709 }
710 return i::HandleScope::NumberOfHandles(isolate);
709 } 711 }
710 712
711 713
712 i::Object** HandleScope::CreateHandle(i::Object* value) { 714 i::Object** HandleScope::CreateHandle(i::Object* value) {
713 return i::HandleScope::CreateHandle(value, i::Isolate::Current()); 715 return i::HandleScope::CreateHandle(i::Isolate::Current(), value);
714 } 716 }
715 717
716 718
717 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) { 719 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) {
718 ASSERT(isolate == i::Isolate::Current()); 720 ASSERT(isolate == i::Isolate::Current());
719 return i::HandleScope::CreateHandle(value, isolate); 721 return i::HandleScope::CreateHandle(isolate, value);
720 } 722 }
721 723
722 724
723 i::Object** HandleScope::CreateHandle(i::HeapObject* value) { 725 i::Object** HandleScope::CreateHandle(i::HeapObject* value) {
724 ASSERT(value->IsHeapObject()); 726 ASSERT(value->IsHeapObject());
725 return reinterpret_cast<i::Object**>( 727 return reinterpret_cast<i::Object**>(
726 i::HandleScope::CreateHandle(value, value->GetIsolate())); 728 i::HandleScope::CreateHandle(value->GetIsolate(), value));
727 } 729 }
728 730
729 731
730 void Context::Enter() { 732 void Context::Enter() {
731 i::Handle<i::Context> env = Utils::OpenHandle(this); 733 i::Handle<i::Context> env = Utils::OpenHandle(this);
732 i::Isolate* isolate = env->GetIsolate(); 734 i::Isolate* isolate = env->GetIsolate();
733 if (IsDeadCheck(isolate, "v8::Context::Enter()")) return; 735 if (IsDeadCheck(isolate, "v8::Context::Enter()")) return;
734 ENTER_V8(isolate); 736 ENTER_V8(isolate);
735 737
736 isolate->handle_scope_implementer()->EnterContext(env); 738 isolate->handle_scope_implementer()->EnterContext(env);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 that->set_tag(i::Smi::FromInt(type)); 932 that->set_tag(i::Smi::FromInt(type));
931 } 933 }
932 934
933 935
934 void Template::Set(v8::Handle<String> name, v8::Handle<Data> value, 936 void Template::Set(v8::Handle<String> name, v8::Handle<Data> value,
935 v8::PropertyAttribute attribute) { 937 v8::PropertyAttribute attribute) {
936 i::Isolate* isolate = i::Isolate::Current(); 938 i::Isolate* isolate = i::Isolate::Current();
937 if (IsDeadCheck(isolate, "v8::Template::Set()")) return; 939 if (IsDeadCheck(isolate, "v8::Template::Set()")) return;
938 ENTER_V8(isolate); 940 ENTER_V8(isolate);
939 i::HandleScope scope(isolate); 941 i::HandleScope scope(isolate);
940 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list()); 942 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list(), isolate);
941 if (list->IsUndefined()) { 943 if (list->IsUndefined()) {
942 list = NeanderArray().value(); 944 list = NeanderArray().value();
943 Utils::OpenHandle(this)->set_property_list(*list); 945 Utils::OpenHandle(this)->set_property_list(*list);
944 } 946 }
945 NeanderArray array(list); 947 NeanderArray array(list);
946 array.add(Utils::OpenHandle(*name)); 948 array.add(Utils::OpenHandle(*name));
947 array.add(Utils::OpenHandle(*value)); 949 array.add(Utils::OpenHandle(*value));
948 array.add(Utils::OpenHandle(*v8::Integer::New(attribute))); 950 array.add(Utils::OpenHandle(*v8::Integer::New(attribute)));
949 } 951 }
950 952
951 953
952 // --- F u n c t i o n T e m p l a t e --- 954 // --- F u n c t i o n T e m p l a t e ---
953 static void InitializeFunctionTemplate( 955 static void InitializeFunctionTemplate(
954 i::Handle<i::FunctionTemplateInfo> info) { 956 i::Handle<i::FunctionTemplateInfo> info) {
955 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); 957 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE));
956 info->set_flag(0); 958 info->set_flag(0);
957 } 959 }
958 960
959 961
960 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { 962 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
961 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 963 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
962 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) { 964 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) {
963 return Local<ObjectTemplate>(); 965 return Local<ObjectTemplate>();
964 } 966 }
965 ENTER_V8(isolate); 967 ENTER_V8(isolate);
966 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template()); 968 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(),
969 isolate);
967 if (result->IsUndefined()) { 970 if (result->IsUndefined()) {
968 result = Utils::OpenHandle(*ObjectTemplate::New()); 971 result = Utils::OpenHandle(*ObjectTemplate::New());
969 Utils::OpenHandle(this)->set_prototype_template(*result); 972 Utils::OpenHandle(this)->set_prototype_template(*result);
970 } 973 }
971 return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result)); 974 return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result));
972 } 975 }
973 976
974 977
975 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { 978 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) {
976 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 979 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 if (IsDeadCheck(isolate, 1139 if (IsDeadCheck(isolate,
1137 "v8::FunctionTemplate::AddInstancePropertyAccessor()")) { 1140 "v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
1138 return; 1141 return;
1139 } 1142 }
1140 ENTER_V8(isolate); 1143 ENTER_V8(isolate);
1141 i::HandleScope scope(isolate); 1144 i::HandleScope scope(isolate);
1142 1145
1143 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name, getter, setter, data, 1146 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name, getter, setter, data,
1144 settings, attributes, 1147 settings, attributes,
1145 signature); 1148 signature);
1146 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors()); 1149 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors(),
1150 isolate);
1147 if (list->IsUndefined()) { 1151 if (list->IsUndefined()) {
1148 list = NeanderArray().value(); 1152 list = NeanderArray().value();
1149 Utils::OpenHandle(this)->set_property_accessors(*list); 1153 Utils::OpenHandle(this)->set_property_accessors(*list);
1150 } 1154 }
1151 NeanderArray array(list); 1155 NeanderArray array(list);
1152 array.add(obj); 1156 array.add(obj);
1153 } 1157 }
1154 1158
1155 1159
1156 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() { 1160 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 1690
1687 Local<Value> Script::Id() { 1691 Local<Value> Script::Id() {
1688 i::Isolate* isolate = i::Isolate::Current(); 1692 i::Isolate* isolate = i::Isolate::Current();
1689 ON_BAILOUT(isolate, "v8::Script::Id()", return Local<Value>()); 1693 ON_BAILOUT(isolate, "v8::Script::Id()", return Local<Value>());
1690 LOG_API(isolate, "Script::Id"); 1694 LOG_API(isolate, "Script::Id");
1691 i::Object* raw_id = NULL; 1695 i::Object* raw_id = NULL;
1692 { 1696 {
1693 i::HandleScope scope(isolate); 1697 i::HandleScope scope(isolate);
1694 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); 1698 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this);
1695 i::Handle<i::Script> script(i::Script::cast(function_info->script())); 1699 i::Handle<i::Script> script(i::Script::cast(function_info->script()));
1696 i::Handle<i::Object> id(script->id()); 1700 i::Handle<i::Object> id(script->id(), isolate);
1697 raw_id = *id; 1701 raw_id = *id;
1698 } 1702 }
1699 i::Handle<i::Object> id(raw_id); 1703 i::Handle<i::Object> id(raw_id, isolate);
1700 return Utils::ToLocal(id); 1704 return Utils::ToLocal(id);
1701 } 1705 }
1702 1706
1703 1707
1704 void Script::SetData(v8::Handle<String> data) { 1708 void Script::SetData(v8::Handle<String> data) {
1705 i::Isolate* isolate = i::Isolate::Current(); 1709 i::Isolate* isolate = i::Isolate::Current();
1706 ON_BAILOUT(isolate, "v8::Script::SetData()", return); 1710 ON_BAILOUT(isolate, "v8::Script::SetData()", return);
1707 LOG_API(isolate, "Script::SetData"); 1711 LOG_API(isolate, "Script::SetData");
1708 { 1712 {
1709 i::HandleScope scope(isolate); 1713 i::HandleScope scope(isolate);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 1779
1776 v8::Local<Value> v8::TryCatch::StackTrace() const { 1780 v8::Local<Value> v8::TryCatch::StackTrace() const {
1777 ASSERT(isolate_ == i::Isolate::Current()); 1781 ASSERT(isolate_ == i::Isolate::Current());
1778 if (HasCaught()) { 1782 if (HasCaught()) {
1779 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_); 1783 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_);
1780 if (!raw_obj->IsJSObject()) return v8::Local<Value>(); 1784 if (!raw_obj->IsJSObject()) return v8::Local<Value>();
1781 i::HandleScope scope(isolate_); 1785 i::HandleScope scope(isolate_);
1782 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_); 1786 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
1783 i::Handle<i::String> name = isolate_->factory()->stack_symbol(); 1787 i::Handle<i::String> name = isolate_->factory()->stack_symbol();
1784 if (!obj->HasProperty(*name)) return v8::Local<Value>(); 1788 if (!obj->HasProperty(*name)) return v8::Local<Value>();
1785 i::Handle<i::Object> value = i::GetProperty(obj, name); 1789 i::Handle<i::Object> value = i::GetProperty(isolate_, obj, name);
1786 if (value.is_null()) return v8::Local<Value>(); 1790 if (value.is_null()) return v8::Local<Value>();
1787 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); 1791 return v8::Utils::ToLocal(scope.CloseAndEscape(value));
1788 } else { 1792 } else {
1789 return v8::Local<Value>(); 1793 return v8::Local<Value>();
1790 } 1794 }
1791 } 1795 }
1792 1796
1793 1797
1794 v8::Local<v8::Message> v8::TryCatch::Message() const { 1798 v8::Local<v8::Message> v8::TryCatch::Message() const {
1795 ASSERT(isolate_ == i::Isolate::Current()); 1799 ASSERT(isolate_ == i::Isolate::Current());
(...skipping 25 matching lines...) Expand all
1821 1825
1822 // --- M e s s a g e --- 1826 // --- M e s s a g e ---
1823 1827
1824 1828
1825 Local<String> Message::Get() const { 1829 Local<String> Message::Get() const {
1826 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1830 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1827 ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>()); 1831 ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>());
1828 ENTER_V8(isolate); 1832 ENTER_V8(isolate);
1829 HandleScope scope; 1833 HandleScope scope;
1830 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1834 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1831 i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(obj); 1835 i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate, obj);
1832 Local<String> result = Utils::ToLocal(raw_result); 1836 Local<String> result = Utils::ToLocal(raw_result);
1833 return scope.Close(result); 1837 return scope.Close(result);
1834 } 1838 }
1835 1839
1836 1840
1837 v8::Handle<Value> Message::GetScriptResourceName() const { 1841 v8::Handle<Value> Message::GetScriptResourceName() const {
1838 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1842 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1839 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceName()")) { 1843 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceName()")) {
1840 return Local<String>(); 1844 return Local<String>();
1841 } 1845 }
1842 ENTER_V8(isolate); 1846 ENTER_V8(isolate);
1843 HandleScope scope; 1847 HandleScope scope;
1844 i::Handle<i::JSMessageObject> message = 1848 i::Handle<i::JSMessageObject> message =
1845 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1849 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1846 // Return this.script.name. 1850 // Return this.script.name.
1847 i::Handle<i::JSValue> script = 1851 i::Handle<i::JSValue> script =
1848 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script())); 1852 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
1849 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name()); 1853 isolate));
1854 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name(),
1855 isolate);
1850 return scope.Close(Utils::ToLocal(resource_name)); 1856 return scope.Close(Utils::ToLocal(resource_name));
1851 } 1857 }
1852 1858
1853 1859
1854 v8::Handle<Value> Message::GetScriptData() const { 1860 v8::Handle<Value> Message::GetScriptData() const {
1855 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1861 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1856 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceData()")) { 1862 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceData()")) {
1857 return Local<Value>(); 1863 return Local<Value>();
1858 } 1864 }
1859 ENTER_V8(isolate); 1865 ENTER_V8(isolate);
1860 HandleScope scope; 1866 HandleScope scope;
1861 i::Handle<i::JSMessageObject> message = 1867 i::Handle<i::JSMessageObject> message =
1862 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1868 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1863 // Return this.script.data. 1869 // Return this.script.data.
1864 i::Handle<i::JSValue> script = 1870 i::Handle<i::JSValue> script =
1865 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script())); 1871 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
1866 i::Handle<i::Object> data(i::Script::cast(script->value())->data()); 1872 isolate));
1873 i::Handle<i::Object> data(i::Script::cast(script->value())->data(), isolate);
1867 return scope.Close(Utils::ToLocal(data)); 1874 return scope.Close(Utils::ToLocal(data));
1868 } 1875 }
1869 1876
1870 1877
1871 v8::Handle<v8::StackTrace> Message::GetStackTrace() const { 1878 v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
1872 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1879 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1873 if (IsDeadCheck(isolate, "v8::Message::GetStackTrace()")) { 1880 if (IsDeadCheck(isolate, "v8::Message::GetStackTrace()")) {
1874 return Local<v8::StackTrace>(); 1881 return Local<v8::StackTrace>();
1875 } 1882 }
1876 ENTER_V8(isolate); 1883 ENTER_V8(isolate);
1877 HandleScope scope; 1884 HandleScope scope;
1878 i::Handle<i::JSMessageObject> message = 1885 i::Handle<i::JSMessageObject> message =
1879 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1886 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1880 i::Handle<i::Object> stackFramesObj(message->stack_frames()); 1887 i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate);
1881 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); 1888 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
1882 i::Handle<i::JSArray> stackTrace = 1889 i::Handle<i::JSArray> stackTrace =
1883 i::Handle<i::JSArray>::cast(stackFramesObj); 1890 i::Handle<i::JSArray>::cast(stackFramesObj);
1884 return scope.Close(Utils::StackTraceToLocal(stackTrace)); 1891 return scope.Close(Utils::StackTraceToLocal(stackTrace));
1885 } 1892 }
1886 1893
1887 1894
1888 static i::Handle<i::Object> CallV8HeapFunction(const char* name, 1895 static i::Handle<i::Object> CallV8HeapFunction(const char* name,
1889 i::Handle<i::Object> recv, 1896 i::Handle<i::Object> recv,
1890 int argc, 1897 int argc,
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2429 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2423 if (obj->IsBoolean()) { 2430 if (obj->IsBoolean()) {
2424 return Local<Boolean>(ToApi<Boolean>(obj)); 2431 return Local<Boolean>(ToApi<Boolean>(obj));
2425 } else { 2432 } else {
2426 i::Isolate* isolate = i::Isolate::Current(); 2433 i::Isolate* isolate = i::Isolate::Current();
2427 if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) { 2434 if (IsDeadCheck(isolate, "v8::Value::ToBoolean()")) {
2428 return Local<Boolean>(); 2435 return Local<Boolean>();
2429 } 2436 }
2430 LOG_API(isolate, "ToBoolean"); 2437 LOG_API(isolate, "ToBoolean");
2431 ENTER_V8(isolate); 2438 ENTER_V8(isolate);
2432 i::Handle<i::Object> val = i::Execution::ToBoolean(obj); 2439 i::Handle<i::Object> val = i::Execution::ToBoolean(isolate, obj);
2433 return Local<Boolean>(ToApi<Boolean>(val)); 2440 return Local<Boolean>(ToApi<Boolean>(val));
2434 } 2441 }
2435 } 2442 }
2436 2443
2437 2444
2438 Local<Number> Value::ToNumber() const { 2445 Local<Number> Value::ToNumber() const {
2439 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2446 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2440 i::Handle<i::Object> num; 2447 i::Handle<i::Object> num;
2441 if (obj->IsNumber()) { 2448 if (obj->IsNumber()) {
2442 num = obj; 2449 num = obj;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 2593
2587 bool Value::BooleanValue() const { 2594 bool Value::BooleanValue() const {
2588 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2595 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2589 if (obj->IsBoolean()) { 2596 if (obj->IsBoolean()) {
2590 return obj->IsTrue(); 2597 return obj->IsTrue();
2591 } else { 2598 } else {
2592 i::Isolate* isolate = i::Isolate::Current(); 2599 i::Isolate* isolate = i::Isolate::Current();
2593 if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false; 2600 if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false;
2594 LOG_API(isolate, "BooleanValue"); 2601 LOG_API(isolate, "BooleanValue");
2595 ENTER_V8(isolate); 2602 ENTER_V8(isolate);
2596 i::Handle<i::Object> value = i::Execution::ToBoolean(obj); 2603 i::Handle<i::Object> value = i::Execution::ToBoolean(isolate, obj);
2597 return value->IsTrue(); 2604 return value->IsTrue();
2598 } 2605 }
2599 } 2606 }
2600 2607
2601 2608
2602 double Value::NumberValue() const { 2609 double Value::NumberValue() const {
2603 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2610 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2604 i::Handle<i::Object> num; 2611 i::Handle<i::Object> num;
2605 if (obj->IsNumber()) { 2612 if (obj->IsNumber()) {
2606 num = obj; 2613 num = obj;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 ENTER_V8(isolate); 2696 ENTER_V8(isolate);
2690 EXCEPTION_PREAMBLE(isolate); 2697 EXCEPTION_PREAMBLE(isolate);
2691 i::Handle<i::Object> string_obj = 2698 i::Handle<i::Object> string_obj =
2692 i::Execution::ToString(obj, &has_pending_exception); 2699 i::Execution::ToString(obj, &has_pending_exception);
2693 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); 2700 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>());
2694 i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj); 2701 i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj);
2695 uint32_t index; 2702 uint32_t index;
2696 if (str->AsArrayIndex(&index)) { 2703 if (str->AsArrayIndex(&index)) {
2697 i::Handle<i::Object> value; 2704 i::Handle<i::Object> value;
2698 if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) { 2705 if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) {
2699 value = i::Handle<i::Object>(i::Smi::FromInt(index)); 2706 value = i::Handle<i::Object>(i::Smi::FromInt(index), isolate);
2700 } else { 2707 } else {
2701 value = isolate->factory()->NewNumber(index); 2708 value = isolate->factory()->NewNumber(index);
2702 } 2709 }
2703 return Utils::Uint32ToLocal(value); 2710 return Utils::Uint32ToLocal(value);
2704 } 2711 }
2705 return Local<Uint32>(); 2712 return Local<Uint32>();
2706 } 2713 }
2707 2714
2708 2715
2709 int32_t Value::Int32Value() const { 2716 int32_t Value::Int32Value() const {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 } 2905 }
2899 2906
2900 2907
2901 Local<Value> v8::Object::Get(v8::Handle<Value> key) { 2908 Local<Value> v8::Object::Get(v8::Handle<Value> key) {
2902 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2909 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2903 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>()); 2910 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
2904 ENTER_V8(isolate); 2911 ENTER_V8(isolate);
2905 i::Handle<i::Object> self = Utils::OpenHandle(this); 2912 i::Handle<i::Object> self = Utils::OpenHandle(this);
2906 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 2913 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2907 EXCEPTION_PREAMBLE(isolate); 2914 EXCEPTION_PREAMBLE(isolate);
2908 i::Handle<i::Object> result = i::GetProperty(self, key_obj); 2915 i::Handle<i::Object> result = i::GetProperty(isolate, self, key_obj);
2909 has_pending_exception = result.is_null(); 2916 has_pending_exception = result.is_null();
2910 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 2917 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
2911 return Utils::ToLocal(result); 2918 return Utils::ToLocal(result);
2912 } 2919 }
2913 2920
2914 2921
2915 Local<Value> v8::Object::Get(uint32_t index) { 2922 Local<Value> v8::Object::Get(uint32_t index) {
2916 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2923 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2917 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>()); 2924 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
2918 ENTER_V8(isolate); 2925 ENTER_V8(isolate);
(...skipping 25 matching lines...) Expand all
2944 return static_cast<PropertyAttribute>(result); 2951 return static_cast<PropertyAttribute>(result);
2945 } 2952 }
2946 2953
2947 2954
2948 Local<Value> v8::Object::GetPrototype() { 2955 Local<Value> v8::Object::GetPrototype() {
2949 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2956 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2950 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", 2957 ON_BAILOUT(isolate, "v8::Object::GetPrototype()",
2951 return Local<v8::Value>()); 2958 return Local<v8::Value>());
2952 ENTER_V8(isolate); 2959 ENTER_V8(isolate);
2953 i::Handle<i::Object> self = Utils::OpenHandle(this); 2960 i::Handle<i::Object> self = Utils::OpenHandle(this);
2954 i::Handle<i::Object> result(self->GetPrototype()); 2961 i::Handle<i::Object> result(self->GetPrototype(), isolate);
2955 return Utils::ToLocal(result); 2962 return Utils::ToLocal(result);
2956 } 2963 }
2957 2964
2958 2965
2959 bool v8::Object::SetPrototype(Handle<Value> value) { 2966 bool v8::Object::SetPrototype(Handle<Value> value) {
2960 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2967 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2961 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false); 2968 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
2962 ENTER_V8(isolate); 2969 ENTER_V8(isolate);
2963 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2970 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2964 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2971 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 } 3040 }
3034 3041
3035 3042
3036 Local<String> v8::Object::ObjectProtoToString() { 3043 Local<String> v8::Object::ObjectProtoToString() {
3037 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3044 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3038 ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()", 3045 ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()",
3039 return Local<v8::String>()); 3046 return Local<v8::String>());
3040 ENTER_V8(isolate); 3047 ENTER_V8(isolate);
3041 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3048 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3042 3049
3043 i::Handle<i::Object> name(self->class_name()); 3050 i::Handle<i::Object> name(self->class_name(), isolate);
3044 3051
3045 // Native implementation of Object.prototype.toString (v8natives.js): 3052 // Native implementation of Object.prototype.toString (v8natives.js):
3046 // var c = %ClassOf(this); 3053 // var c = %ClassOf(this);
3047 // if (c === 'Arguments') c = 'Object'; 3054 // if (c === 'Arguments') c = 'Object';
3048 // return "[object " + c + "]"; 3055 // return "[object " + c + "]";
3049 3056
3050 if (!name->IsString()) { 3057 if (!name->IsString()) {
3051 return v8::String::New("[object ]"); 3058 return v8::String::New("[object ]");
3052 3059
3053 } else { 3060 } else {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 } 3093 }
3087 } 3094 }
3088 3095
3089 3096
3090 Local<Value> v8::Object::GetConstructor() { 3097 Local<Value> v8::Object::GetConstructor() {
3091 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3098 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3092 ON_BAILOUT(isolate, "v8::Object::GetConstructor()", 3099 ON_BAILOUT(isolate, "v8::Object::GetConstructor()",
3093 return Local<v8::Function>()); 3100 return Local<v8::Function>());
3094 ENTER_V8(isolate); 3101 ENTER_V8(isolate);
3095 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3102 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3096 i::Handle<i::Object> constructor(self->GetConstructor()); 3103 i::Handle<i::Object> constructor(self->GetConstructor(), isolate);
3097 return Utils::ToLocal(constructor); 3104 return Utils::ToLocal(constructor);
3098 } 3105 }
3099 3106
3100 3107
3101 Local<String> v8::Object::GetConstructorName() { 3108 Local<String> v8::Object::GetConstructorName() {
3102 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3109 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3103 ON_BAILOUT(isolate, "v8::Object::GetConstructorName()", 3110 ON_BAILOUT(isolate, "v8::Object::GetConstructorName()",
3104 return Local<v8::String>()); 3111 return Local<v8::String>());
3105 ENTER_V8(isolate); 3112 ENTER_V8(isolate);
3106 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3113 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this); 3724 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
3718 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 3725 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
3719 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3726 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3720 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 3727 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
3721 EXCEPTION_PREAMBLE(isolate); 3728 EXCEPTION_PREAMBLE(isolate);
3722 i::Handle<i::Object> returned = 3729 i::Handle<i::Object> returned =
3723 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); 3730 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
3724 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>()); 3731 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>());
3725 raw_result = *returned; 3732 raw_result = *returned;
3726 } 3733 }
3727 i::Handle<i::Object> result(raw_result); 3734 i::Handle<i::Object> result(raw_result, isolate);
3728 return Utils::ToLocal(result); 3735 return Utils::ToLocal(result);
3729 } 3736 }
3730 3737
3731 3738
3732 void Function::SetName(v8::Handle<v8::String> name) { 3739 void Function::SetName(v8::Handle<v8::String> name) {
3733 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3740 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3734 ENTER_V8(isolate); 3741 ENTER_V8(isolate);
3735 USE(isolate); 3742 USE(isolate);
3736 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 3743 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3737 func->shared()->set_name(*Utils::OpenHandle(*name)); 3744 func->shared()->set_name(*Utils::OpenHandle(*name));
3738 } 3745 }
3739 3746
3740 3747
3741 Handle<Value> Function::GetName() const { 3748 Handle<Value> Function::GetName() const {
3742 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 3749 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3743 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name())); 3750 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->name(),
3751 func->GetIsolate()));
3744 } 3752 }
3745 3753
3746 3754
3747 Handle<Value> Function::GetInferredName() const { 3755 Handle<Value> Function::GetInferredName() const {
3748 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 3756 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3749 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name())); 3757 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(),
3758 func->GetIsolate()));
3750 } 3759 }
3751 3760
3752 3761
3753 ScriptOrigin Function::GetScriptOrigin() const { 3762 ScriptOrigin Function::GetScriptOrigin() const {
3754 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 3763 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3755 if (func->shared()->script()->IsScript()) { 3764 if (func->shared()->script()->IsScript()) {
3756 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); 3765 i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
3757 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); 3766 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script);
3758 v8::ScriptOrigin origin( 3767 v8::ScriptOrigin origin(
3759 Utils::ToLocal(scriptName), 3768 Utils::ToLocal(scriptName),
(...skipping 25 matching lines...) Expand all
3785 return i::GetScriptColumnNumber(script, func->shared()->start_position()); 3794 return i::GetScriptColumnNumber(script, func->shared()->start_position());
3786 } 3795 }
3787 return kLineOffsetNotFound; 3796 return kLineOffsetNotFound;
3788 } 3797 }
3789 3798
3790 Handle<Value> Function::GetScriptId() const { 3799 Handle<Value> Function::GetScriptId() const {
3791 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 3800 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3792 if (!func->shared()->script()->IsScript()) 3801 if (!func->shared()->script()->IsScript())
3793 return v8::Undefined(); 3802 return v8::Undefined();
3794 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); 3803 i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
3795 return Utils::ToLocal(i::Handle<i::Object>(script->id())); 3804 return Utils::ToLocal(i::Handle<i::Object>(script->id(), func->GetIsolate()));
3796 } 3805 }
3797 3806
3798 int String::Length() const { 3807 int String::Length() const {
3799 i::Handle<i::String> str = Utils::OpenHandle(this); 3808 i::Handle<i::String> str = Utils::OpenHandle(this);
3800 if (IsDeadCheck(str->GetIsolate(), "v8::String::Length()")) return 0; 3809 if (IsDeadCheck(str->GetIsolate(), "v8::String::Length()")) return 0;
3801 return str->length(); 3810 return str->length();
3802 } 3811 }
3803 3812
3804 bool String::MayContainNonAscii() const { 3813 bool String::MayContainNonAscii() const {
3805 i::Handle<i::String> str = Utils::OpenHandle(this); 3814 i::Handle<i::String> str = Utils::OpenHandle(this);
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
4608 } 4617 }
4609 4618
4610 4619
4611 Handle<Value> v8::Context::GetSecurityToken() { 4620 Handle<Value> v8::Context::GetSecurityToken() {
4612 i::Isolate* isolate = i::Isolate::Current(); 4621 i::Isolate* isolate = i::Isolate::Current();
4613 if (IsDeadCheck(isolate, "v8::Context::GetSecurityToken()")) { 4622 if (IsDeadCheck(isolate, "v8::Context::GetSecurityToken()")) {
4614 return Handle<Value>(); 4623 return Handle<Value>();
4615 } 4624 }
4616 i::Handle<i::Context> env = Utils::OpenHandle(this); 4625 i::Handle<i::Context> env = Utils::OpenHandle(this);
4617 i::Object* security_token = env->security_token(); 4626 i::Object* security_token = env->security_token();
4618 i::Handle<i::Object> token_handle(security_token); 4627 i::Handle<i::Object> token_handle(security_token, isolate);
4619 return Utils::ToLocal(token_handle); 4628 return Utils::ToLocal(token_handle);
4620 } 4629 }
4621 4630
4622 4631
4623 bool Context::HasOutOfMemoryException() { 4632 bool Context::HasOutOfMemoryException() {
4624 i::Handle<i::Context> env = Utils::OpenHandle(this); 4633 i::Handle<i::Context> env = Utils::OpenHandle(this);
4625 return env->has_out_of_memory(); 4634 return env->has_out_of_memory();
4626 } 4635 }
4627 4636
4628 4637
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4744 Handle<String> error) { 4753 Handle<String> error) {
4745 i::Isolate* isolate = i::Isolate::Current(); 4754 i::Isolate* isolate = i::Isolate::Current();
4746 if (IsDeadCheck(isolate, 4755 if (IsDeadCheck(isolate,
4747 "v8::Context::SetErrorMessageForCodeGenerationFromStrings()")) { 4756 "v8::Context::SetErrorMessageForCodeGenerationFromStrings()")) {
4748 return; 4757 return;
4749 } 4758 }
4750 ENTER_V8(isolate); 4759 ENTER_V8(isolate);
4751 i::Object** ctx = reinterpret_cast<i::Object**>(this); 4760 i::Object** ctx = reinterpret_cast<i::Object**>(this);
4752 i::Handle<i::Context> context = 4761 i::Handle<i::Context> context =
4753 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); 4762 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
4754 i::Handle<i::Object> error_handle = Utils::OpenHandle(*error); 4763 i::Handle<i::String> error_handle = Utils::OpenHandle(*error);
4755 context->set_error_message_for_code_gen_from_strings(*error_handle); 4764 context->set_error_message_for_code_gen_from_strings(*error_handle);
4756 } 4765 }
4757 4766
4758 4767
4759 Local<v8::Object> ObjectTemplate::NewInstance() { 4768 Local<v8::Object> ObjectTemplate::NewInstance() {
4760 i::Isolate* isolate = i::Isolate::Current(); 4769 i::Isolate* isolate = i::Isolate::Current();
4761 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", 4770 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()",
4762 return Local<v8::Object>()); 4771 return Local<v8::Object>());
4763 LOG_API(isolate, "ObjectTemplate::NewInstance"); 4772 LOG_API(isolate, "ObjectTemplate::NewInstance");
4764 ENTER_V8(isolate); 4773 ENTER_V8(isolate);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
5029 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 5038 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
5030 return jsvalue->value()->Number(); 5039 return jsvalue->value()->Number();
5031 } 5040 }
5032 5041
5033 5042
5034 Local<v8::Value> v8::BooleanObject::New(bool value) { 5043 Local<v8::Value> v8::BooleanObject::New(bool value) {
5035 i::Isolate* isolate = i::Isolate::Current(); 5044 i::Isolate* isolate = i::Isolate::Current();
5036 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); 5045 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()");
5037 LOG_API(isolate, "BooleanObject::New"); 5046 LOG_API(isolate, "BooleanObject::New");
5038 ENTER_V8(isolate); 5047 ENTER_V8(isolate);
5039 i::Handle<i::Object> boolean(value ? isolate->heap()->true_value() 5048 i::Handle<i::Object> boolean(value
5040 : isolate->heap()->false_value()); 5049 ? isolate->heap()->true_value()
5050 : isolate->heap()->false_value(),
5051 isolate);
5041 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean); 5052 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean);
5042 return Utils::ToLocal(obj); 5053 return Utils::ToLocal(obj);
5043 } 5054 }
5044 5055
5045 5056
5046 bool v8::BooleanObject::BooleanValue() const { 5057 bool v8::BooleanObject::BooleanValue() const {
5047 i::Isolate* isolate = i::Isolate::Current(); 5058 i::Isolate* isolate = i::Isolate::Current();
5048 if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0; 5059 if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0;
5049 LOG_API(isolate, "BooleanObject::BooleanValue"); 5060 LOG_API(isolate, "BooleanObject::BooleanValue");
5050 i::Handle<i::Object> obj = Utils::OpenHandle(this); 5061 i::Handle<i::Object> obj = Utils::OpenHandle(this);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
5684 LOG_API(isolate, "RangeError"); 5695 LOG_API(isolate, "RangeError");
5685 ON_BAILOUT(isolate, "v8::Exception::RangeError()", return Local<Value>()); 5696 ON_BAILOUT(isolate, "v8::Exception::RangeError()", return Local<Value>());
5686 ENTER_V8(isolate); 5697 ENTER_V8(isolate);
5687 i::Object* error; 5698 i::Object* error;
5688 { 5699 {
5689 i::HandleScope scope(isolate); 5700 i::HandleScope scope(isolate);
5690 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 5701 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
5691 i::Handle<i::Object> result = isolate->factory()->NewRangeError(message); 5702 i::Handle<i::Object> result = isolate->factory()->NewRangeError(message);
5692 error = *result; 5703 error = *result;
5693 } 5704 }
5694 i::Handle<i::Object> result(error); 5705 i::Handle<i::Object> result(error, isolate);
5695 return Utils::ToLocal(result); 5706 return Utils::ToLocal(result);
5696 } 5707 }
5697 5708
5698 Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) { 5709 Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
5699 i::Isolate* isolate = i::Isolate::Current(); 5710 i::Isolate* isolate = i::Isolate::Current();
5700 LOG_API(isolate, "ReferenceError"); 5711 LOG_API(isolate, "ReferenceError");
5701 ON_BAILOUT(isolate, "v8::Exception::ReferenceError()", return Local<Value>()); 5712 ON_BAILOUT(isolate, "v8::Exception::ReferenceError()", return Local<Value>());
5702 ENTER_V8(isolate); 5713 ENTER_V8(isolate);
5703 i::Object* error; 5714 i::Object* error;
5704 { 5715 {
5705 i::HandleScope scope(isolate); 5716 i::HandleScope scope(isolate);
5706 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 5717 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
5707 i::Handle<i::Object> result = 5718 i::Handle<i::Object> result =
5708 isolate->factory()->NewReferenceError(message); 5719 isolate->factory()->NewReferenceError(message);
5709 error = *result; 5720 error = *result;
5710 } 5721 }
5711 i::Handle<i::Object> result(error); 5722 i::Handle<i::Object> result(error, isolate);
5712 return Utils::ToLocal(result); 5723 return Utils::ToLocal(result);
5713 } 5724 }
5714 5725
5715 Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) { 5726 Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
5716 i::Isolate* isolate = i::Isolate::Current(); 5727 i::Isolate* isolate = i::Isolate::Current();
5717 LOG_API(isolate, "SyntaxError"); 5728 LOG_API(isolate, "SyntaxError");
5718 ON_BAILOUT(isolate, "v8::Exception::SyntaxError()", return Local<Value>()); 5729 ON_BAILOUT(isolate, "v8::Exception::SyntaxError()", return Local<Value>());
5719 ENTER_V8(isolate); 5730 ENTER_V8(isolate);
5720 i::Object* error; 5731 i::Object* error;
5721 { 5732 {
5722 i::HandleScope scope(isolate); 5733 i::HandleScope scope(isolate);
5723 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 5734 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
5724 i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(message); 5735 i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(message);
5725 error = *result; 5736 error = *result;
5726 } 5737 }
5727 i::Handle<i::Object> result(error); 5738 i::Handle<i::Object> result(error, isolate);
5728 return Utils::ToLocal(result); 5739 return Utils::ToLocal(result);
5729 } 5740 }
5730 5741
5731 Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) { 5742 Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
5732 i::Isolate* isolate = i::Isolate::Current(); 5743 i::Isolate* isolate = i::Isolate::Current();
5733 LOG_API(isolate, "TypeError"); 5744 LOG_API(isolate, "TypeError");
5734 ON_BAILOUT(isolate, "v8::Exception::TypeError()", return Local<Value>()); 5745 ON_BAILOUT(isolate, "v8::Exception::TypeError()", return Local<Value>());
5735 ENTER_V8(isolate); 5746 ENTER_V8(isolate);
5736 i::Object* error; 5747 i::Object* error;
5737 { 5748 {
5738 i::HandleScope scope(isolate); 5749 i::HandleScope scope(isolate);
5739 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 5750 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
5740 i::Handle<i::Object> result = isolate->factory()->NewTypeError(message); 5751 i::Handle<i::Object> result = isolate->factory()->NewTypeError(message);
5741 error = *result; 5752 error = *result;
5742 } 5753 }
5743 i::Handle<i::Object> result(error); 5754 i::Handle<i::Object> result(error, isolate);
5744 return Utils::ToLocal(result); 5755 return Utils::ToLocal(result);
5745 } 5756 }
5746 5757
5747 Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) { 5758 Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
5748 i::Isolate* isolate = i::Isolate::Current(); 5759 i::Isolate* isolate = i::Isolate::Current();
5749 LOG_API(isolate, "Error"); 5760 LOG_API(isolate, "Error");
5750 ON_BAILOUT(isolate, "v8::Exception::Error()", return Local<Value>()); 5761 ON_BAILOUT(isolate, "v8::Exception::Error()", return Local<Value>());
5751 ENTER_V8(isolate); 5762 ENTER_V8(isolate);
5752 i::Object* error; 5763 i::Object* error;
5753 { 5764 {
5754 i::HandleScope scope(isolate); 5765 i::HandleScope scope(isolate);
5755 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 5766 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
5756 i::Handle<i::Object> result = isolate->factory()->NewError(message); 5767 i::Handle<i::Object> result = isolate->factory()->NewError(message);
5757 error = *result; 5768 error = *result;
5758 } 5769 }
5759 i::Handle<i::Object> result(error); 5770 i::Handle<i::Object> result(error, isolate);
5760 return Utils::ToLocal(result); 5771 return Utils::ToLocal(result);
5761 } 5772 }
5762 5773
5763 5774
5764 // --- D e b u g S u p p o r t --- 5775 // --- D e b u g S u p p o r t ---
5765 5776
5766 #ifdef ENABLE_DEBUGGER_SUPPORT 5777 #ifdef ENABLE_DEBUGGER_SUPPORT
5767 5778
5768 static void EventCallbackWrapper(const v8::Debug::EventDetails& event_details) { 5779 static void EventCallbackWrapper(const v8::Debug::EventDetails& event_details) {
5769 i::Isolate* isolate = i::Isolate::Current(); 5780 i::Isolate* isolate = i::Isolate::Current();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
5953 i::Isolate* isolate = i::Isolate::Current(); 5964 i::Isolate* isolate = i::Isolate::Current();
5954 if (!isolate->IsInitialized()) return Local<Value>(); 5965 if (!isolate->IsInitialized()) return Local<Value>();
5955 ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>()); 5966 ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>());
5956 ENTER_V8(isolate); 5967 ENTER_V8(isolate);
5957 v8::HandleScope scope; 5968 v8::HandleScope scope;
5958 i::Debug* isolate_debug = isolate->debug(); 5969 i::Debug* isolate_debug = isolate->debug();
5959 isolate_debug->Load(); 5970 isolate_debug->Load();
5960 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object()); 5971 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
5961 i::Handle<i::String> name = isolate->factory()->LookupOneByteSymbol( 5972 i::Handle<i::String> name = isolate->factory()->LookupOneByteSymbol(
5962 STATIC_ASCII_VECTOR("MakeMirror")); 5973 STATIC_ASCII_VECTOR("MakeMirror"));
5963 i::Handle<i::Object> fun_obj = i::GetProperty(debug, name); 5974 i::Handle<i::Object> fun_obj = i::GetProperty(isolate, debug, name);
5964 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj); 5975 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
5965 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun); 5976 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
5966 const int kArgc = 1; 5977 const int kArgc = 1;
5967 v8::Handle<v8::Value> argv[kArgc] = { obj }; 5978 v8::Handle<v8::Value> argv[kArgc] = { obj };
5968 EXCEPTION_PREAMBLE(isolate); 5979 EXCEPTION_PREAMBLE(isolate);
5969 v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug), 5980 v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug),
5970 kArgc, 5981 kArgc,
5971 argv); 5982 argv);
5972 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 5983 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
5973 return scope.Close(result); 5984 return scope.Close(result);
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
6704 6715
6705 v->VisitPointers(blocks_.first(), first_block_limit_); 6716 v->VisitPointers(blocks_.first(), first_block_limit_);
6706 6717
6707 for (int i = 1; i < blocks_.length(); i++) { 6718 for (int i = 1; i < blocks_.length(); i++) {
6708 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6719 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6709 } 6720 }
6710 } 6721 }
6711 6722
6712 6723
6713 } } // namespace v8::internal 6724 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | src/code-stubs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698