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

Side by Side Diff: src/api.cc

Issue 598020: Refactor prototype setting code and expose SetPrototype to public V8 API. (Closed)
Patch Set: Next round of Mad's comments Created 10 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
« no previous file with comments | « src/accessors.cc ('k') | src/handles.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 2025
2026 Local<Value> v8::Object::GetPrototype() { 2026 Local<Value> v8::Object::GetPrototype() {
2027 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>()); 2027 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>());
2028 ENTER_V8; 2028 ENTER_V8;
2029 i::Handle<i::Object> self = Utils::OpenHandle(this); 2029 i::Handle<i::Object> self = Utils::OpenHandle(this);
2030 i::Handle<i::Object> result = i::GetPrototype(self); 2030 i::Handle<i::Object> result = i::GetPrototype(self);
2031 return Utils::ToLocal(result); 2031 return Utils::ToLocal(result);
2032 } 2032 }
2033 2033
2034 2034
2035 bool v8::Object::SetPrototype(Handle<Value> value) {
2036 ON_BAILOUT("v8::Object::SetPrototype()", return false);
2037 ENTER_V8;
2038 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2039 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2040 EXCEPTION_PREAMBLE();
2041 i::Handle<i::Object> result = i::SetPrototype(self, value_obj);
2042 has_pending_exception = result.is_null();
2043 EXCEPTION_BAILOUT_CHECK(false);
2044 return true;
2045 }
2046
2047
2035 Local<Object> v8::Object::FindInstanceInPrototypeChain( 2048 Local<Object> v8::Object::FindInstanceInPrototypeChain(
2036 v8::Handle<FunctionTemplate> tmpl) { 2049 v8::Handle<FunctionTemplate> tmpl) {
2037 ON_BAILOUT("v8::Object::FindInstanceInPrototypeChain()", 2050 ON_BAILOUT("v8::Object::FindInstanceInPrototypeChain()",
2038 return Local<v8::Object>()); 2051 return Local<v8::Object>());
2039 ENTER_V8; 2052 ENTER_V8;
2040 i::JSObject* object = *Utils::OpenHandle(this); 2053 i::JSObject* object = *Utils::OpenHandle(this);
2041 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); 2054 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
2042 while (!object->IsInstanceOf(tmpl_info)) { 2055 while (!object->IsInstanceOf(tmpl_info)) {
2043 i::Object* prototype = object->GetPrototype(); 2056 i::Object* prototype = object->GetPrototype();
2044 if (!prototype->IsJSObject()) return Local<Object>(); 2057 if (!prototype->IsJSObject()) return Local<Object>();
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after
3826 3839
3827 3840
3828 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 3841 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3829 HandleScopeImplementer* thread_local = 3842 HandleScopeImplementer* thread_local =
3830 reinterpret_cast<HandleScopeImplementer*>(storage); 3843 reinterpret_cast<HandleScopeImplementer*>(storage);
3831 thread_local->IterateThis(v); 3844 thread_local->IterateThis(v);
3832 return storage + ArchiveSpacePerThread(); 3845 return storage + ArchiveSpacePerThread();
3833 } 3846 }
3834 3847
3835 } } // namespace v8::internal 3848 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698