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

Side by Side Diff: src/api.cc

Issue 23819003: Handlify JSObject::SetAccessor method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/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 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 3582 matching lines...) Expand 10 before | Expand all | Expand 10 after
3593 PropertyAttribute attributes) { 3593 PropertyAttribute attributes) {
3594 i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate(); 3594 i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate();
3595 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false); 3595 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false);
3596 ENTER_V8(isolate); 3596 ENTER_V8(isolate);
3597 i::HandleScope scope(isolate); 3597 i::HandleScope scope(isolate);
3598 v8::Handle<AccessorSignature> signature; 3598 v8::Handle<AccessorSignature> signature;
3599 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( 3599 i::Handle<i::AccessorInfo> info = MakeAccessorInfo(
3600 name, getter, setter, data, settings, attributes, signature); 3600 name, getter, setter, data, settings, attributes, signature);
3601 if (info.is_null()) return false; 3601 if (info.is_null()) return false;
3602 bool fast = Utils::OpenHandle(obj)->HasFastProperties(); 3602 bool fast = Utils::OpenHandle(obj)->HasFastProperties();
3603 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(obj), info); 3603 i::Handle<i::Object> result =
3604 i::JSObject::SetAccessor(Utils::OpenHandle(obj), info);
3604 if (result.is_null() || result->IsUndefined()) return false; 3605 if (result.is_null() || result->IsUndefined()) return false;
3605 if (fast) i::JSObject::TransformToFastProperties(Utils::OpenHandle(obj), 0); 3606 if (fast) i::JSObject::TransformToFastProperties(Utils::OpenHandle(obj), 0);
3606 return true; 3607 return true;
3607 } 3608 }
3608 3609
3609 3610
3610 bool Object::SetAccessor(Handle<String> name, 3611 bool Object::SetAccessor(Handle<String> name,
3611 AccessorGetterCallback getter, 3612 AccessorGetterCallback getter,
3612 AccessorSetterCallback setter, 3613 AccessorSetterCallback setter,
3613 v8::Handle<Value> data, 3614 v8::Handle<Value> data,
(...skipping 4232 matching lines...) Expand 10 before | Expand all | Expand 10 after
7846 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7847 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7847 Address callback_address = 7848 Address callback_address =
7848 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7849 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7849 VMState<EXTERNAL> state(isolate); 7850 VMState<EXTERNAL> state(isolate);
7850 ExternalCallbackScope call_scope(isolate, callback_address); 7851 ExternalCallbackScope call_scope(isolate, callback_address);
7851 return callback(info); 7852 return callback(info);
7852 } 7853 }
7853 7854
7854 7855
7855 } } // namespace v8::internal 7856 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698