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

Side by Side Diff: src/api.cc

Issue 234893003: Revert "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « no previous file | src/bootstrapper.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 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 1895
1896 v8::Local<Value> v8::TryCatch::StackTrace() const { 1896 v8::Local<Value> v8::TryCatch::StackTrace() const {
1897 ASSERT(isolate_ == i::Isolate::Current()); 1897 ASSERT(isolate_ == i::Isolate::Current());
1898 if (HasCaught()) { 1898 if (HasCaught()) {
1899 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_); 1899 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_);
1900 if (!raw_obj->IsJSObject()) return v8::Local<Value>(); 1900 if (!raw_obj->IsJSObject()) return v8::Local<Value>();
1901 i::HandleScope scope(isolate_); 1901 i::HandleScope scope(isolate_);
1902 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_); 1902 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
1903 i::Handle<i::String> name = isolate_->factory()->stack_string(); 1903 i::Handle<i::String> name = isolate_->factory()->stack_string();
1904 if (!i::JSReceiver::HasProperty(obj, name)) return v8::Local<Value>(); 1904 if (!i::JSReceiver::HasProperty(obj, name)) return v8::Local<Value>();
1905 i::Handle<i::Object> value; 1905 i::Handle<i::Object> value = i::Object::GetProperty(obj, name);
1906 if (!i::Object::GetProperty(obj, name).ToHandle(&value)) { 1906 if (value.is_null()) return v8::Local<Value>();
1907 return v8::Local<Value>();
1908 }
1909 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); 1907 return v8::Utils::ToLocal(scope.CloseAndEscape(value));
1910 } else { 1908 } else {
1911 return v8::Local<Value>(); 1909 return v8::Local<Value>();
1912 } 1910 }
1913 } 1911 }
1914 1912
1915 1913
1916 v8::Local<v8::Message> v8::TryCatch::Message() const { 1914 v8::Local<v8::Message> v8::TryCatch::Message() const {
1917 ASSERT(isolate_ == i::Isolate::Current()); 1915 ASSERT(isolate_ == i::Isolate::Current());
1918 i::Object* message = reinterpret_cast<i::Object*>(message_obj_); 1916 i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 1991
1994 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( 1992 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction(
1995 const char* name, 1993 const char* name,
1996 i::Handle<i::Object> recv, 1994 i::Handle<i::Object> recv,
1997 int argc, 1995 int argc,
1998 i::Handle<i::Object> argv[]) { 1996 i::Handle<i::Object> argv[]) {
1999 i::Isolate* isolate = i::Isolate::Current(); 1997 i::Isolate* isolate = i::Isolate::Current();
2000 i::Handle<i::String> fmt_str = 1998 i::Handle<i::String> fmt_str =
2001 isolate->factory()->InternalizeUtf8String(name); 1999 isolate->factory()->InternalizeUtf8String(name);
2002 i::Handle<i::Object> object_fun = 2000 i::Handle<i::Object> object_fun =
2003 i::Object::GetProperty( 2001 i::GlobalObject::GetPropertyNoExceptionThrown(
2004 isolate->js_builtins_object(), fmt_str).ToHandleChecked(); 2002 isolate->js_builtins_object(), fmt_str);
2005 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); 2003 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun);
2006 return i::Execution::Call(isolate, fun, recv, argc, argv); 2004 return i::Execution::Call(isolate, fun, recv, argc, argv);
2007 } 2005 }
2008 2006
2009 2007
2010 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( 2008 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction(
2011 const char* name, 2009 const char* name,
2012 i::Handle<i::Object> data) { 2010 i::Handle<i::Object> data) {
2013 i::Handle<i::Object> argv[] = { data }; 2011 i::Handle<i::Object> argv[] = { data };
2014 return CallV8HeapFunction(name, 2012 return CallV8HeapFunction(name,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 2122
2125 2123
2126 // --- S t a c k T r a c e --- 2124 // --- S t a c k T r a c e ---
2127 2125
2128 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { 2126 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
2129 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2127 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2130 ENTER_V8(isolate); 2128 ENTER_V8(isolate);
2131 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); 2129 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
2132 i::Handle<i::JSArray> self = Utils::OpenHandle(this); 2130 i::Handle<i::JSArray> self = Utils::OpenHandle(this);
2133 i::Handle<i::Object> obj = 2131 i::Handle<i::Object> obj =
2134 i::Object::GetElement(isolate, self, index).ToHandleChecked(); 2132 i::Object::GetElementNoExceptionThrown(isolate, self, index);
2135 i::Handle<i::JSObject> jsobj = i::Handle<i::JSObject>::cast(obj); 2133 i::Handle<i::JSObject> jsobj = i::Handle<i::JSObject>::cast(obj);
2136 return scope.Escape(Utils::StackFrameToLocal(jsobj)); 2134 return scope.Escape(Utils::StackFrameToLocal(jsobj));
2137 } 2135 }
2138 2136
2139 2137
2140 int StackTrace::GetFrameCount() const { 2138 int StackTrace::GetFrameCount() const {
2141 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2139 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2142 ENTER_V8(isolate); 2140 ENTER_V8(isolate);
2143 return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); 2141 return i::Smi::cast(Utils::OpenHandle(this)->length())->value();
2144 } 2142 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 i::Isolate* isolate = i::Isolate::Current(); 2437 i::Isolate* isolate = i::Isolate::Current();
2440 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2438 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2441 return obj->HasSpecificClassOf(isolate->heap()->Number_string()); 2439 return obj->HasSpecificClassOf(isolate->heap()->Number_string());
2442 } 2440 }
2443 2441
2444 2442
2445 static i::Object* LookupBuiltin(i::Isolate* isolate, 2443 static i::Object* LookupBuiltin(i::Isolate* isolate,
2446 const char* builtin_name) { 2444 const char* builtin_name) {
2447 i::Handle<i::String> string = 2445 i::Handle<i::String> string =
2448 isolate->factory()->InternalizeUtf8String(builtin_name); 2446 isolate->factory()->InternalizeUtf8String(builtin_name);
2449 return *i::Object::GetProperty( 2447 return *i::GlobalObject::GetPropertyNoExceptionThrown(
2450 isolate->js_builtins_object(), string).ToHandleChecked(); 2448 isolate->js_builtins_object(), string);
2451 } 2449 }
2452 2450
2453 2451
2454 static bool CheckConstructor(i::Isolate* isolate, 2452 static bool CheckConstructor(i::Isolate* isolate,
2455 i::Handle<i::JSObject> obj, 2453 i::Handle<i::JSObject> obj,
2456 const char* class_name) { 2454 const char* class_name) {
2457 i::Object* constr = obj->map()->constructor(); 2455 i::Object* constr = obj->map()->constructor();
2458 if (!constr->IsJSFunction()) return false; 2456 if (!constr->IsJSFunction()) return false;
2459 i::JSFunction* func = i::JSFunction::cast(constr); 2457 i::JSFunction* func = i::JSFunction::cast(constr);
2460 return func->shared()->native() && 2458 return func->shared()->native() &&
(...skipping 4492 matching lines...) Expand 10 before | Expand all | Expand 10 after
6953 v8::EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); 6951 v8::EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
6954 i::Debug* isolate_debug = isolate->debug(); 6952 i::Debug* isolate_debug = isolate->debug();
6955 EXCEPTION_PREAMBLE(isolate); 6953 EXCEPTION_PREAMBLE(isolate);
6956 has_pending_exception = !isolate_debug->Load(); 6954 has_pending_exception = !isolate_debug->Load();
6957 v8::Local<v8::Value> result; 6955 v8::Local<v8::Value> result;
6958 if (!has_pending_exception) { 6956 if (!has_pending_exception) {
6959 i::Handle<i::JSObject> debug( 6957 i::Handle<i::JSObject> debug(
6960 isolate_debug->debug_context()->global_object()); 6958 isolate_debug->debug_context()->global_object());
6961 i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString( 6959 i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString(
6962 STATIC_ASCII_VECTOR("MakeMirror")); 6960 STATIC_ASCII_VECTOR("MakeMirror"));
6963 i::Handle<i::Object> fun_obj = 6961 i::Handle<i::Object> fun_obj = i::Object::GetProperty(debug, name);
6964 i::Object::GetProperty(debug, name).ToHandleChecked(); 6962 ASSERT(!fun_obj.is_null());
6965 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj); 6963 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
6966 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun); 6964 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
6967 const int kArgc = 1; 6965 const int kArgc = 1;
6968 v8::Handle<v8::Value> argv[kArgc] = { obj }; 6966 v8::Handle<v8::Value> argv[kArgc] = { obj };
6969 result = v8_fun->Call(Utils::ToLocal(debug), kArgc, argv); 6967 result = v8_fun->Call(Utils::ToLocal(debug), kArgc, argv);
6970 has_pending_exception = result.IsEmpty(); 6968 has_pending_exception = result.IsEmpty();
6971 } 6969 }
6972 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 6970 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
6973 return scope.Escape(result); 6971 return scope.Escape(result);
6974 } 6972 }
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
7650 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7648 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7651 Address callback_address = 7649 Address callback_address =
7652 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7650 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7653 VMState<EXTERNAL> state(isolate); 7651 VMState<EXTERNAL> state(isolate);
7654 ExternalCallbackScope call_scope(isolate, callback_address); 7652 ExternalCallbackScope call_scope(isolate, callback_address);
7655 callback(info); 7653 callback(info);
7656 } 7654 }
7657 7655
7658 7656
7659 } } // namespace v8::internal 7657 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698