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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 void NeanderArray::set(int index, i::Object* value) { | 897 void NeanderArray::set(int index, i::Object* value) { |
898 if (index < 0 || index >= this->length()) return; | 898 if (index < 0 || index >= this->length()) return; |
899 obj_.set(index + 1, value); | 899 obj_.set(index + 1, value); |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 // --- T e m p l a t e --- | 903 // --- T e m p l a t e --- |
904 | 904 |
905 | 905 |
906 static void InitializeTemplate(i::Handle<i::TemplateInfo> that, int type) { | 906 static void InitializeTemplate(i::Handle<i::TemplateInfo> that, int type) { |
| 907 that->set_number_of_properties(0); |
907 that->set_tag(i::Smi::FromInt(type)); | 908 that->set_tag(i::Smi::FromInt(type)); |
908 } | 909 } |
909 | 910 |
910 | 911 |
911 void Template::Set(v8::Handle<Name> name, | 912 void Template::Set(v8::Handle<Name> name, |
912 v8::Handle<Data> value, | 913 v8::Handle<Data> value, |
913 v8::PropertyAttribute attribute) { | 914 v8::PropertyAttribute attribute) { |
914 auto templ = Utils::OpenHandle(this); | 915 auto templ = Utils::OpenHandle(this); |
915 i::Isolate* isolate = templ->GetIsolate(); | 916 i::Isolate* isolate = templ->GetIsolate(); |
916 ENTER_V8(isolate); | 917 ENTER_V8(isolate); |
(...skipping 22 matching lines...) Expand all Loading... |
939 i::ApiNatives::AddAccessorProperty( | 940 i::ApiNatives::AddAccessorProperty( |
940 isolate, templ, Utils::OpenHandle(*name), | 941 isolate, templ, Utils::OpenHandle(*name), |
941 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), | 942 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), |
942 static_cast<PropertyAttributes>(attribute)); | 943 static_cast<PropertyAttributes>(attribute)); |
943 } | 944 } |
944 | 945 |
945 | 946 |
946 // --- F u n c t i o n T e m p l a t e --- | 947 // --- F u n c t i o n T e m p l a t e --- |
947 static void InitializeFunctionTemplate( | 948 static void InitializeFunctionTemplate( |
948 i::Handle<i::FunctionTemplateInfo> info) { | 949 i::Handle<i::FunctionTemplateInfo> info) { |
949 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); | 950 InitializeTemplate(info, Consts::FUNCTION_TEMPLATE); |
950 info->set_flag(0); | 951 info->set_flag(0); |
951 } | 952 } |
952 | 953 |
953 | 954 |
954 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { | 955 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { |
955 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); | 956 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); |
956 ENTER_V8(i_isolate); | 957 ENTER_V8(i_isolate); |
957 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), | 958 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), |
958 i_isolate); | 959 i_isolate); |
959 if (result->IsUndefined()) { | 960 if (result->IsUndefined()) { |
(...skipping 7477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8437 Address callback_address = | 8438 Address callback_address = |
8438 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8439 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8439 VMState<EXTERNAL> state(isolate); | 8440 VMState<EXTERNAL> state(isolate); |
8440 ExternalCallbackScope call_scope(isolate, callback_address); | 8441 ExternalCallbackScope call_scope(isolate, callback_address); |
8441 callback(info); | 8442 callback(info); |
8442 } | 8443 } |
8443 | 8444 |
8444 | 8445 |
8445 } // namespace internal | 8446 } // namespace internal |
8446 } // namespace v8 | 8447 } // namespace v8 |
OLD | NEW |