OLD | NEW |
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 3380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3391 PropertyAttribute attributes) { | 3391 PropertyAttribute attributes) { |
3392 i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate(); | 3392 i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate(); |
3393 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false); | 3393 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false); |
3394 ENTER_V8(isolate); | 3394 ENTER_V8(isolate); |
3395 i::HandleScope scope(isolate); | 3395 i::HandleScope scope(isolate); |
3396 v8::Handle<AccessorSignature> signature; | 3396 v8::Handle<AccessorSignature> signature; |
3397 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( | 3397 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( |
3398 name, getter, setter, data, settings, attributes, signature); | 3398 name, getter, setter, data, settings, attributes, signature); |
3399 if (info.is_null()) return false; | 3399 if (info.is_null()) return false; |
3400 bool fast = Utils::OpenHandle(obj)->HasFastProperties(); | 3400 bool fast = Utils::OpenHandle(obj)->HasFastProperties(); |
3401 i::Handle<i::Object> result = | 3401 i::Handle<i::Object> result; |
3402 i::JSObject::SetAccessor(Utils::OpenHandle(obj), info); | 3402 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
3403 if (result.is_null() || result->IsUndefined()) return false; | 3403 isolate, result, |
| 3404 i::JSObject::SetAccessor(Utils::OpenHandle(obj), info), |
| 3405 false); |
| 3406 if (result->IsUndefined()) return false; |
3404 if (fast) i::JSObject::TransformToFastProperties(Utils::OpenHandle(obj), 0); | 3407 if (fast) i::JSObject::TransformToFastProperties(Utils::OpenHandle(obj), 0); |
3405 return true; | 3408 return true; |
3406 } | 3409 } |
3407 | 3410 |
3408 | 3411 |
3409 bool Object::SetAccessor(Handle<String> name, | 3412 bool Object::SetAccessor(Handle<String> name, |
3410 AccessorGetterCallback getter, | 3413 AccessorGetterCallback getter, |
3411 AccessorSetterCallback setter, | 3414 AccessorSetterCallback setter, |
3412 v8::Handle<Value> data, | 3415 v8::Handle<Value> data, |
3413 AccessControl settings, | 3416 AccessControl settings, |
(...skipping 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7609 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7612 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7610 Address callback_address = | 7613 Address callback_address = |
7611 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7614 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7612 VMState<EXTERNAL> state(isolate); | 7615 VMState<EXTERNAL> state(isolate); |
7613 ExternalCallbackScope call_scope(isolate, callback_address); | 7616 ExternalCallbackScope call_scope(isolate, callback_address); |
7614 callback(info); | 7617 callback(info); |
7615 } | 7618 } |
7616 | 7619 |
7617 | 7620 |
7618 } } // namespace v8::internal | 7621 } } // namespace v8::internal |
OLD | NEW |