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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 936 |
937 // --- F u n c t i o n T e m p l a t e --- | 937 // --- F u n c t i o n T e m p l a t e --- |
938 static void InitializeFunctionTemplate( | 938 static void InitializeFunctionTemplate( |
939 i::Handle<i::FunctionTemplateInfo> info) { | 939 i::Handle<i::FunctionTemplateInfo> info) { |
940 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); | 940 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); |
941 info->set_flag(0); | 941 info->set_flag(0); |
942 } | 942 } |
943 | 943 |
944 | 944 |
945 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { | 945 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { |
946 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 946 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); |
947 ENTER_V8(isolate); | 947 ENTER_V8(i_isolate); |
948 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), | 948 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), |
949 isolate); | 949 i_isolate); |
950 if (result->IsUndefined()) { | 950 if (result->IsUndefined()) { |
951 result = Utils::OpenHandle(*ObjectTemplate::New()); | 951 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(i_isolate); |
| 952 result = Utils::OpenHandle(*ObjectTemplate::New(isolate)); |
952 Utils::OpenHandle(this)->set_prototype_template(*result); | 953 Utils::OpenHandle(this)->set_prototype_template(*result); |
953 } | 954 } |
954 return ToApiHandle<ObjectTemplate>(result); | 955 return ToApiHandle<ObjectTemplate>(result); |
955 } | 956 } |
956 | 957 |
957 | 958 |
958 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { | 959 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { |
959 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 960 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
960 ENTER_V8(isolate); | 961 ENTER_V8(isolate); |
961 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value)); | 962 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value)); |
(...skipping 4179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5141 ENTER_V8(isolate); | 5142 ENTER_V8(isolate); |
5142 v8::Handle<ObjectTemplate> proxy_template = global_template; | 5143 v8::Handle<ObjectTemplate> proxy_template = global_template; |
5143 i::Handle<i::FunctionTemplateInfo> proxy_constructor; | 5144 i::Handle<i::FunctionTemplateInfo> proxy_constructor; |
5144 i::Handle<i::FunctionTemplateInfo> global_constructor; | 5145 i::Handle<i::FunctionTemplateInfo> global_constructor; |
5145 | 5146 |
5146 if (!global_template.IsEmpty()) { | 5147 if (!global_template.IsEmpty()) { |
5147 // Make sure that the global_template has a constructor. | 5148 // Make sure that the global_template has a constructor. |
5148 global_constructor = EnsureConstructor(isolate, *global_template); | 5149 global_constructor = EnsureConstructor(isolate, *global_template); |
5149 | 5150 |
5150 // Create a fresh template for the global proxy object. | 5151 // Create a fresh template for the global proxy object. |
5151 proxy_template = ObjectTemplate::New(); | 5152 proxy_template = ObjectTemplate::New( |
| 5153 reinterpret_cast<v8::Isolate*>(isolate)); |
5152 proxy_constructor = EnsureConstructor(isolate, *proxy_template); | 5154 proxy_constructor = EnsureConstructor(isolate, *proxy_template); |
5153 | 5155 |
5154 // Set the global template to be the prototype template of | 5156 // Set the global template to be the prototype template of |
5155 // global proxy template. | 5157 // global proxy template. |
5156 proxy_constructor->set_prototype_template( | 5158 proxy_constructor->set_prototype_template( |
5157 *Utils::OpenHandle(*global_template)); | 5159 *Utils::OpenHandle(*global_template)); |
5158 | 5160 |
5159 // Migrate security handlers from global_template to | 5161 // Migrate security handlers from global_template to |
5160 // proxy_template. Temporarily removing access check | 5162 // proxy_template. Temporarily removing access check |
5161 // information from the global template. | 5163 // information from the global template. |
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7472 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7474 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7473 Address callback_address = | 7475 Address callback_address = |
7474 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7476 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7475 VMState<EXTERNAL> state(isolate); | 7477 VMState<EXTERNAL> state(isolate); |
7476 ExternalCallbackScope call_scope(isolate, callback_address); | 7478 ExternalCallbackScope call_scope(isolate, callback_address); |
7477 callback(info); | 7479 callback(info); |
7478 } | 7480 } |
7479 | 7481 |
7480 | 7482 |
7481 } } // namespace v8::internal | 7483 } } // namespace v8::internal |
OLD | NEW |