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