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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 TemplateSet(isolate, this, kSize, data); | 826 TemplateSet(isolate, this, kSize, data); |
827 } | 827 } |
828 | 828 |
829 | 829 |
830 void Template::SetAccessorProperty( | 830 void Template::SetAccessorProperty( |
831 v8::Local<v8::String> name, | 831 v8::Local<v8::String> name, |
832 v8::Local<FunctionTemplate> getter, | 832 v8::Local<FunctionTemplate> getter, |
833 v8::Local<FunctionTemplate> setter, | 833 v8::Local<FunctionTemplate> setter, |
834 v8::PropertyAttribute attribute, | 834 v8::PropertyAttribute attribute, |
835 v8::AccessControl access_control) { | 835 v8::AccessControl access_control) { |
| 836 // TODO(verwaest): Remove |access_control|. |
| 837 ASSERT_EQ(v8::DEFAULT, access_control); |
836 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 838 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
837 ENTER_V8(isolate); | 839 ENTER_V8(isolate); |
838 ASSERT(!name.IsEmpty()); | 840 ASSERT(!name.IsEmpty()); |
839 ASSERT(!getter.IsEmpty() || !setter.IsEmpty()); | 841 ASSERT(!getter.IsEmpty() || !setter.IsEmpty()); |
840 i::HandleScope scope(isolate); | 842 i::HandleScope scope(isolate); |
841 const int kSize = 5; | 843 const int kSize = 5; |
842 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 844 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
843 v8::Handle<v8::Data> data[kSize] = { | 845 v8::Handle<v8::Data> data[kSize] = { |
844 name, | 846 name, |
845 getter, | 847 getter, |
846 setter, | 848 setter, |
847 v8::Integer::New(v8_isolate, attribute), | 849 v8::Integer::New(v8_isolate, attribute)}; |
848 v8::Integer::New(v8_isolate, access_control)}; | |
849 TemplateSet(isolate, this, kSize, data); | 850 TemplateSet(isolate, this, kSize, data); |
850 } | 851 } |
851 | 852 |
852 | 853 |
853 // --- F u n c t i o n T e m p l a t e --- | 854 // --- F u n c t i o n T e m p l a t e --- |
854 static void InitializeFunctionTemplate( | 855 static void InitializeFunctionTemplate( |
855 i::Handle<i::FunctionTemplateInfo> info) { | 856 i::Handle<i::FunctionTemplateInfo> info) { |
856 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); | 857 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); |
857 info->set_flag(0); | 858 info->set_flag(0); |
858 } | 859 } |
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3430 return ObjectSetAccessor( | 3431 return ObjectSetAccessor( |
3431 this, name, descriptor, null, null, settings, attributes); | 3432 this, name, descriptor, null, null, settings, attributes); |
3432 } | 3433 } |
3433 | 3434 |
3434 | 3435 |
3435 void Object::SetAccessorProperty(Local<String> name, | 3436 void Object::SetAccessorProperty(Local<String> name, |
3436 Local<Function> getter, | 3437 Local<Function> getter, |
3437 Handle<Function> setter, | 3438 Handle<Function> setter, |
3438 PropertyAttribute attribute, | 3439 PropertyAttribute attribute, |
3439 AccessControl settings) { | 3440 AccessControl settings) { |
| 3441 // TODO(verwaest): Remove |settings|. |
| 3442 ASSERT_EQ(v8::DEFAULT, settings); |
3440 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3443 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3441 ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return); | 3444 ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return); |
3442 ENTER_V8(isolate); | 3445 ENTER_V8(isolate); |
3443 i::HandleScope scope(isolate); | 3446 i::HandleScope scope(isolate); |
3444 i::Handle<i::Object> getter_i = v8::Utils::OpenHandle(*getter); | 3447 i::Handle<i::Object> getter_i = v8::Utils::OpenHandle(*getter); |
3445 i::Handle<i::Object> setter_i = v8::Utils::OpenHandle(*setter, true); | 3448 i::Handle<i::Object> setter_i = v8::Utils::OpenHandle(*setter, true); |
3446 if (setter_i.is_null()) setter_i = isolate->factory()->null_value(); | 3449 if (setter_i.is_null()) setter_i = isolate->factory()->null_value(); |
3447 i::JSObject::DefineAccessor(v8::Utils::OpenHandle(this), | 3450 i::JSObject::DefineAccessor(v8::Utils::OpenHandle(this), |
3448 v8::Utils::OpenHandle(*name), | 3451 v8::Utils::OpenHandle(*name), |
3449 getter_i, | 3452 getter_i, |
3450 setter_i, | 3453 setter_i, |
3451 static_cast<PropertyAttributes>(attribute), | 3454 static_cast<PropertyAttributes>(attribute)); |
3452 settings); | |
3453 } | 3455 } |
3454 | 3456 |
3455 | 3457 |
3456 bool v8::Object::HasOwnProperty(Handle<String> key) { | 3458 bool v8::Object::HasOwnProperty(Handle<String> key) { |
3457 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3459 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3458 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()", | 3460 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()", |
3459 return false); | 3461 return false); |
3460 return i::JSReceiver::HasOwnProperty( | 3462 return i::JSReceiver::HasOwnProperty( |
3461 Utils::OpenHandle(this), Utils::OpenHandle(*key)); | 3463 Utils::OpenHandle(this), Utils::OpenHandle(*key)); |
3462 } | 3464 } |
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7599 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7601 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7600 Address callback_address = | 7602 Address callback_address = |
7601 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7603 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7602 VMState<EXTERNAL> state(isolate); | 7604 VMState<EXTERNAL> state(isolate); |
7603 ExternalCallbackScope call_scope(isolate, callback_address); | 7605 ExternalCallbackScope call_scope(isolate, callback_address); |
7604 callback(info); | 7606 callback(info); |
7605 } | 7607 } |
7606 | 7608 |
7607 | 7609 |
7608 } } // namespace v8::internal | 7610 } } // namespace v8::internal |
OLD | NEW |