Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: src/api.cc

Issue 7229007: Add possibility to configure 'prototype' property via FunctionTemplate (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/apinatives.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 array.add(Utils::OpenHandle(*value)); 877 array.add(Utils::OpenHandle(*value));
878 array.add(Utils::OpenHandle(*v8::Integer::New(attribute))); 878 array.add(Utils::OpenHandle(*v8::Integer::New(attribute)));
879 } 879 }
880 880
881 881
882 // --- F u n c t i o n T e m p l a t e --- 882 // --- F u n c t i o n T e m p l a t e ---
883 static void InitializeFunctionTemplate( 883 static void InitializeFunctionTemplate(
884 i::Handle<i::FunctionTemplateInfo> info) { 884 i::Handle<i::FunctionTemplateInfo> info) {
885 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); 885 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE));
886 info->set_flag(0); 886 info->set_flag(0);
887 info->set_prototype_attributes(i::Smi::FromInt(v8::None));
887 } 888 }
888 889
889 890
890 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { 891 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
891 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 892 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
892 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) { 893 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) {
893 return Local<ObjectTemplate>(); 894 return Local<ObjectTemplate>();
894 } 895 }
895 ENTER_V8(isolate); 896 ENTER_V8(isolate);
896 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template()); 897 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 void FunctionTemplate::SetHiddenPrototype(bool value) { 1100 void FunctionTemplate::SetHiddenPrototype(bool value) {
1100 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1101 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1101 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetHiddenPrototype()")) { 1102 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetHiddenPrototype()")) {
1102 return; 1103 return;
1103 } 1104 }
1104 ENTER_V8(isolate); 1105 ENTER_V8(isolate);
1105 Utils::OpenHandle(this)->set_hidden_prototype(value); 1106 Utils::OpenHandle(this)->set_hidden_prototype(value);
1106 } 1107 }
1107 1108
1108 1109
1110 void FunctionTemplate::SetPrototypeAttributes(int attributes) {
1111 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1112 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetPrototypeAttributes()")) {
1113 return;
1114 }
1115 ENTER_V8(isolate);
1116 Utils::OpenHandle(this)->set_prototype_attributes(
1117 i::Smi::FromInt(attributes));
1118 }
1119
1120
1109 void FunctionTemplate::SetNamedInstancePropertyHandler( 1121 void FunctionTemplate::SetNamedInstancePropertyHandler(
1110 NamedPropertyGetter getter, 1122 NamedPropertyGetter getter,
1111 NamedPropertySetter setter, 1123 NamedPropertySetter setter,
1112 NamedPropertyQuery query, 1124 NamedPropertyQuery query,
1113 NamedPropertyDeleter remover, 1125 NamedPropertyDeleter remover,
1114 NamedPropertyEnumerator enumerator, 1126 NamedPropertyEnumerator enumerator,
1115 Handle<Value> data) { 1127 Handle<Value> data) {
1116 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 1128 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1117 if (IsDeadCheck(isolate, 1129 if (IsDeadCheck(isolate,
1118 "v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) { 1130 "v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
(...skipping 5017 matching lines...) Expand 10 before | Expand all | Expand 10 after
6136 6148
6137 6149
6138 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6150 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6139 HandleScopeImplementer* scope_implementer = 6151 HandleScopeImplementer* scope_implementer =
6140 reinterpret_cast<HandleScopeImplementer*>(storage); 6152 reinterpret_cast<HandleScopeImplementer*>(storage);
6141 scope_implementer->IterateThis(v); 6153 scope_implementer->IterateThis(v);
6142 return storage + ArchiveSpacePerThread(); 6154 return storage + ArchiveSpacePerThread();
6143 } 6155 }
6144 6156
6145 } } // namespace v8::internal 6157 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/apinatives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698