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

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

Powered by Google App Engine
This is Rietveld 408576698