| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 class ObjectTemplate; | 147 class ObjectTemplate; |
| 148 class Data; | 148 class Data; |
| 149 class AccessorInfo; | 149 class AccessorInfo; |
| 150 template<typename T> class PropertyCallbackInfo; | 150 template<typename T> class PropertyCallbackInfo; |
| 151 class StackTrace; | 151 class StackTrace; |
| 152 class StackFrame; | 152 class StackFrame; |
| 153 class Isolate; | 153 class Isolate; |
| 154 class DeclaredAccessorDescriptor; | 154 class DeclaredAccessorDescriptor; |
| 155 class ObjectOperationDescriptor; | 155 class ObjectOperationDescriptor; |
| 156 class RawOperationDescriptor; | 156 class RawOperationDescriptor; |
| 157 class CallHandlerHelper; |
| 157 | 158 |
| 158 namespace internal { | 159 namespace internal { |
| 159 class Arguments; | 160 class Arguments; |
| 160 class Heap; | 161 class Heap; |
| 161 class HeapObject; | 162 class HeapObject; |
| 162 class Isolate; | 163 class Isolate; |
| 163 class Object; | 164 class Object; |
| 164 template<typename T> class CustomArguments; | 165 template<typename T> class CustomArguments; |
| 165 class PropertyCallbackArguments; | 166 class PropertyCallbackArguments; |
| 166 class FunctionCallbackArguments; | 167 class FunctionCallbackArguments; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 502 |
| 502 /** | 503 /** |
| 503 * A constructor that creates a new global cell pointing to that. In contrast | 504 * A constructor that creates a new global cell pointing to that. In contrast |
| 504 * to the copy constructor, this creates a new persistent handle which needs | 505 * to the copy constructor, this creates a new persistent handle which needs |
| 505 * to be separately disposed. | 506 * to be separately disposed. |
| 506 */ | 507 */ |
| 507 template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that)) | 508 template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that)) |
| 508 : val_(New(isolate, *that)) { } | 509 : val_(New(isolate, *that)) { } |
| 509 | 510 |
| 510 template <class S> V8_INLINE(Persistent(Isolate* isolate, | 511 template <class S> V8_INLINE(Persistent(Isolate* isolate, |
| 511 Persistent<S>& that)) // NOLINT | 512 const Persistent<S>& that)) // NOLINT |
| 512 : val_(New(isolate, *that)) { } | 513 : val_(New(isolate, *that)) { } |
| 513 | 514 |
| 514 #else | 515 #else |
| 515 /** | 516 /** |
| 516 * Creates an empty persistent handle that doesn't point to any | 517 * Creates an empty persistent handle that doesn't point to any |
| 517 * storage cell. | 518 * storage cell. |
| 518 */ | 519 */ |
| 519 V8_INLINE(Persistent()) : Handle<T>() { } | 520 V8_INLINE(Persistent()) : Handle<T>() { } |
| 520 | 521 |
| 521 /** | 522 /** |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 * Runs the script returning the resulting value. If the script is | 1036 * Runs the script returning the resulting value. If the script is |
| 1036 * context independent (created using ::New) it will be run in the | 1037 * context independent (created using ::New) it will be run in the |
| 1037 * currently entered context. If it is context specific (created | 1038 * currently entered context. If it is context specific (created |
| 1038 * using ::Compile) it will be run in the context in which it was | 1039 * using ::Compile) it will be run in the context in which it was |
| 1039 * compiled. | 1040 * compiled. |
| 1040 */ | 1041 */ |
| 1041 Local<Value> Run(); | 1042 Local<Value> Run(); |
| 1042 | 1043 |
| 1043 /** | 1044 /** |
| 1044 * Returns the script id value. | 1045 * Returns the script id value. |
| 1046 * DEPRECATED: Please use GetId(). |
| 1045 */ | 1047 */ |
| 1046 Local<Value> Id(); | 1048 Local<Value> Id(); |
| 1047 | 1049 |
| 1048 /** | 1050 /** |
| 1051 * Returns the script id. |
| 1052 */ |
| 1053 int GetId(); |
| 1054 |
| 1055 /** |
| 1049 * Associate an additional data object with the script. This is mainly used | 1056 * Associate an additional data object with the script. This is mainly used |
| 1050 * with the debugger as this data object is only available through the | 1057 * with the debugger as this data object is only available through the |
| 1051 * debugger API. | 1058 * debugger API. |
| 1052 */ | 1059 */ |
| 1053 void SetData(Handle<String> data); | 1060 void SetData(Handle<String> data); |
| 1054 | 1061 |
| 1055 /** | 1062 /** |
| 1056 * Returns the name value of one Script. | 1063 * Returns the name value of one Script. |
| 1057 */ | 1064 */ |
| 1058 Handle<Value> GetScriptName(); | 1065 Handle<Value> GetScriptName(); |
| 1059 | 1066 |
| 1060 /** | 1067 /** |
| 1061 * Returns zero based line number of the code_pos location in the script. | 1068 * Returns zero based line number of the code_pos location in the script. |
| 1062 * -1 will be returned if no information available. | 1069 * -1 will be returned if no information available. |
| 1063 */ | 1070 */ |
| 1064 int GetLineNumber(int code_pos); | 1071 int GetLineNumber(int code_pos); |
| 1072 |
| 1073 static const int kNoScriptId = 0; |
| 1065 }; | 1074 }; |
| 1066 | 1075 |
| 1067 | 1076 |
| 1068 /** | 1077 /** |
| 1069 * An error message. | 1078 * An error message. |
| 1070 */ | 1079 */ |
| 1071 class V8EXPORT Message { | 1080 class V8EXPORT Message { |
| 1072 public: | 1081 public: |
| 1073 Local<String> Get() const; | 1082 Local<String> Get() const; |
| 1074 Local<String> GetSourceLine() const; | 1083 Local<String> GetSourceLine() const; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 bool IsRegExp() const; | 1363 bool IsRegExp() const; |
| 1355 | 1364 |
| 1356 | 1365 |
| 1357 /** | 1366 /** |
| 1358 * Returns true if this value is an ArrayBuffer. | 1367 * Returns true if this value is an ArrayBuffer. |
| 1359 * This is an experimental feature. | 1368 * This is an experimental feature. |
| 1360 */ | 1369 */ |
| 1361 bool IsArrayBuffer() const; | 1370 bool IsArrayBuffer() const; |
| 1362 | 1371 |
| 1363 /** | 1372 /** |
| 1373 * Returns true if this value is an ArrayBufferView. |
| 1374 * This is an experimental feature. |
| 1375 */ |
| 1376 bool IsArrayBufferView() const; |
| 1377 |
| 1378 /** |
| 1364 * Returns true if this value is one of TypedArrays. | 1379 * Returns true if this value is one of TypedArrays. |
| 1365 * This is an experimental feature. | 1380 * This is an experimental feature. |
| 1366 */ | 1381 */ |
| 1367 bool IsTypedArray() const; | 1382 bool IsTypedArray() const; |
| 1368 | 1383 |
| 1369 /** | 1384 /** |
| 1370 * Returns true if this value is an Uint8Array. | 1385 * Returns true if this value is an Uint8Array. |
| 1371 * This is an experimental feature. | 1386 * This is an experimental feature. |
| 1372 */ | 1387 */ |
| 1373 bool IsUint8Array() const; | 1388 bool IsUint8Array() const; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 * This is an experimental feature. | 1428 * This is an experimental feature. |
| 1414 */ | 1429 */ |
| 1415 bool IsFloat32Array() const; | 1430 bool IsFloat32Array() const; |
| 1416 | 1431 |
| 1417 /** | 1432 /** |
| 1418 * Returns true if this value is a Float64Array. | 1433 * Returns true if this value is a Float64Array. |
| 1419 * This is an experimental feature. | 1434 * This is an experimental feature. |
| 1420 */ | 1435 */ |
| 1421 bool IsFloat64Array() const; | 1436 bool IsFloat64Array() const; |
| 1422 | 1437 |
| 1438 /** |
| 1439 * Returns true if this value is a DataView. |
| 1440 * This is an experimental feature. |
| 1441 */ |
| 1442 bool IsDataView() const; |
| 1443 |
| 1423 Local<Boolean> ToBoolean() const; | 1444 Local<Boolean> ToBoolean() const; |
| 1424 Local<Number> ToNumber() const; | 1445 Local<Number> ToNumber() const; |
| 1425 Local<String> ToString() const; | 1446 Local<String> ToString() const; |
| 1426 Local<String> ToDetailString() const; | 1447 Local<String> ToDetailString() const; |
| 1427 Local<Object> ToObject() const; | 1448 Local<Object> ToObject() const; |
| 1428 Local<Integer> ToInteger() const; | 1449 Local<Integer> ToInteger() const; |
| 1429 Local<Uint32> ToUint32() const; | 1450 Local<Uint32> ToUint32() const; |
| 1430 Local<Int32> ToInt32() const; | 1451 Local<Int32> ToInt32() const; |
| 1431 | 1452 |
| 1432 /** | 1453 /** |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 bool Delete(Handle<Value> key); | 2067 bool Delete(Handle<Value> key); |
| 2047 | 2068 |
| 2048 // Delete a property on this object bypassing interceptors and | 2069 // Delete a property on this object bypassing interceptors and |
| 2049 // ignoring dont-delete attributes. | 2070 // ignoring dont-delete attributes. |
| 2050 bool ForceDelete(Handle<Value> key); | 2071 bool ForceDelete(Handle<Value> key); |
| 2051 | 2072 |
| 2052 bool Has(uint32_t index); | 2073 bool Has(uint32_t index); |
| 2053 | 2074 |
| 2054 bool Delete(uint32_t index); | 2075 bool Delete(uint32_t index); |
| 2055 | 2076 |
| 2056 // TODO(dcarney): deprecate | 2077 V8_DEPRECATED(bool SetAccessor(Handle<String> name, |
| 2057 bool SetAccessor(Handle<String> name, | 2078 AccessorGetter getter, |
| 2058 AccessorGetter getter, | 2079 AccessorSetter setter = 0, |
| 2059 AccessorSetter setter = 0, | 2080 Handle<Value> data = Handle<Value>(), |
| 2060 Handle<Value> data = Handle<Value>(), | 2081 AccessControl settings = DEFAULT, |
| 2061 AccessControl settings = DEFAULT, | 2082 PropertyAttribute attribute = None)); |
| 2062 PropertyAttribute attribute = None); | |
| 2063 bool SetAccessor(Handle<String> name, | 2083 bool SetAccessor(Handle<String> name, |
| 2064 AccessorGetterCallback getter, | 2084 AccessorGetterCallback getter, |
| 2065 AccessorSetterCallback setter = 0, | 2085 AccessorSetterCallback setter = 0, |
| 2066 Handle<Value> data = Handle<Value>(), | 2086 Handle<Value> data = Handle<Value>(), |
| 2067 AccessControl settings = DEFAULT, | 2087 AccessControl settings = DEFAULT, |
| 2068 PropertyAttribute attribute = None); | 2088 PropertyAttribute attribute = None); |
| 2069 | 2089 |
| 2070 // This function is not yet stable and should not be used at this time. | 2090 // This function is not yet stable and should not be used at this time. |
| 2071 bool SetAccessor(Handle<String> name, | 2091 bool SetAccessor(Handle<String> name, |
| 2072 Handle<DeclaredAccessorDescriptor> descriptor, | 2092 Handle<DeclaredAccessorDescriptor> descriptor, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 /** | 2348 /** |
| 2329 * Returns zero based line number of function body and | 2349 * Returns zero based line number of function body and |
| 2330 * kLineOffsetNotFound if no information available. | 2350 * kLineOffsetNotFound if no information available. |
| 2331 */ | 2351 */ |
| 2332 int GetScriptLineNumber() const; | 2352 int GetScriptLineNumber() const; |
| 2333 /** | 2353 /** |
| 2334 * Returns zero based column number of function body and | 2354 * Returns zero based column number of function body and |
| 2335 * kLineOffsetNotFound if no information available. | 2355 * kLineOffsetNotFound if no information available. |
| 2336 */ | 2356 */ |
| 2337 int GetScriptColumnNumber() const; | 2357 int GetScriptColumnNumber() const; |
| 2358 |
| 2359 /** |
| 2360 * Returns scriptId object. |
| 2361 * DEPRECATED: use ScriptId() instead. |
| 2362 */ |
| 2338 Handle<Value> GetScriptId() const; | 2363 Handle<Value> GetScriptId() const; |
| 2364 |
| 2365 /** |
| 2366 * Returns scriptId. |
| 2367 */ |
| 2368 int ScriptId() const; |
| 2369 |
| 2339 ScriptOrigin GetScriptOrigin() const; | 2370 ScriptOrigin GetScriptOrigin() const; |
| 2340 V8_INLINE(static Function* Cast(Value* obj)); | 2371 V8_INLINE(static Function* Cast(Value* obj)); |
| 2341 static const int kLineOffsetNotFound; | 2372 static const int kLineOffsetNotFound; |
| 2342 | 2373 |
| 2343 private: | 2374 private: |
| 2344 Function(); | 2375 Function(); |
| 2345 static void CheckCast(Value* obj); | 2376 static void CheckCast(Value* obj); |
| 2346 }; | 2377 }; |
| 2347 | 2378 |
| 2348 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT | 2379 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2452 | 2483 |
| 2453 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; | 2484 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; |
| 2454 | 2485 |
| 2455 private: | 2486 private: |
| 2456 ArrayBuffer(); | 2487 ArrayBuffer(); |
| 2457 static void CheckCast(Value* obj); | 2488 static void CheckCast(Value* obj); |
| 2458 }; | 2489 }; |
| 2459 | 2490 |
| 2460 | 2491 |
| 2461 /** | 2492 /** |
| 2493 * A base class for an instance of one of "views" over ArrayBuffer, |
| 2494 * including TypedArrays and DataView (ES6 draft 15.13). |
| 2495 * |
| 2496 * This API is experimental and may change significantly. |
| 2497 */ |
| 2498 class V8EXPORT ArrayBufferView : public Object { |
| 2499 public: |
| 2500 /** |
| 2501 * Returns underlying ArrayBuffer. |
| 2502 */ |
| 2503 Local<ArrayBuffer> Buffer(); |
| 2504 /** |
| 2505 * Byte offset in |Buffer|. |
| 2506 */ |
| 2507 size_t ByteOffset(); |
| 2508 /** |
| 2509 * Size of a view in bytes. |
| 2510 */ |
| 2511 size_t ByteLength(); |
| 2512 /** |
| 2513 * Base address of a view. |
| 2514 */ |
| 2515 void* BaseAddress(); |
| 2516 |
| 2517 V8_INLINE(static ArrayBufferView* Cast(Value* obj)); |
| 2518 |
| 2519 private: |
| 2520 ArrayBufferView(); |
| 2521 static void CheckCast(Value* obj); |
| 2522 }; |
| 2523 |
| 2524 |
| 2525 /** |
| 2462 * A base class for an instance of TypedArray series of constructors | 2526 * A base class for an instance of TypedArray series of constructors |
| 2463 * (ES6 draft 15.13.6). | 2527 * (ES6 draft 15.13.6). |
| 2464 * This API is experimental and may change significantly. | 2528 * This API is experimental and may change significantly. |
| 2465 */ | 2529 */ |
| 2466 class V8EXPORT TypedArray : public Object { | 2530 class V8EXPORT TypedArray : public ArrayBufferView { |
| 2467 public: | 2531 public: |
| 2468 /** | 2532 /** |
| 2469 * Returns underlying ArrayBuffer. | 2533 * Number of elements in this typed array |
| 2470 */ | 2534 * (e.g. for Int16Array, |ByteLength|/2). |
| 2471 Local<ArrayBuffer> Buffer(); | |
| 2472 /** | |
| 2473 * Byte offset in |Buffer| | |
| 2474 */ | |
| 2475 size_t ByteOffset(); | |
| 2476 /** | |
| 2477 * Numbe of elements in this typed array. | |
| 2478 */ | 2535 */ |
| 2479 size_t Length(); | 2536 size_t Length(); |
| 2480 /** | |
| 2481 * Size of typed array in bytes (e.g. for Int16Array, 2*|Length|). | |
| 2482 */ | |
| 2483 size_t ByteLength(); | |
| 2484 /** | |
| 2485 * Base address of typed array. | |
| 2486 */ | |
| 2487 void* BaseAddress(); | |
| 2488 | 2537 |
| 2489 V8_INLINE(static TypedArray* Cast(Value* obj)); | 2538 V8_INLINE(static TypedArray* Cast(Value* obj)); |
| 2490 | 2539 |
| 2491 private: | 2540 private: |
| 2492 TypedArray(); | 2541 TypedArray(); |
| 2493 static void CheckCast(Value* obj); | 2542 static void CheckCast(Value* obj); |
| 2494 }; | 2543 }; |
| 2495 | 2544 |
| 2496 | 2545 |
| 2497 /** | 2546 /** |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2631 size_t byte_offset, size_t length); | 2680 size_t byte_offset, size_t length); |
| 2632 V8_INLINE(static Float64Array* Cast(Value* obj)); | 2681 V8_INLINE(static Float64Array* Cast(Value* obj)); |
| 2633 | 2682 |
| 2634 private: | 2683 private: |
| 2635 Float64Array(); | 2684 Float64Array(); |
| 2636 static void CheckCast(Value* obj); | 2685 static void CheckCast(Value* obj); |
| 2637 }; | 2686 }; |
| 2638 | 2687 |
| 2639 | 2688 |
| 2640 /** | 2689 /** |
| 2690 * An instance of DataView constructor (ES6 draft 15.13.7). |
| 2691 * This API is experimental and may change significantly. |
| 2692 */ |
| 2693 class V8EXPORT DataView : public ArrayBufferView { |
| 2694 public: |
| 2695 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, |
| 2696 size_t byte_offset, size_t length); |
| 2697 V8_INLINE(static DataView* Cast(Value* obj)); |
| 2698 |
| 2699 private: |
| 2700 DataView(); |
| 2701 static void CheckCast(Value* obj); |
| 2702 }; |
| 2703 |
| 2704 |
| 2705 /** |
| 2641 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2706 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
| 2642 */ | 2707 */ |
| 2643 class V8EXPORT Date : public Object { | 2708 class V8EXPORT Date : public Object { |
| 2644 public: | 2709 public: |
| 2645 static Local<Value> New(double time); | 2710 static Local<Value> New(double time); |
| 2646 | 2711 |
| 2647 /** | 2712 /** |
| 2648 * A specialization of Value::NumberValue that is more efficient | 2713 * A specialization of Value::NumberValue that is more efficient |
| 2649 * because we know the structure of this object. | 2714 * because we know the structure of this object. |
| 2650 */ | 2715 */ |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3188 * | 3253 * |
| 3189 * \code | 3254 * \code |
| 3190 * child_func.prototype.__proto__ == function.prototype; | 3255 * child_func.prototype.__proto__ == function.prototype; |
| 3191 * child_instance.instance_accessor calls 'InstanceAccessorCallback' | 3256 * child_instance.instance_accessor calls 'InstanceAccessorCallback' |
| 3192 * child_instance.instance_property == 3; | 3257 * child_instance.instance_property == 3; |
| 3193 * \endcode | 3258 * \endcode |
| 3194 */ | 3259 */ |
| 3195 class V8EXPORT FunctionTemplate : public Template { | 3260 class V8EXPORT FunctionTemplate : public Template { |
| 3196 public: | 3261 public: |
| 3197 /** Creates a function template.*/ | 3262 /** Creates a function template.*/ |
| 3198 // TODO(dcarney): deprecate | 3263 V8_DEPRECATED(static Local<FunctionTemplate> New( |
| 3264 InvocationCallback callback, |
| 3265 Handle<Value> data = Handle<Value>(), |
| 3266 Handle<Signature> signature = Handle<Signature>(), |
| 3267 int length = 0)); |
| 3199 static Local<FunctionTemplate> New( | 3268 static Local<FunctionTemplate> New( |
| 3200 InvocationCallback callback = 0, | 3269 FunctionCallback callback = 0, |
| 3201 Handle<Value> data = Handle<Value>(), | 3270 Handle<Value> data = Handle<Value>(), |
| 3202 Handle<Signature> signature = Handle<Signature>(), | 3271 Handle<Signature> signature = Handle<Signature>(), |
| 3203 int length = 0); | 3272 int length = 0); |
| 3204 static Local<FunctionTemplate> New( | |
| 3205 FunctionCallback callback, // TODO(dcarney): add back default param. | |
| 3206 Handle<Value> data = Handle<Value>(), | |
| 3207 Handle<Signature> signature = Handle<Signature>(), | |
| 3208 int length = 0); | |
| 3209 | 3273 |
| 3210 /** Returns the unique function instance in the current execution context.*/ | 3274 /** Returns the unique function instance in the current execution context.*/ |
| 3211 Local<Function> GetFunction(); | 3275 Local<Function> GetFunction(); |
| 3212 | 3276 |
| 3213 /** | 3277 /** |
| 3214 * Set the call-handler callback for a FunctionTemplate. This | 3278 * Set the call-handler callback for a FunctionTemplate. This |
| 3215 * callback is called whenever the function created from this | 3279 * callback is called whenever the function created from this |
| 3216 * FunctionTemplate is called. | 3280 * FunctionTemplate is called. |
| 3217 */ | 3281 */ |
| 3218 // TODO(dcarney): deprecate | 3282 V8_DEPRECATED(void SetCallHandler(InvocationCallback callback, |
| 3219 void SetCallHandler(InvocationCallback callback, | 3283 Handle<Value> data = Handle<Value>())); |
| 3220 Handle<Value> data = Handle<Value>()); | |
| 3221 void SetCallHandler(FunctionCallback callback, | 3284 void SetCallHandler(FunctionCallback callback, |
| 3222 Handle<Value> data = Handle<Value>()); | 3285 Handle<Value> data = Handle<Value>()); |
| 3223 | 3286 |
| 3224 /** Set the predefined length property for the FunctionTemplate. */ | 3287 /** Set the predefined length property for the FunctionTemplate. */ |
| 3225 void SetLength(int length); | 3288 void SetLength(int length); |
| 3226 | 3289 |
| 3227 /** Get the InstanceTemplate. */ | 3290 /** Get the InstanceTemplate. */ |
| 3228 Local<ObjectTemplate> InstanceTemplate(); | 3291 Local<ObjectTemplate> InstanceTemplate(); |
| 3229 | 3292 |
| 3230 /** Causes the function template to inherit from a parent function template.*/ | 3293 /** Causes the function template to inherit from a parent function template.*/ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 void ReadOnlyPrototype(); | 3327 void ReadOnlyPrototype(); |
| 3265 | 3328 |
| 3266 /** | 3329 /** |
| 3267 * Returns true if the given object is an instance of this function | 3330 * Returns true if the given object is an instance of this function |
| 3268 * template. | 3331 * template. |
| 3269 */ | 3332 */ |
| 3270 bool HasInstance(Handle<Value> object); | 3333 bool HasInstance(Handle<Value> object); |
| 3271 | 3334 |
| 3272 private: | 3335 private: |
| 3273 FunctionTemplate(); | 3336 FunctionTemplate(); |
| 3337 // TODO(dcarney): Remove with SetCallHandler. |
| 3338 friend class v8::CallHandlerHelper; |
| 3339 void SetCallHandlerInternal(InvocationCallback callback, Handle<Value> data); |
| 3274 friend class Context; | 3340 friend class Context; |
| 3275 friend class ObjectTemplate; | 3341 friend class ObjectTemplate; |
| 3276 }; | 3342 }; |
| 3277 | 3343 |
| 3278 | 3344 |
| 3279 /** | 3345 /** |
| 3280 * An ObjectTemplate is used to create objects at runtime. | 3346 * An ObjectTemplate is used to create objects at runtime. |
| 3281 * | 3347 * |
| 3282 * Properties added to an ObjectTemplate are added to each object | 3348 * Properties added to an ObjectTemplate are added to each object |
| 3283 * created from the ObjectTemplate. | 3349 * created from the ObjectTemplate. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3312 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all | 3378 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all |
| 3313 * cross-context access. | 3379 * cross-context access. |
| 3314 * \param attribute The attributes of the property for which an accessor | 3380 * \param attribute The attributes of the property for which an accessor |
| 3315 * is added. | 3381 * is added. |
| 3316 * \param signature The signature describes valid receivers for the accessor | 3382 * \param signature The signature describes valid receivers for the accessor |
| 3317 * and is used to perform implicit instance checks against them. If the | 3383 * and is used to perform implicit instance checks against them. If the |
| 3318 * receiver is incompatible (i.e. is not an instance of the constructor as | 3384 * receiver is incompatible (i.e. is not an instance of the constructor as |
| 3319 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is | 3385 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is |
| 3320 * thrown and no callback is invoked. | 3386 * thrown and no callback is invoked. |
| 3321 */ | 3387 */ |
| 3322 // TODO(dcarney): deprecate | 3388 V8_DEPRECATED(void SetAccessor(Handle<String> name, |
| 3323 void SetAccessor(Handle<String> name, | 3389 AccessorGetter getter, |
| 3324 AccessorGetter getter, | 3390 AccessorSetter setter = 0, |
| 3325 AccessorSetter setter = 0, | 3391 Handle<Value> data = Handle<Value>(), |
| 3326 Handle<Value> data = Handle<Value>(), | 3392 AccessControl settings = DEFAULT, |
| 3327 AccessControl settings = DEFAULT, | 3393 PropertyAttribute attribute = None, |
| 3328 PropertyAttribute attribute = None, | 3394 Handle<AccessorSignature> signature = |
| 3329 Handle<AccessorSignature> signature = | 3395 Handle<AccessorSignature>())); |
| 3330 Handle<AccessorSignature>()); | |
| 3331 void SetAccessor(Handle<String> name, | 3396 void SetAccessor(Handle<String> name, |
| 3332 AccessorGetterCallback getter, | 3397 AccessorGetterCallback getter, |
| 3333 AccessorSetterCallback setter = 0, | 3398 AccessorSetterCallback setter = 0, |
| 3334 Handle<Value> data = Handle<Value>(), | 3399 Handle<Value> data = Handle<Value>(), |
| 3335 AccessControl settings = DEFAULT, | 3400 AccessControl settings = DEFAULT, |
| 3336 PropertyAttribute attribute = None, | 3401 PropertyAttribute attribute = None, |
| 3337 Handle<AccessorSignature> signature = | 3402 Handle<AccessorSignature> signature = |
| 3338 Handle<AccessorSignature>()); | 3403 Handle<AccessorSignature>()); |
| 3339 | 3404 |
| 3340 // This function is not yet stable and should not be used at this time. | 3405 // This function is not yet stable and should not be used at this time. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3355 * \param getter The callback to invoke when getting a property. | 3420 * \param getter The callback to invoke when getting a property. |
| 3356 * \param setter The callback to invoke when setting a property. | 3421 * \param setter The callback to invoke when setting a property. |
| 3357 * \param query The callback to invoke to check if a property is present, | 3422 * \param query The callback to invoke to check if a property is present, |
| 3358 * and if present, get its attributes. | 3423 * and if present, get its attributes. |
| 3359 * \param deleter The callback to invoke when deleting a property. | 3424 * \param deleter The callback to invoke when deleting a property. |
| 3360 * \param enumerator The callback to invoke to enumerate all the named | 3425 * \param enumerator The callback to invoke to enumerate all the named |
| 3361 * properties of an object. | 3426 * properties of an object. |
| 3362 * \param data A piece of data that will be passed to the callbacks | 3427 * \param data A piece of data that will be passed to the callbacks |
| 3363 * whenever they are invoked. | 3428 * whenever they are invoked. |
| 3364 */ | 3429 */ |
| 3365 // TODO(dcarney): deprecate | 3430 V8_DEPRECATED(void SetNamedPropertyHandler( |
| 3366 void SetNamedPropertyHandler(NamedPropertyGetter getter, | 3431 NamedPropertyGetter getter, |
| 3367 NamedPropertySetter setter = 0, | 3432 NamedPropertySetter setter = 0, |
| 3368 NamedPropertyQuery query = 0, | 3433 NamedPropertyQuery query = 0, |
| 3369 NamedPropertyDeleter deleter = 0, | 3434 NamedPropertyDeleter deleter = 0, |
| 3370 NamedPropertyEnumerator enumerator = 0, | 3435 NamedPropertyEnumerator enumerator = 0, |
| 3371 Handle<Value> data = Handle<Value>()); | 3436 Handle<Value> data = Handle<Value>())); |
| 3372 void SetNamedPropertyHandler( | 3437 void SetNamedPropertyHandler( |
| 3373 NamedPropertyGetterCallback getter, | 3438 NamedPropertyGetterCallback getter, |
| 3374 NamedPropertySetterCallback setter = 0, | 3439 NamedPropertySetterCallback setter = 0, |
| 3375 NamedPropertyQueryCallback query = 0, | 3440 NamedPropertyQueryCallback query = 0, |
| 3376 NamedPropertyDeleterCallback deleter = 0, | 3441 NamedPropertyDeleterCallback deleter = 0, |
| 3377 NamedPropertyEnumeratorCallback enumerator = 0, | 3442 NamedPropertyEnumeratorCallback enumerator = 0, |
| 3378 Handle<Value> data = Handle<Value>()); | 3443 Handle<Value> data = Handle<Value>()); |
| 3379 | 3444 |
| 3380 /** | 3445 /** |
| 3381 * Sets an indexed property handler on the object template. | 3446 * Sets an indexed property handler on the object template. |
| 3382 * | 3447 * |
| 3383 * Whenever an indexed property is accessed on objects created from | 3448 * Whenever an indexed property is accessed on objects created from |
| 3384 * this object template, the provided callback is invoked instead of | 3449 * this object template, the provided callback is invoked instead of |
| 3385 * accessing the property directly on the JavaScript object. | 3450 * accessing the property directly on the JavaScript object. |
| 3386 * | 3451 * |
| 3387 * \param getter The callback to invoke when getting a property. | 3452 * \param getter The callback to invoke when getting a property. |
| 3388 * \param setter The callback to invoke when setting a property. | 3453 * \param setter The callback to invoke when setting a property. |
| 3389 * \param query The callback to invoke to check if an object has a property. | 3454 * \param query The callback to invoke to check if an object has a property. |
| 3390 * \param deleter The callback to invoke when deleting a property. | 3455 * \param deleter The callback to invoke when deleting a property. |
| 3391 * \param enumerator The callback to invoke to enumerate all the indexed | 3456 * \param enumerator The callback to invoke to enumerate all the indexed |
| 3392 * properties of an object. | 3457 * properties of an object. |
| 3393 * \param data A piece of data that will be passed to the callbacks | 3458 * \param data A piece of data that will be passed to the callbacks |
| 3394 * whenever they are invoked. | 3459 * whenever they are invoked. |
| 3395 */ | 3460 */ |
| 3396 // TODO(dcarney): deprecate | 3461 V8_DEPRECATED(void SetIndexedPropertyHandler( |
| 3397 void SetIndexedPropertyHandler(IndexedPropertyGetter getter, | 3462 IndexedPropertyGetter getter, |
| 3398 IndexedPropertySetter setter = 0, | 3463 IndexedPropertySetter setter = 0, |
| 3399 IndexedPropertyQuery query = 0, | 3464 IndexedPropertyQuery query = 0, |
| 3400 IndexedPropertyDeleter deleter = 0, | 3465 IndexedPropertyDeleter deleter = 0, |
| 3401 IndexedPropertyEnumerator enumerator = 0, | 3466 IndexedPropertyEnumerator enumerator = 0, |
| 3402 Handle<Value> data = Handle<Value>()); | 3467 Handle<Value> data = Handle<Value>())); |
| 3403 void SetIndexedPropertyHandler( | 3468 void SetIndexedPropertyHandler( |
| 3404 IndexedPropertyGetterCallback getter, | 3469 IndexedPropertyGetterCallback getter, |
| 3405 IndexedPropertySetterCallback setter = 0, | 3470 IndexedPropertySetterCallback setter = 0, |
| 3406 IndexedPropertyQueryCallback query = 0, | 3471 IndexedPropertyQueryCallback query = 0, |
| 3407 IndexedPropertyDeleterCallback deleter = 0, | 3472 IndexedPropertyDeleterCallback deleter = 0, |
| 3408 IndexedPropertyEnumeratorCallback enumerator = 0, | 3473 IndexedPropertyEnumeratorCallback enumerator = 0, |
| 3409 Handle<Value> data = Handle<Value>()); | 3474 Handle<Value> data = Handle<Value>()); |
| 3410 | 3475 |
| 3411 /** | 3476 /** |
| 3412 * Sets the callback to be used when calling instances created from | 3477 * Sets the callback to be used when calling instances created from |
| 3413 * this template as a function. If no callback is set, instances | 3478 * this template as a function. If no callback is set, instances |
| 3414 * behave like normal JavaScript objects that cannot be called as a | 3479 * behave like normal JavaScript objects that cannot be called as a |
| 3415 * function. | 3480 * function. |
| 3416 */ | 3481 */ |
| 3417 // TODO(dcarney): deprecate | 3482 V8_DEPRECATED(void SetCallAsFunctionHandler( |
| 3418 void SetCallAsFunctionHandler(InvocationCallback callback, | 3483 InvocationCallback callback, |
| 3419 Handle<Value> data = Handle<Value>()); | 3484 Handle<Value> data = Handle<Value>())); |
| 3420 void SetCallAsFunctionHandler(FunctionCallback callback, | 3485 void SetCallAsFunctionHandler(FunctionCallback callback, |
| 3421 Handle<Value> data = Handle<Value>()); | 3486 Handle<Value> data = Handle<Value>()); |
| 3422 | 3487 |
| 3423 /** | 3488 /** |
| 3424 * Mark object instances of the template as undetectable. | 3489 * Mark object instances of the template as undetectable. |
| 3425 * | 3490 * |
| 3426 * In many ways, undetectable objects behave as though they are not | 3491 * In many ways, undetectable objects behave as though they are not |
| 3427 * there. They behave like 'undefined' in conditionals and when | 3492 * there. They behave like 'undefined' in conditionals and when |
| 3428 * printed. However, properties can be accessed and called as on | 3493 * printed. However, properties can be accessed and called as on |
| 3429 * normal objects. | 3494 * normal objects. |
| (...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5288 // the implementation of v8. | 5353 // the implementation of v8. |
| 5289 static const int kHeapObjectMapOffset = 0; | 5354 static const int kHeapObjectMapOffset = 0; |
| 5290 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; | 5355 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; |
| 5291 static const int kStringResourceOffset = 3 * kApiPointerSize; | 5356 static const int kStringResourceOffset = 3 * kApiPointerSize; |
| 5292 | 5357 |
| 5293 static const int kOddballKindOffset = 3 * kApiPointerSize; | 5358 static const int kOddballKindOffset = 3 * kApiPointerSize; |
| 5294 static const int kForeignAddressOffset = kApiPointerSize; | 5359 static const int kForeignAddressOffset = kApiPointerSize; |
| 5295 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | 5360 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; |
| 5296 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; | 5361 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; |
| 5297 static const int kContextHeaderSize = 2 * kApiPointerSize; | 5362 static const int kContextHeaderSize = 2 * kApiPointerSize; |
| 5298 static const int kContextEmbedderDataIndex = 64; | 5363 static const int kContextEmbedderDataIndex = 65; |
| 5299 static const int kFullStringRepresentationMask = 0x07; | 5364 static const int kFullStringRepresentationMask = 0x07; |
| 5300 static const int kStringEncodingMask = 0x4; | 5365 static const int kStringEncodingMask = 0x4; |
| 5301 static const int kExternalTwoByteRepresentationTag = 0x02; | 5366 static const int kExternalTwoByteRepresentationTag = 0x02; |
| 5302 static const int kExternalAsciiRepresentationTag = 0x06; | 5367 static const int kExternalAsciiRepresentationTag = 0x06; |
| 5303 | 5368 |
| 5304 static const int kIsolateStateOffset = 0; | |
| 5305 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; | 5369 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; |
| 5306 static const int kIsolateRootsOffset = 3 * kApiPointerSize; | 5370 static const int kIsolateRootsOffset = 3 * kApiPointerSize; |
| 5307 static const int kUndefinedValueRootIndex = 5; | 5371 static const int kUndefinedValueRootIndex = 5; |
| 5308 static const int kNullValueRootIndex = 7; | 5372 static const int kNullValueRootIndex = 7; |
| 5309 static const int kTrueValueRootIndex = 8; | 5373 static const int kTrueValueRootIndex = 8; |
| 5310 static const int kFalseValueRootIndex = 9; | 5374 static const int kFalseValueRootIndex = 9; |
| 5311 static const int kEmptyStringRootIndex = 131; | 5375 static const int kEmptyStringRootIndex = 131; |
| 5312 | 5376 |
| 5313 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5377 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
| 5314 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5378 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
| 5315 static const int kNodeStateMask = 0xf; | 5379 static const int kNodeStateMask = 0xf; |
| 5316 static const int kNodeStateIsWeakValue = 2; | 5380 static const int kNodeStateIsWeakValue = 2; |
| 5317 static const int kNodeStateIsNearDeathValue = 4; | 5381 static const int kNodeStateIsNearDeathValue = 4; |
| 5318 static const int kNodeIsIndependentShift = 4; | 5382 static const int kNodeIsIndependentShift = 4; |
| 5319 static const int kNodeIsPartiallyDependentShift = 5; | 5383 static const int kNodeIsPartiallyDependentShift = 5; |
| 5320 | 5384 |
| 5321 static const int kJSObjectType = 0xb0; | 5385 static const int kJSObjectType = 0xb0; |
| 5322 static const int kFirstNonstringType = 0x80; | 5386 static const int kFirstNonstringType = 0x80; |
| 5323 static const int kOddballType = 0x83; | 5387 static const int kOddballType = 0x83; |
| 5324 static const int kForeignType = 0x88; | 5388 static const int kForeignType = 0x88; |
| 5325 | 5389 |
| 5326 static const int kUndefinedOddballKind = 5; | 5390 static const int kUndefinedOddballKind = 5; |
| 5327 static const int kNullOddballKind = 3; | 5391 static const int kNullOddballKind = 3; |
| 5328 | 5392 |
| 5393 #ifdef V8_ENABLE_CHECKS |
| 5394 static void CheckInitialized(v8::Isolate* isolate); |
| 5395 #else |
| 5396 static void CheckInitialized(v8::Isolate* isolate) { } |
| 5397 #endif |
| 5398 |
| 5329 V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { | 5399 V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { |
| 5330 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | 5400 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
| 5331 kHeapObjectTag); | 5401 kHeapObjectTag); |
| 5332 } | 5402 } |
| 5333 | 5403 |
| 5334 V8_INLINE(static int SmiValue(internal::Object* value)) { | 5404 V8_INLINE(static int SmiValue(internal::Object* value)) { |
| 5335 return PlatformSmiTagging::SmiToInt(value); | 5405 return PlatformSmiTagging::SmiToInt(value); |
| 5336 } | 5406 } |
| 5337 | 5407 |
| 5338 V8_INLINE(static internal::Object* IntToSmi(int value)) { | 5408 V8_INLINE(static internal::Object* IntToSmi(int value)) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5352 V8_INLINE(static int GetOddballKind(internal::Object* obj)) { | 5422 V8_INLINE(static int GetOddballKind(internal::Object* obj)) { |
| 5353 typedef internal::Object O; | 5423 typedef internal::Object O; |
| 5354 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); | 5424 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); |
| 5355 } | 5425 } |
| 5356 | 5426 |
| 5357 V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) { | 5427 V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) { |
| 5358 int representation = (instance_type & kFullStringRepresentationMask); | 5428 int representation = (instance_type & kFullStringRepresentationMask); |
| 5359 return representation == kExternalTwoByteRepresentationTag; | 5429 return representation == kExternalTwoByteRepresentationTag; |
| 5360 } | 5430 } |
| 5361 | 5431 |
| 5362 V8_INLINE(static bool IsInitialized(v8::Isolate* isolate)) { | |
| 5363 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset; | |
| 5364 return *reinterpret_cast<int*>(addr) == 1; | |
| 5365 } | |
| 5366 | |
| 5367 V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { | 5432 V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { |
| 5368 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5433 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
| 5369 return *addr & (1 << shift); | 5434 return *addr & (1 << shift); |
| 5370 } | 5435 } |
| 5371 | 5436 |
| 5372 V8_INLINE(static void UpdateNodeFlag(internal::Object** obj, | 5437 V8_INLINE(static void UpdateNodeFlag(internal::Object** obj, |
| 5373 bool value, int shift)) { | 5438 bool value, int shift)) { |
| 5374 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5439 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
| 5375 uint8_t mask = 1 << shift; | 5440 uint8_t mask = 1 << shift; |
| 5376 *addr = (*addr & ~mask) | (value << shift); | 5441 *addr = (*addr & ~mask) | (value << shift); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5932 #ifdef V8_ENABLE_CHECKS | 5997 #ifdef V8_ENABLE_CHECKS |
| 5933 CheckCast(value); | 5998 CheckCast(value); |
| 5934 #endif | 5999 #endif |
| 5935 return static_cast<String*>(value); | 6000 return static_cast<String*>(value); |
| 5936 } | 6001 } |
| 5937 | 6002 |
| 5938 | 6003 |
| 5939 Local<String> String::Empty(Isolate* isolate) { | 6004 Local<String> String::Empty(Isolate* isolate) { |
| 5940 typedef internal::Object* S; | 6005 typedef internal::Object* S; |
| 5941 typedef internal::Internals I; | 6006 typedef internal::Internals I; |
| 5942 if (!I::IsInitialized(isolate)) return Empty(); | 6007 I::CheckInitialized(isolate); |
| 5943 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); | 6008 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); |
| 5944 return Local<String>(reinterpret_cast<String*>(slot)); | 6009 return Local<String>(reinterpret_cast<String*>(slot)); |
| 5945 } | 6010 } |
| 5946 | 6011 |
| 5947 | 6012 |
| 5948 Local<String> String::New(const char* data, int length) { | 6013 Local<String> String::New(const char* data, int length) { |
| 5949 return NewFromUtf8(Isolate::GetCurrent(), data, kNormalString, length); | 6014 return NewFromUtf8(Isolate::GetCurrent(), data, kNormalString, length); |
| 5950 } | 6015 } |
| 5951 | 6016 |
| 5952 | 6017 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6156 | 6221 |
| 6157 | 6222 |
| 6158 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { | 6223 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { |
| 6159 #ifdef V8_ENABLE_CHECKS | 6224 #ifdef V8_ENABLE_CHECKS |
| 6160 CheckCast(value); | 6225 CheckCast(value); |
| 6161 #endif | 6226 #endif |
| 6162 return static_cast<ArrayBuffer*>(value); | 6227 return static_cast<ArrayBuffer*>(value); |
| 6163 } | 6228 } |
| 6164 | 6229 |
| 6165 | 6230 |
| 6231 ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { |
| 6232 #ifdef V8_ENABLE_CHECKS |
| 6233 CheckCast(value); |
| 6234 #endif |
| 6235 return static_cast<ArrayBufferView*>(value); |
| 6236 } |
| 6237 |
| 6238 |
| 6166 TypedArray* TypedArray::Cast(v8::Value* value) { | 6239 TypedArray* TypedArray::Cast(v8::Value* value) { |
| 6167 #ifdef V8_ENABLE_CHECKS | 6240 #ifdef V8_ENABLE_CHECKS |
| 6168 CheckCast(value); | 6241 CheckCast(value); |
| 6169 #endif | 6242 #endif |
| 6170 return static_cast<TypedArray*>(value); | 6243 return static_cast<TypedArray*>(value); |
| 6171 } | 6244 } |
| 6172 | 6245 |
| 6173 | 6246 |
| 6174 Uint8Array* Uint8Array::Cast(v8::Value* value) { | 6247 Uint8Array* Uint8Array::Cast(v8::Value* value) { |
| 6175 #ifdef V8_ENABLE_CHECKS | 6248 #ifdef V8_ENABLE_CHECKS |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6236 | 6309 |
| 6237 | 6310 |
| 6238 Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) { | 6311 Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) { |
| 6239 #ifdef V8_ENABLE_CHECKS | 6312 #ifdef V8_ENABLE_CHECKS |
| 6240 CheckCast(value); | 6313 CheckCast(value); |
| 6241 #endif | 6314 #endif |
| 6242 return static_cast<Uint8ClampedArray*>(value); | 6315 return static_cast<Uint8ClampedArray*>(value); |
| 6243 } | 6316 } |
| 6244 | 6317 |
| 6245 | 6318 |
| 6319 DataView* DataView::Cast(v8::Value* value) { |
| 6320 #ifdef V8_ENABLE_CHECKS |
| 6321 CheckCast(value); |
| 6322 #endif |
| 6323 return static_cast<DataView*>(value); |
| 6324 } |
| 6325 |
| 6326 |
| 6246 Function* Function::Cast(v8::Value* value) { | 6327 Function* Function::Cast(v8::Value* value) { |
| 6247 #ifdef V8_ENABLE_CHECKS | 6328 #ifdef V8_ENABLE_CHECKS |
| 6248 CheckCast(value); | 6329 CheckCast(value); |
| 6249 #endif | 6330 #endif |
| 6250 return static_cast<Function*>(value); | 6331 return static_cast<Function*>(value); |
| 6251 } | 6332 } |
| 6252 | 6333 |
| 6253 | 6334 |
| 6254 External* External::Cast(v8::Value* value) { | 6335 External* External::Cast(v8::Value* value) { |
| 6255 #ifdef V8_ENABLE_CHECKS | 6336 #ifdef V8_ENABLE_CHECKS |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6285 | 6366 |
| 6286 template<typename T> | 6367 template<typename T> |
| 6287 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const { | 6368 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const { |
| 6288 return ReturnValue<T>(&args_[kReturnValueIndex]); | 6369 return ReturnValue<T>(&args_[kReturnValueIndex]); |
| 6289 } | 6370 } |
| 6290 | 6371 |
| 6291 | 6372 |
| 6292 Handle<Primitive> Undefined(Isolate* isolate) { | 6373 Handle<Primitive> Undefined(Isolate* isolate) { |
| 6293 typedef internal::Object* S; | 6374 typedef internal::Object* S; |
| 6294 typedef internal::Internals I; | 6375 typedef internal::Internals I; |
| 6295 if (!I::IsInitialized(isolate)) return Undefined(); | 6376 I::CheckInitialized(isolate); |
| 6296 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); | 6377 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); |
| 6297 return Handle<Primitive>(reinterpret_cast<Primitive*>(slot)); | 6378 return Handle<Primitive>(reinterpret_cast<Primitive*>(slot)); |
| 6298 } | 6379 } |
| 6299 | 6380 |
| 6300 | 6381 |
| 6301 Handle<Primitive> Null(Isolate* isolate) { | 6382 Handle<Primitive> Null(Isolate* isolate) { |
| 6302 typedef internal::Object* S; | 6383 typedef internal::Object* S; |
| 6303 typedef internal::Internals I; | 6384 typedef internal::Internals I; |
| 6304 if (!I::IsInitialized(isolate)) return Null(); | 6385 I::CheckInitialized(isolate); |
| 6305 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex); | 6386 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex); |
| 6306 return Handle<Primitive>(reinterpret_cast<Primitive*>(slot)); | 6387 return Handle<Primitive>(reinterpret_cast<Primitive*>(slot)); |
| 6307 } | 6388 } |
| 6308 | 6389 |
| 6309 | 6390 |
| 6310 Handle<Boolean> True(Isolate* isolate) { | 6391 Handle<Boolean> True(Isolate* isolate) { |
| 6311 typedef internal::Object* S; | 6392 typedef internal::Object* S; |
| 6312 typedef internal::Internals I; | 6393 typedef internal::Internals I; |
| 6313 if (!I::IsInitialized(isolate)) return True(); | 6394 I::CheckInitialized(isolate); |
| 6314 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex); | 6395 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex); |
| 6315 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); | 6396 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); |
| 6316 } | 6397 } |
| 6317 | 6398 |
| 6318 | 6399 |
| 6319 Handle<Boolean> False(Isolate* isolate) { | 6400 Handle<Boolean> False(Isolate* isolate) { |
| 6320 typedef internal::Object* S; | 6401 typedef internal::Object* S; |
| 6321 typedef internal::Internals I; | 6402 typedef internal::Internals I; |
| 6322 if (!I::IsInitialized(isolate)) return False(); | 6403 I::CheckInitialized(isolate); |
| 6323 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); | 6404 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); |
| 6324 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); | 6405 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); |
| 6325 } | 6406 } |
| 6326 | 6407 |
| 6327 | 6408 |
| 6328 void Isolate::SetData(void* data) { | 6409 void Isolate::SetData(void* data) { |
| 6329 typedef internal::Internals I; | 6410 typedef internal::Internals I; |
| 6330 I::SetEmbedderData(this, data); | 6411 I::SetEmbedderData(this, data); |
| 6331 } | 6412 } |
| 6332 | 6413 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6372 | 6453 |
| 6373 | 6454 |
| 6374 } // namespace v8 | 6455 } // namespace v8 |
| 6375 | 6456 |
| 6376 | 6457 |
| 6377 #undef V8EXPORT | 6458 #undef V8EXPORT |
| 6378 #undef TYPE_CHECK | 6459 #undef TYPE_CHECK |
| 6379 | 6460 |
| 6380 | 6461 |
| 6381 #endif // V8_H_ | 6462 #endif // V8_H_ |
| OLD | NEW |