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

Side by Side Diff: src/api.cc

Issue 12716010: Added a version of the v8::HandleScope constructor with an Isolate and use that consistently. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed rest Created 7 years, 9 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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 ASSERT(isolate == i::Isolate::Current()); 659 ASSERT(isolate == i::Isolate::Current());
660 LOG_API(isolate, "DisposeGlobal"); 660 LOG_API(isolate, "DisposeGlobal");
661 if (!isolate->IsInitialized()) return; 661 if (!isolate->IsInitialized()) return;
662 isolate->global_handles()->Destroy(obj); 662 isolate->global_handles()->Destroy(obj);
663 } 663 }
664 664
665 // --- H a n d l e s --- 665 // --- H a n d l e s ---
666 666
667 667
668 HandleScope::HandleScope() { 668 HandleScope::HandleScope() {
669 i::Isolate* isolate = i::Isolate::Current(); 669 Initialize(reinterpret_cast<Isolate*>(i::Isolate::Current()));
670 API_ENTRY_CHECK(isolate, "HandleScope::HandleScope"); 670 }
671
672
673 HandleScope::HandleScope(Isolate* isolate) {
674 Initialize(isolate);
675 }
676
677
678 void HandleScope::Initialize(Isolate* isolate) {
679 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
680 API_ENTRY_CHECK(internal_isolate, "HandleScope::HandleScope");
671 v8::ImplementationUtilities::HandleScopeData* current = 681 v8::ImplementationUtilities::HandleScopeData* current =
672 isolate->handle_scope_data(); 682 internal_isolate->handle_scope_data();
673 isolate_ = isolate; 683 isolate_ = internal_isolate;
674 prev_next_ = current->next; 684 prev_next_ = current->next;
675 prev_limit_ = current->limit; 685 prev_limit_ = current->limit;
676 is_closed_ = false; 686 is_closed_ = false;
677 current->level++; 687 current->level++;
678 } 688 }
679 689
680 690
681 HandleScope::~HandleScope() { 691 HandleScope::~HandleScope() {
682 if (!is_closed_) { 692 if (!is_closed_) {
683 Leave(); 693 Leave();
684 } 694 }
685 } 695 }
686 696
687 697
688 void HandleScope::Leave() { 698 void HandleScope::Leave() {
689 ASSERT(isolate_ == i::Isolate::Current());
690 v8::ImplementationUtilities::HandleScopeData* current = 699 v8::ImplementationUtilities::HandleScopeData* current =
691 isolate_->handle_scope_data(); 700 isolate_->handle_scope_data();
692 current->level--; 701 current->level--;
693 ASSERT(current->level >= 0); 702 ASSERT(current->level >= 0);
694 current->next = prev_next_; 703 current->next = prev_next_;
695 if (current->limit != prev_limit_) { 704 if (current->limit != prev_limit_) {
696 current->limit = prev_limit_; 705 current->limit = prev_limit_;
697 i::HandleScope::DeleteExtensions(isolate_); 706 i::HandleScope::DeleteExtensions(isolate_);
698 } 707 }
699 708
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 can_continue_(true), 1886 can_continue_(true),
1878 capture_message_(true), 1887 capture_message_(true),
1879 rethrow_(false) { 1888 rethrow_(false) {
1880 isolate_->RegisterTryCatchHandler(this); 1889 isolate_->RegisterTryCatchHandler(this);
1881 } 1890 }
1882 1891
1883 1892
1884 v8::TryCatch::~TryCatch() { 1893 v8::TryCatch::~TryCatch() {
1885 ASSERT(isolate_ == i::Isolate::Current()); 1894 ASSERT(isolate_ == i::Isolate::Current());
1886 if (rethrow_) { 1895 if (rethrow_) {
1887 v8::HandleScope scope; 1896 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_));
1888 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); 1897 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
1889 isolate_->UnregisterTryCatchHandler(this); 1898 isolate_->UnregisterTryCatchHandler(this);
1890 v8::ThrowException(exc); 1899 v8::ThrowException(exc);
1891 } else { 1900 } else {
1892 isolate_->UnregisterTryCatchHandler(this); 1901 isolate_->UnregisterTryCatchHandler(this);
1893 } 1902 }
1894 } 1903 }
1895 1904
1896 1905
1897 bool v8::TryCatch::HasCaught() const { 1906 bool v8::TryCatch::HasCaught() const {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 } 1978 }
1970 1979
1971 1980
1972 // --- M e s s a g e --- 1981 // --- M e s s a g e ---
1973 1982
1974 1983
1975 Local<String> Message::Get() const { 1984 Local<String> Message::Get() const {
1976 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1985 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1977 ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>()); 1986 ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>());
1978 ENTER_V8(isolate); 1987 ENTER_V8(isolate);
1979 HandleScope scope; 1988 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
1980 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1989 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1981 i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate, obj); 1990 i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate, obj);
1982 Local<String> result = Utils::ToLocal(raw_result); 1991 Local<String> result = Utils::ToLocal(raw_result);
1983 return scope.Close(result); 1992 return scope.Close(result);
1984 } 1993 }
1985 1994
1986 1995
1987 v8::Handle<Value> Message::GetScriptResourceName() const { 1996 v8::Handle<Value> Message::GetScriptResourceName() const {
1988 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1997 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1989 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceName()")) { 1998 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceName()")) {
1990 return Local<String>(); 1999 return Local<String>();
1991 } 2000 }
1992 ENTER_V8(isolate); 2001 ENTER_V8(isolate);
1993 HandleScope scope; 2002 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
1994 i::Handle<i::JSMessageObject> message = 2003 i::Handle<i::JSMessageObject> message =
1995 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 2004 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1996 // Return this.script.name. 2005 // Return this.script.name.
1997 i::Handle<i::JSValue> script = 2006 i::Handle<i::JSValue> script =
1998 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), 2007 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
1999 isolate)); 2008 isolate));
2000 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name(), 2009 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name(),
2001 isolate); 2010 isolate);
2002 return scope.Close(Utils::ToLocal(resource_name)); 2011 return scope.Close(Utils::ToLocal(resource_name));
2003 } 2012 }
2004 2013
2005 2014
2006 v8::Handle<Value> Message::GetScriptData() const { 2015 v8::Handle<Value> Message::GetScriptData() const {
2007 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2016 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2008 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceData()")) { 2017 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceData()")) {
2009 return Local<Value>(); 2018 return Local<Value>();
2010 } 2019 }
2011 ENTER_V8(isolate); 2020 ENTER_V8(isolate);
2012 HandleScope scope; 2021 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2013 i::Handle<i::JSMessageObject> message = 2022 i::Handle<i::JSMessageObject> message =
2014 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 2023 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
2015 // Return this.script.data. 2024 // Return this.script.data.
2016 i::Handle<i::JSValue> script = 2025 i::Handle<i::JSValue> script =
2017 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), 2026 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
2018 isolate)); 2027 isolate));
2019 i::Handle<i::Object> data(i::Script::cast(script->value())->data(), isolate); 2028 i::Handle<i::Object> data(i::Script::cast(script->value())->data(), isolate);
2020 return scope.Close(Utils::ToLocal(data)); 2029 return scope.Close(Utils::ToLocal(data));
2021 } 2030 }
2022 2031
2023 2032
2024 v8::Handle<v8::StackTrace> Message::GetStackTrace() const { 2033 v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
2025 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2034 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2026 if (IsDeadCheck(isolate, "v8::Message::GetStackTrace()")) { 2035 if (IsDeadCheck(isolate, "v8::Message::GetStackTrace()")) {
2027 return Local<v8::StackTrace>(); 2036 return Local<v8::StackTrace>();
2028 } 2037 }
2029 ENTER_V8(isolate); 2038 ENTER_V8(isolate);
2030 HandleScope scope; 2039 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2031 i::Handle<i::JSMessageObject> message = 2040 i::Handle<i::JSMessageObject> message =
2032 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 2041 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
2033 i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate); 2042 i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate);
2034 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); 2043 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
2035 i::Handle<i::JSArray> stackTrace = 2044 i::Handle<i::JSArray> stackTrace =
2036 i::Handle<i::JSArray>::cast(stackFramesObj); 2045 i::Handle<i::JSArray>::cast(stackFramesObj);
2037 return scope.Close(Utils::StackTraceToLocal(stackTrace)); 2046 return scope.Close(Utils::StackTraceToLocal(stackTrace));
2038 } 2047 }
2039 2048
2040 2049
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 int start = message->start_position(); 2149 int start = message->start_position();
2141 int end = message->end_position(); 2150 int end = message->end_position();
2142 return static_cast<int>(start_col_obj->Number()) + (end - start); 2151 return static_cast<int>(start_col_obj->Number()) + (end - start);
2143 } 2152 }
2144 2153
2145 2154
2146 Local<String> Message::GetSourceLine() const { 2155 Local<String> Message::GetSourceLine() const {
2147 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2156 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2148 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); 2157 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>());
2149 ENTER_V8(isolate); 2158 ENTER_V8(isolate);
2150 HandleScope scope; 2159 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2151 EXCEPTION_PREAMBLE(isolate); 2160 EXCEPTION_PREAMBLE(isolate);
2152 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", 2161 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
2153 Utils::OpenHandle(this), 2162 Utils::OpenHandle(this),
2154 &has_pending_exception); 2163 &has_pending_exception);
2155 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); 2164 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>());
2156 if (result->IsString()) { 2165 if (result->IsString()) {
2157 return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result))); 2166 return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result)));
2158 } else { 2167 } else {
2159 return Local<String>(); 2168 return Local<String>();
2160 } 2169 }
2161 } 2170 }
2162 2171
2163 2172
2164 void Message::PrintCurrentStackTrace(FILE* out) { 2173 void Message::PrintCurrentStackTrace(FILE* out) {
2165 i::Isolate* isolate = i::Isolate::Current(); 2174 i::Isolate* isolate = i::Isolate::Current();
2166 if (IsDeadCheck(isolate, "v8::Message::PrintCurrentStackTrace()")) return; 2175 if (IsDeadCheck(isolate, "v8::Message::PrintCurrentStackTrace()")) return;
2167 ENTER_V8(isolate); 2176 ENTER_V8(isolate);
2168 isolate->PrintCurrentStackTrace(out); 2177 isolate->PrintCurrentStackTrace(out);
2169 } 2178 }
2170 2179
2171 2180
2172 // --- S t a c k T r a c e --- 2181 // --- S t a c k T r a c e ---
2173 2182
2174 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { 2183 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
2175 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2184 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2176 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrame()")) { 2185 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrame()")) {
2177 return Local<StackFrame>(); 2186 return Local<StackFrame>();
2178 } 2187 }
2179 ENTER_V8(isolate); 2188 ENTER_V8(isolate);
2180 HandleScope scope; 2189 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2181 i::Handle<i::JSArray> self = Utils::OpenHandle(this); 2190 i::Handle<i::JSArray> self = Utils::OpenHandle(this);
2182 i::Object* raw_object = self->GetElementNoExceptionThrown(index); 2191 i::Object* raw_object = self->GetElementNoExceptionThrown(index);
2183 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object)); 2192 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
2184 return scope.Close(Utils::StackFrameToLocal(obj)); 2193 return scope.Close(Utils::StackFrameToLocal(obj));
2185 } 2194 }
2186 2195
2187 2196
2188 int StackTrace::GetFrameCount() const { 2197 int StackTrace::GetFrameCount() const {
2189 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2198 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2190 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrameCount()")) return -1; 2199 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrameCount()")) return -1;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 return i::Smi::cast(*column)->value(); 2256 return i::Smi::cast(*column)->value();
2248 } 2257 }
2249 2258
2250 2259
2251 Local<String> StackFrame::GetScriptName() const { 2260 Local<String> StackFrame::GetScriptName() const {
2252 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2261 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2253 if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptName()")) { 2262 if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptName()")) {
2254 return Local<String>(); 2263 return Local<String>();
2255 } 2264 }
2256 ENTER_V8(isolate); 2265 ENTER_V8(isolate);
2257 HandleScope scope; 2266 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2258 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2267 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2259 i::Handle<i::Object> name = GetProperty(self, "scriptName"); 2268 i::Handle<i::Object> name = GetProperty(self, "scriptName");
2260 if (!name->IsString()) { 2269 if (!name->IsString()) {
2261 return Local<String>(); 2270 return Local<String>();
2262 } 2271 }
2263 return scope.Close(Local<String>::Cast(Utils::ToLocal(name))); 2272 return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
2264 } 2273 }
2265 2274
2266 2275
2267 Local<String> StackFrame::GetScriptNameOrSourceURL() const { 2276 Local<String> StackFrame::GetScriptNameOrSourceURL() const {
2268 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2277 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2269 if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptNameOrSourceURL()")) { 2278 if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptNameOrSourceURL()")) {
2270 return Local<String>(); 2279 return Local<String>();
2271 } 2280 }
2272 ENTER_V8(isolate); 2281 ENTER_V8(isolate);
2273 HandleScope scope; 2282 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2274 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2283 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2275 i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL"); 2284 i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL");
2276 if (!name->IsString()) { 2285 if (!name->IsString()) {
2277 return Local<String>(); 2286 return Local<String>();
2278 } 2287 }
2279 return scope.Close(Local<String>::Cast(Utils::ToLocal(name))); 2288 return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
2280 } 2289 }
2281 2290
2282 2291
2283 Local<String> StackFrame::GetFunctionName() const { 2292 Local<String> StackFrame::GetFunctionName() const {
2284 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2293 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2285 if (IsDeadCheck(isolate, "v8::StackFrame::GetFunctionName()")) { 2294 if (IsDeadCheck(isolate, "v8::StackFrame::GetFunctionName()")) {
2286 return Local<String>(); 2295 return Local<String>();
2287 } 2296 }
2288 ENTER_V8(isolate); 2297 ENTER_V8(isolate);
2289 HandleScope scope; 2298 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
2290 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2299 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2291 i::Handle<i::Object> name = GetProperty(self, "functionName"); 2300 i::Handle<i::Object> name = GetProperty(self, "functionName");
2292 if (!name->IsString()) { 2301 if (!name->IsString()) {
2293 return Local<String>(); 2302 return Local<String>();
2294 } 2303 }
2295 return scope.Close(Local<String>::Cast(Utils::ToLocal(name))); 2304 return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
2296 } 2305 }
2297 2306
2298 2307
2299 bool StackFrame::IsEval() const { 2308 bool StackFrame::IsEval() const {
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 3282 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3274 return self->HasProperty(*key_obj); 3283 return self->HasProperty(*key_obj);
3275 } 3284 }
3276 3285
3277 3286
3278 bool v8::Object::Delete(uint32_t index) { 3287 bool v8::Object::Delete(uint32_t index) {
3279 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3288 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3280 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", 3289 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()",
3281 return false); 3290 return false);
3282 ENTER_V8(isolate); 3291 ENTER_V8(isolate);
3283 HandleScope scope; 3292 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
3284 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3293 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3285 return i::JSObject::DeleteElement(self, index)->IsTrue(); 3294 return i::JSObject::DeleteElement(self, index)->IsTrue();
3286 } 3295 }
3287 3296
3288 3297
3289 bool v8::Object::Has(uint32_t index) { 3298 bool v8::Object::Has(uint32_t index) {
3290 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3299 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3291 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false); 3300 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false);
3292 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3301 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3293 return self->HasElement(index); 3302 return self->HasElement(index);
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 3860
3852 Local<v8::Object> Function::NewInstance(int argc, 3861 Local<v8::Object> Function::NewInstance(int argc,
3853 v8::Handle<v8::Value> argv[]) const { 3862 v8::Handle<v8::Value> argv[]) const {
3854 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3863 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3855 ON_BAILOUT(isolate, "v8::Function::NewInstance()", 3864 ON_BAILOUT(isolate, "v8::Function::NewInstance()",
3856 return Local<v8::Object>()); 3865 return Local<v8::Object>());
3857 LOG_API(isolate, "Function::NewInstance"); 3866 LOG_API(isolate, "Function::NewInstance");
3858 ENTER_V8(isolate); 3867 ENTER_V8(isolate);
3859 i::Logger::TimerEventScope timer_scope( 3868 i::Logger::TimerEventScope timer_scope(
3860 isolate, i::Logger::TimerEventScope::v8_execute); 3869 isolate, i::Logger::TimerEventScope::v8_execute);
3861 HandleScope scope; 3870 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
3862 i::Handle<i::JSFunction> function = Utils::OpenHandle(this); 3871 i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
3863 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3872 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3864 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 3873 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
3865 EXCEPTION_PREAMBLE(isolate); 3874 EXCEPTION_PREAMBLE(isolate);
3866 i::Handle<i::Object> returned = 3875 i::Handle<i::Object> returned =
3867 i::Execution::New(function, argc, args, &has_pending_exception); 3876 i::Execution::New(function, argc, args, &has_pending_exception);
3868 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); 3877 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
3869 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); 3878 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
3870 } 3879 }
3871 3880
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after
6307 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 6316 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
6308 return Utils::ToLocal(result); 6317 return Utils::ToLocal(result);
6309 } 6318 }
6310 6319
6311 6320
6312 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { 6321 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
6313 i::Isolate* isolate = i::Isolate::Current(); 6322 i::Isolate* isolate = i::Isolate::Current();
6314 if (!isolate->IsInitialized()) return Local<Value>(); 6323 if (!isolate->IsInitialized()) return Local<Value>();
6315 ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>()); 6324 ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>());
6316 ENTER_V8(isolate); 6325 ENTER_V8(isolate);
6317 v8::HandleScope scope; 6326 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate));
6318 i::Debug* isolate_debug = isolate->debug(); 6327 i::Debug* isolate_debug = isolate->debug();
6319 isolate_debug->Load(); 6328 isolate_debug->Load();
6320 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object()); 6329 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
6321 i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString( 6330 i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString(
6322 STATIC_ASCII_VECTOR("MakeMirror")); 6331 STATIC_ASCII_VECTOR("MakeMirror"));
6323 i::Handle<i::Object> fun_obj = i::GetProperty(isolate, debug, name); 6332 i::Handle<i::Object> fun_obj = i::GetProperty(isolate, debug, name);
6324 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj); 6333 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
6325 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun); 6334 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
6326 const int kArgc = 1; 6335 const int kArgc = 1;
6327 v8::Handle<v8::Value> argv[kArgc] = { obj }; 6336 v8::Handle<v8::Value> argv[kArgc] = { obj };
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
7064 7073
7065 v->VisitPointers(blocks_.first(), first_block_limit_); 7074 v->VisitPointers(blocks_.first(), first_block_limit_);
7066 7075
7067 for (int i = 1; i < blocks_.length(); i++) { 7076 for (int i = 1; i < blocks_.length(); i++) {
7068 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7077 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7069 } 7078 }
7070 } 7079 }
7071 7080
7072 7081
7073 } } // namespace v8::internal 7082 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698