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 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 */ | 2354 */ |
2355 static Local<Array> New(int length = 0); | 2355 static Local<Array> New(int length = 0); |
2356 | 2356 |
2357 V8_INLINE(static Array* Cast(Value* obj)); | 2357 V8_INLINE(static Array* Cast(Value* obj)); |
2358 private: | 2358 private: |
2359 Array(); | 2359 Array(); |
2360 static void CheckCast(Value* obj); | 2360 static void CheckCast(Value* obj); |
2361 }; | 2361 }; |
2362 | 2362 |
2363 | 2363 |
2364 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); | |
2365 | |
2366 | |
2367 /** | 2364 /** |
2368 * A JavaScript function object (ECMA-262, 15.3). | 2365 * A JavaScript function object (ECMA-262, 15.3). |
2369 */ | 2366 */ |
2370 class V8_EXPORT Function : public Object { | 2367 class V8_EXPORT Function : public Object { |
2371 public: | 2368 public: |
2372 /** | |
2373 * Create a function in the current execution context | |
2374 * for a given FunctionCallback. | |
2375 */ | |
2376 static Local<Function> New(Isolate* isolate, | |
2377 FunctionCallback callback, | |
2378 Local<Value> data = Local<Value>(), | |
2379 int length = 0); | |
2380 | |
2381 Local<Object> NewInstance() const; | 2369 Local<Object> NewInstance() const; |
2382 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; | 2370 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; |
2383 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); | 2371 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); |
2384 void SetName(Handle<String> name); | 2372 void SetName(Handle<String> name); |
2385 Handle<Value> GetName() const; | 2373 Handle<Value> GetName() const; |
2386 | 2374 |
2387 /** | 2375 /** |
2388 * Name inferred from variable or property assignment of this function. | 2376 * Name inferred from variable or property assignment of this function. |
2389 * Used to facilitate debugging and profiling of JavaScript code written | 2377 * Used to facilitate debugging and profiling of JavaScript code written |
2390 * in an OO style, where many functions are anonymous but are assigned | 2378 * in an OO style, where many functions are anonymous but are assigned |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3145 static const int kReturnValueIndex = -3; | 3133 static const int kReturnValueIndex = -3; |
3146 static const int kReturnValueDefaultValueIndex = -4; | 3134 static const int kReturnValueDefaultValueIndex = -4; |
3147 static const int kIsolateIndex = -5; | 3135 static const int kIsolateIndex = -5; |
3148 | 3136 |
3149 V8_INLINE(PropertyCallbackInfo(internal::Object** args)) | 3137 V8_INLINE(PropertyCallbackInfo(internal::Object** args)) |
3150 : args_(args) { } | 3138 : args_(args) { } |
3151 internal::Object** args_; | 3139 internal::Object** args_; |
3152 }; | 3140 }; |
3153 | 3141 |
3154 | 3142 |
| 3143 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); |
| 3144 |
3155 /** | 3145 /** |
3156 * NamedProperty[Getter|Setter] are used as interceptors on object. | 3146 * NamedProperty[Getter|Setter] are used as interceptors on object. |
3157 * See ObjectTemplate::SetNamedPropertyHandler. | 3147 * See ObjectTemplate::SetNamedPropertyHandler. |
3158 */ | 3148 */ |
3159 typedef void (*NamedPropertyGetterCallback)( | 3149 typedef void (*NamedPropertyGetterCallback)( |
3160 Local<String> property, | 3150 Local<String> property, |
3161 const PropertyCallbackInfo<Value>& info); | 3151 const PropertyCallbackInfo<Value>& info); |
3162 | 3152 |
3163 | 3153 |
3164 /** | 3154 /** |
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6510 */ | 6500 */ |
6511 | 6501 |
6512 | 6502 |
6513 } // namespace v8 | 6503 } // namespace v8 |
6514 | 6504 |
6515 | 6505 |
6516 #undef TYPE_CHECK | 6506 #undef TYPE_CHECK |
6517 | 6507 |
6518 | 6508 |
6519 #endif // V8_H_ | 6509 #endif // V8_H_ |
OLD | NEW |