| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| (...skipping 3618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( | 3629 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( |
| 3630 name, getter, setter, data, settings, attributes, signature); | 3630 name, getter, setter, data, settings, attributes, signature); |
| 3631 if (info.is_null()) return false; | 3631 if (info.is_null()) return false; |
| 3632 bool fast = Utils::OpenHandle(obj)->HasFastProperties(); | 3632 bool fast = Utils::OpenHandle(obj)->HasFastProperties(); |
| 3633 i::Handle<i::Object> result; | 3633 i::Handle<i::Object> result; |
| 3634 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 3634 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 3635 isolate, result, | 3635 isolate, result, |
| 3636 i::JSObject::SetAccessor(Utils::OpenHandle(obj), info), | 3636 i::JSObject::SetAccessor(Utils::OpenHandle(obj), info), |
| 3637 false); | 3637 false); |
| 3638 if (result->IsUndefined()) return false; | 3638 if (result->IsUndefined()) return false; |
| 3639 if (fast) i::JSObject::MigrateSlowToFast(Utils::OpenHandle(obj), 0); | 3639 if (fast) { |
| 3640 i::JSObject::MigrateSlowToFast(Utils::OpenHandle(obj), 0, "APISetAccessor"); |
| 3641 } |
| 3640 return true; | 3642 return true; |
| 3641 } | 3643 } |
| 3642 | 3644 |
| 3643 | 3645 |
| 3644 bool Object::SetAccessor(Handle<String> name, | 3646 bool Object::SetAccessor(Handle<String> name, |
| 3645 AccessorGetterCallback getter, | 3647 AccessorGetterCallback getter, |
| 3646 AccessorSetterCallback setter, | 3648 AccessorSetterCallback setter, |
| 3647 v8::Handle<Value> data, | 3649 v8::Handle<Value> data, |
| 3648 AccessControl settings, | 3650 AccessControl settings, |
| 3649 PropertyAttribute attributes) { | 3651 PropertyAttribute attributes) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3815 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3817 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3816 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); | 3818 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); |
| 3817 ENTER_V8(isolate); | 3819 ENTER_V8(isolate); |
| 3818 i::HandleScope scope(isolate); | 3820 i::HandleScope scope(isolate); |
| 3819 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 3821 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 3820 | 3822 |
| 3821 // When turning on access checks for a global object deoptimize all functions | 3823 // When turning on access checks for a global object deoptimize all functions |
| 3822 // as optimized code does not always handle access checks. | 3824 // as optimized code does not always handle access checks. |
| 3823 i::Deoptimizer::DeoptimizeGlobalObject(*obj); | 3825 i::Deoptimizer::DeoptimizeGlobalObject(*obj); |
| 3824 | 3826 |
| 3825 i::Handle<i::Map> new_map = i::Map::Copy(i::Handle<i::Map>(obj->map())); | 3827 i::Handle<i::Map> new_map = |
| 3828 i::Map::Copy(i::Handle<i::Map>(obj->map()), "APITurnOnAccessCheck"); |
| 3826 new_map->set_is_access_check_needed(true); | 3829 new_map->set_is_access_check_needed(true); |
| 3827 i::JSObject::MigrateToMap(obj, new_map); | 3830 i::JSObject::MigrateToMap(obj, new_map); |
| 3828 } | 3831 } |
| 3829 | 3832 |
| 3830 | 3833 |
| 3831 Local<v8::Object> v8::Object::Clone() { | 3834 Local<v8::Object> v8::Object::Clone() { |
| 3832 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3835 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3833 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>()); | 3836 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>()); |
| 3834 ENTER_V8(isolate); | 3837 ENTER_V8(isolate); |
| 3835 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3838 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| (...skipping 3948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7784 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7787 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7785 Address callback_address = | 7788 Address callback_address = |
| 7786 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7789 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7787 VMState<EXTERNAL> state(isolate); | 7790 VMState<EXTERNAL> state(isolate); |
| 7788 ExternalCallbackScope call_scope(isolate, callback_address); | 7791 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7789 callback(info); | 7792 callback(info); |
| 7790 } | 7793 } |
| 7791 | 7794 |
| 7792 | 7795 |
| 7793 } } // namespace v8::internal | 7796 } } // namespace v8::internal |
| OLD | NEW |