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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 bool IsRegExp() const; | 1355 bool IsRegExp() const; |
1356 | 1356 |
1357 | 1357 |
1358 /** | 1358 /** |
1359 * Returns true if this value is an ArrayBuffer. | 1359 * Returns true if this value is an ArrayBuffer. |
1360 * This is an experimental feature. | 1360 * This is an experimental feature. |
1361 */ | 1361 */ |
1362 bool IsArrayBuffer() const; | 1362 bool IsArrayBuffer() const; |
1363 | 1363 |
1364 /** | 1364 /** |
| 1365 * Returns true if this value is an ArrayBufferView. |
| 1366 * This is an experimental feature. |
| 1367 */ |
| 1368 bool IsArrayBufferView() const; |
| 1369 |
| 1370 /** |
1365 * Returns true if this value is one of TypedArrays. | 1371 * Returns true if this value is one of TypedArrays. |
1366 * This is an experimental feature. | 1372 * This is an experimental feature. |
1367 */ | 1373 */ |
1368 bool IsTypedArray() const; | 1374 bool IsTypedArray() const; |
1369 | 1375 |
1370 /** | 1376 /** |
1371 * Returns true if this value is an Uint8Array. | 1377 * Returns true if this value is an Uint8Array. |
1372 * This is an experimental feature. | 1378 * This is an experimental feature. |
1373 */ | 1379 */ |
1374 bool IsUint8Array() const; | 1380 bool IsUint8Array() const; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 * This is an experimental feature. | 1420 * This is an experimental feature. |
1415 */ | 1421 */ |
1416 bool IsFloat32Array() const; | 1422 bool IsFloat32Array() const; |
1417 | 1423 |
1418 /** | 1424 /** |
1419 * Returns true if this value is a Float64Array. | 1425 * Returns true if this value is a Float64Array. |
1420 * This is an experimental feature. | 1426 * This is an experimental feature. |
1421 */ | 1427 */ |
1422 bool IsFloat64Array() const; | 1428 bool IsFloat64Array() const; |
1423 | 1429 |
| 1430 /** |
| 1431 * Returns true if this value is a DataView. |
| 1432 * This is an experimental feature. |
| 1433 */ |
| 1434 bool IsDataView() const; |
| 1435 |
1424 Local<Boolean> ToBoolean() const; | 1436 Local<Boolean> ToBoolean() const; |
1425 Local<Number> ToNumber() const; | 1437 Local<Number> ToNumber() const; |
1426 Local<String> ToString() const; | 1438 Local<String> ToString() const; |
1427 Local<String> ToDetailString() const; | 1439 Local<String> ToDetailString() const; |
1428 Local<Object> ToObject() const; | 1440 Local<Object> ToObject() const; |
1429 Local<Integer> ToInteger() const; | 1441 Local<Integer> ToInteger() const; |
1430 Local<Uint32> ToUint32() const; | 1442 Local<Uint32> ToUint32() const; |
1431 Local<Int32> ToInt32() const; | 1443 Local<Int32> ToInt32() const; |
1432 | 1444 |
1433 /** | 1445 /** |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2452 | 2464 |
2453 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; | 2465 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; |
2454 | 2466 |
2455 private: | 2467 private: |
2456 ArrayBuffer(); | 2468 ArrayBuffer(); |
2457 static void CheckCast(Value* obj); | 2469 static void CheckCast(Value* obj); |
2458 }; | 2470 }; |
2459 | 2471 |
2460 | 2472 |
2461 /** | 2473 /** |
| 2474 * A base class for an instance of one of "views" over ArrayBuffer, |
| 2475 * including TypedArrays and DataView (ES6 draft 15.13). |
| 2476 * |
| 2477 * This API is experimental and may change significantly. |
| 2478 */ |
| 2479 class V8EXPORT ArrayBufferView : public Object { |
| 2480 public: |
| 2481 /** |
| 2482 * Returns underlying ArrayBuffer. |
| 2483 */ |
| 2484 Local<ArrayBuffer> Buffer(); |
| 2485 /** |
| 2486 * Byte offset in |Buffer|. |
| 2487 */ |
| 2488 size_t ByteOffset(); |
| 2489 /** |
| 2490 * Size of a view in bytes. |
| 2491 */ |
| 2492 size_t ByteLength(); |
| 2493 /** |
| 2494 * Base address of a view. |
| 2495 */ |
| 2496 void* BaseAddress(); |
| 2497 |
| 2498 V8_INLINE(static ArrayBufferView* Cast(Value* obj)); |
| 2499 |
| 2500 private: |
| 2501 ArrayBufferView(); |
| 2502 static void CheckCast(Value* obj); |
| 2503 }; |
| 2504 |
| 2505 |
| 2506 /** |
2462 * A base class for an instance of TypedArray series of constructors | 2507 * A base class for an instance of TypedArray series of constructors |
2463 * (ES6 draft 15.13.6). | 2508 * (ES6 draft 15.13.6). |
2464 * This API is experimental and may change significantly. | 2509 * This API is experimental and may change significantly. |
2465 */ | 2510 */ |
2466 class V8EXPORT TypedArray : public Object { | 2511 class V8EXPORT TypedArray : public ArrayBufferView { |
2467 public: | 2512 public: |
2468 /** | 2513 /** |
2469 * Returns underlying ArrayBuffer. | 2514 * Number of elements in this typed array |
2470 */ | 2515 * (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 */ | 2516 */ |
2479 size_t Length(); | 2517 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 | 2518 |
2489 V8_INLINE(static TypedArray* Cast(Value* obj)); | 2519 V8_INLINE(static TypedArray* Cast(Value* obj)); |
2490 | 2520 |
2491 private: | 2521 private: |
2492 TypedArray(); | 2522 TypedArray(); |
2493 static void CheckCast(Value* obj); | 2523 static void CheckCast(Value* obj); |
2494 }; | 2524 }; |
2495 | 2525 |
2496 | 2526 |
2497 /** | 2527 /** |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2631 size_t byte_offset, size_t length); | 2661 size_t byte_offset, size_t length); |
2632 V8_INLINE(static Float64Array* Cast(Value* obj)); | 2662 V8_INLINE(static Float64Array* Cast(Value* obj)); |
2633 | 2663 |
2634 private: | 2664 private: |
2635 Float64Array(); | 2665 Float64Array(); |
2636 static void CheckCast(Value* obj); | 2666 static void CheckCast(Value* obj); |
2637 }; | 2667 }; |
2638 | 2668 |
2639 | 2669 |
2640 /** | 2670 /** |
| 2671 * An instance of DataView constructor (ES6 draft 15.13.7). |
| 2672 * This API is experimental and may change significantly. |
| 2673 */ |
| 2674 class V8EXPORT DataView : public ArrayBufferView { |
| 2675 public: |
| 2676 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, |
| 2677 size_t byte_offset, size_t length); |
| 2678 V8_INLINE(static DataView* Cast(Value* obj)); |
| 2679 |
| 2680 private: |
| 2681 DataView(); |
| 2682 static void CheckCast(Value* obj); |
| 2683 }; |
| 2684 |
| 2685 |
| 2686 /** |
2641 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2687 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2642 */ | 2688 */ |
2643 class V8EXPORT Date : public Object { | 2689 class V8EXPORT Date : public Object { |
2644 public: | 2690 public: |
2645 static Local<Value> New(double time); | 2691 static Local<Value> New(double time); |
2646 | 2692 |
2647 /** | 2693 /** |
2648 * A specialization of Value::NumberValue that is more efficient | 2694 * A specialization of Value::NumberValue that is more efficient |
2649 * because we know the structure of this object. | 2695 * because we know the structure of this object. |
2650 */ | 2696 */ |
(...skipping 3505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6156 | 6202 |
6157 | 6203 |
6158 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { | 6204 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { |
6159 #ifdef V8_ENABLE_CHECKS | 6205 #ifdef V8_ENABLE_CHECKS |
6160 CheckCast(value); | 6206 CheckCast(value); |
6161 #endif | 6207 #endif |
6162 return static_cast<ArrayBuffer*>(value); | 6208 return static_cast<ArrayBuffer*>(value); |
6163 } | 6209 } |
6164 | 6210 |
6165 | 6211 |
| 6212 ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { |
| 6213 #ifdef V8_ENABLE_CHECKS |
| 6214 CheckCast(value); |
| 6215 #endif |
| 6216 return static_cast<ArrayBufferView*>(value); |
| 6217 } |
| 6218 |
| 6219 |
6166 TypedArray* TypedArray::Cast(v8::Value* value) { | 6220 TypedArray* TypedArray::Cast(v8::Value* value) { |
6167 #ifdef V8_ENABLE_CHECKS | 6221 #ifdef V8_ENABLE_CHECKS |
6168 CheckCast(value); | 6222 CheckCast(value); |
6169 #endif | 6223 #endif |
6170 return static_cast<TypedArray*>(value); | 6224 return static_cast<TypedArray*>(value); |
6171 } | 6225 } |
6172 | 6226 |
6173 | 6227 |
6174 Uint8Array* Uint8Array::Cast(v8::Value* value) { | 6228 Uint8Array* Uint8Array::Cast(v8::Value* value) { |
6175 #ifdef V8_ENABLE_CHECKS | 6229 #ifdef V8_ENABLE_CHECKS |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6236 | 6290 |
6237 | 6291 |
6238 Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) { | 6292 Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) { |
6239 #ifdef V8_ENABLE_CHECKS | 6293 #ifdef V8_ENABLE_CHECKS |
6240 CheckCast(value); | 6294 CheckCast(value); |
6241 #endif | 6295 #endif |
6242 return static_cast<Uint8ClampedArray*>(value); | 6296 return static_cast<Uint8ClampedArray*>(value); |
6243 } | 6297 } |
6244 | 6298 |
6245 | 6299 |
| 6300 DataView* DataView::Cast(v8::Value* value) { |
| 6301 #ifdef V8_ENABLE_CHECKS |
| 6302 CheckCast(value); |
| 6303 #endif |
| 6304 return static_cast<DataView*>(value); |
| 6305 } |
| 6306 |
| 6307 |
6246 Function* Function::Cast(v8::Value* value) { | 6308 Function* Function::Cast(v8::Value* value) { |
6247 #ifdef V8_ENABLE_CHECKS | 6309 #ifdef V8_ENABLE_CHECKS |
6248 CheckCast(value); | 6310 CheckCast(value); |
6249 #endif | 6311 #endif |
6250 return static_cast<Function*>(value); | 6312 return static_cast<Function*>(value); |
6251 } | 6313 } |
6252 | 6314 |
6253 | 6315 |
6254 External* External::Cast(v8::Value* value) { | 6316 External* External::Cast(v8::Value* value) { |
6255 #ifdef V8_ENABLE_CHECKS | 6317 #ifdef V8_ENABLE_CHECKS |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6372 | 6434 |
6373 | 6435 |
6374 } // namespace v8 | 6436 } // namespace v8 |
6375 | 6437 |
6376 | 6438 |
6377 #undef V8EXPORT | 6439 #undef V8EXPORT |
6378 #undef TYPE_CHECK | 6440 #undef TYPE_CHECK |
6379 | 6441 |
6380 | 6442 |
6381 #endif // V8_H_ | 6443 #endif // V8_H_ |
OLD | NEW |