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

Side by Side Diff: src/api.h

Issue 10442129: Implement implicit instance checks for API accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Daniel Clifford. Created 8 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/api.cc » ('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 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 static inline Local<Integer> IntegerToLocal( 193 static inline Local<Integer> IntegerToLocal(
194 v8::internal::Handle<v8::internal::Object> obj); 194 v8::internal::Handle<v8::internal::Object> obj);
195 static inline Local<Uint32> Uint32ToLocal( 195 static inline Local<Uint32> Uint32ToLocal(
196 v8::internal::Handle<v8::internal::Object> obj); 196 v8::internal::Handle<v8::internal::Object> obj);
197 static inline Local<FunctionTemplate> ToLocal( 197 static inline Local<FunctionTemplate> ToLocal(
198 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj); 198 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
199 static inline Local<ObjectTemplate> ToLocal( 199 static inline Local<ObjectTemplate> ToLocal(
200 v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj); 200 v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj);
201 static inline Local<Signature> ToLocal( 201 static inline Local<Signature> ToLocal(
202 v8::internal::Handle<v8::internal::SignatureInfo> obj); 202 v8::internal::Handle<v8::internal::SignatureInfo> obj);
203 static inline Local<AccessorSignature> AccessorSignatureToLocal(
204 v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
203 static inline Local<TypeSwitch> ToLocal( 205 static inline Local<TypeSwitch> ToLocal(
204 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj); 206 v8::internal::Handle<v8::internal::TypeSwitchInfo> obj);
205 207
206 static inline v8::internal::Handle<v8::internal::TemplateInfo> 208 static inline v8::internal::Handle<v8::internal::TemplateInfo>
207 OpenHandle(const Template* that); 209 OpenHandle(const Template* that);
208 static inline v8::internal::Handle<v8::internal::FunctionTemplateInfo> 210 static inline v8::internal::Handle<v8::internal::FunctionTemplateInfo>
209 OpenHandle(const FunctionTemplate* that); 211 OpenHandle(const FunctionTemplate* that);
210 static inline v8::internal::Handle<v8::internal::ObjectTemplateInfo> 212 static inline v8::internal::Handle<v8::internal::ObjectTemplateInfo>
211 OpenHandle(const ObjectTemplate* that); 213 OpenHandle(const ObjectTemplate* that);
212 static inline v8::internal::Handle<v8::internal::Object> 214 static inline v8::internal::Handle<v8::internal::Object>
(...skipping 13 matching lines...) Expand all
226 static inline v8::internal::Handle<v8::internal::JSObject> 228 static inline v8::internal::Handle<v8::internal::JSObject>
227 OpenHandle(const Message* message); 229 OpenHandle(const Message* message);
228 static inline v8::internal::Handle<v8::internal::JSArray> 230 static inline v8::internal::Handle<v8::internal::JSArray>
229 OpenHandle(const StackTrace* stack_trace); 231 OpenHandle(const StackTrace* stack_trace);
230 static inline v8::internal::Handle<v8::internal::JSObject> 232 static inline v8::internal::Handle<v8::internal::JSObject>
231 OpenHandle(const StackFrame* stack_frame); 233 OpenHandle(const StackFrame* stack_frame);
232 static inline v8::internal::Handle<v8::internal::Context> 234 static inline v8::internal::Handle<v8::internal::Context>
233 OpenHandle(const v8::Context* context); 235 OpenHandle(const v8::Context* context);
234 static inline v8::internal::Handle<v8::internal::SignatureInfo> 236 static inline v8::internal::Handle<v8::internal::SignatureInfo>
235 OpenHandle(const v8::Signature* sig); 237 OpenHandle(const v8::Signature* sig);
238 static inline v8::internal::Handle<v8::internal::FunctionTemplateInfo>
239 OpenHandle(const v8::AccessorSignature* sig);
236 static inline v8::internal::Handle<v8::internal::TypeSwitchInfo> 240 static inline v8::internal::Handle<v8::internal::TypeSwitchInfo>
237 OpenHandle(const v8::TypeSwitch* that); 241 OpenHandle(const v8::TypeSwitch* that);
238 static inline v8::internal::Handle<v8::internal::Foreign> 242 static inline v8::internal::Handle<v8::internal::Foreign>
239 OpenHandle(const v8::External* that); 243 OpenHandle(const v8::External* that);
240 }; 244 };
241 245
242 246
243 template <class T> 247 template <class T>
244 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { 248 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
245 return reinterpret_cast<T*>(obj.location()); 249 return reinterpret_cast<T*>(obj.location());
(...skipping 23 matching lines...) Expand all
269 MAKE_TO_LOCAL(ToLocal, Object, Value) 273 MAKE_TO_LOCAL(ToLocal, Object, Value)
270 MAKE_TO_LOCAL(ToLocal, JSFunction, Function) 274 MAKE_TO_LOCAL(ToLocal, JSFunction, Function)
271 MAKE_TO_LOCAL(ToLocal, String, String) 275 MAKE_TO_LOCAL(ToLocal, String, String)
272 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp) 276 MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
273 MAKE_TO_LOCAL(ToLocal, JSObject, Object) 277 MAKE_TO_LOCAL(ToLocal, JSObject, Object)
274 MAKE_TO_LOCAL(ToLocal, JSArray, Array) 278 MAKE_TO_LOCAL(ToLocal, JSArray, Array)
275 MAKE_TO_LOCAL(ToLocal, Foreign, External) 279 MAKE_TO_LOCAL(ToLocal, Foreign, External)
276 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate) 280 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate)
277 MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate) 281 MAKE_TO_LOCAL(ToLocal, ObjectTemplateInfo, ObjectTemplate)
278 MAKE_TO_LOCAL(ToLocal, SignatureInfo, Signature) 282 MAKE_TO_LOCAL(ToLocal, SignatureInfo, Signature)
283 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature)
279 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch) 284 MAKE_TO_LOCAL(ToLocal, TypeSwitchInfo, TypeSwitch)
280 MAKE_TO_LOCAL(MessageToLocal, Object, Message) 285 MAKE_TO_LOCAL(MessageToLocal, Object, Message)
281 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace) 286 MAKE_TO_LOCAL(StackTraceToLocal, JSArray, StackTrace)
282 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame) 287 MAKE_TO_LOCAL(StackFrameToLocal, JSObject, StackFrame)
283 MAKE_TO_LOCAL(NumberToLocal, Object, Number) 288 MAKE_TO_LOCAL(NumberToLocal, Object, Number)
284 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer) 289 MAKE_TO_LOCAL(IntegerToLocal, Object, Integer)
285 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32) 290 MAKE_TO_LOCAL(Uint32ToLocal, Object, Uint32)
286 291
287 #undef MAKE_TO_LOCAL 292 #undef MAKE_TO_LOCAL
288 293
289 294
290 // Implementations of OpenHandle 295 // Implementations of OpenHandle
291 296
292 #define MAKE_OPEN_HANDLE(From, To) \ 297 #define MAKE_OPEN_HANDLE(From, To) \
293 v8::internal::Handle<v8::internal::To> Utils::OpenHandle(\ 298 v8::internal::Handle<v8::internal::To> Utils::OpenHandle(\
294 const v8::From* that) { \ 299 const v8::From* that) { \
295 return v8::internal::Handle<v8::internal::To>( \ 300 return v8::internal::Handle<v8::internal::To>( \
296 reinterpret_cast<v8::internal::To**>(const_cast<v8::From*>(that))); \ 301 reinterpret_cast<v8::internal::To**>(const_cast<v8::From*>(that))); \
297 } 302 }
298 303
299 MAKE_OPEN_HANDLE(Template, TemplateInfo) 304 MAKE_OPEN_HANDLE(Template, TemplateInfo)
300 MAKE_OPEN_HANDLE(FunctionTemplate, FunctionTemplateInfo) 305 MAKE_OPEN_HANDLE(FunctionTemplate, FunctionTemplateInfo)
301 MAKE_OPEN_HANDLE(ObjectTemplate, ObjectTemplateInfo) 306 MAKE_OPEN_HANDLE(ObjectTemplate, ObjectTemplateInfo)
302 MAKE_OPEN_HANDLE(Signature, SignatureInfo) 307 MAKE_OPEN_HANDLE(Signature, SignatureInfo)
308 MAKE_OPEN_HANDLE(AccessorSignature, FunctionTemplateInfo)
303 MAKE_OPEN_HANDLE(TypeSwitch, TypeSwitchInfo) 309 MAKE_OPEN_HANDLE(TypeSwitch, TypeSwitchInfo)
304 MAKE_OPEN_HANDLE(Data, Object) 310 MAKE_OPEN_HANDLE(Data, Object)
305 MAKE_OPEN_HANDLE(RegExp, JSRegExp) 311 MAKE_OPEN_HANDLE(RegExp, JSRegExp)
306 MAKE_OPEN_HANDLE(Object, JSObject) 312 MAKE_OPEN_HANDLE(Object, JSObject)
307 MAKE_OPEN_HANDLE(Array, JSArray) 313 MAKE_OPEN_HANDLE(Array, JSArray)
308 MAKE_OPEN_HANDLE(String, String) 314 MAKE_OPEN_HANDLE(String, String)
309 MAKE_OPEN_HANDLE(Script, Object) 315 MAKE_OPEN_HANDLE(Script, Object)
310 MAKE_OPEN_HANDLE(Function, JSFunction) 316 MAKE_OPEN_HANDLE(Function, JSFunction)
311 MAKE_OPEN_HANDLE(Message, JSObject) 317 MAKE_OPEN_HANDLE(Message, JSObject)
312 MAKE_OPEN_HANDLE(Context, Context) 318 MAKE_OPEN_HANDLE(Context, Context)
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 stress_type_ = stress_type; 566 stress_type_ = stress_type;
561 } 567 }
562 568
563 private: 569 private:
564 static v8::Testing::StressType stress_type_; 570 static v8::Testing::StressType stress_type_;
565 }; 571 };
566 572
567 } } // namespace v8::internal 573 } } // namespace v8::internal
568 574
569 #endif // V8_API_H_ 575 #endif // V8_API_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698