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

Side by Side Diff: include/v8.h

Issue 1003663002: Add Cast() for Int32 and Uint32 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 static void CheckCast(v8::Value* obj); 2458 static void CheckCast(v8::Value* obj);
2459 }; 2459 };
2460 2460
2461 2461
2462 /** 2462 /**
2463 * A JavaScript value representing a 32-bit signed integer. 2463 * A JavaScript value representing a 32-bit signed integer.
2464 */ 2464 */
2465 class V8_EXPORT Int32 : public Integer { 2465 class V8_EXPORT Int32 : public Integer {
2466 public: 2466 public:
2467 int32_t Value() const; 2467 int32_t Value() const;
2468 V8_INLINE static Int32* Cast(v8::Value* obj);
2469
2468 private: 2470 private:
2469 Int32(); 2471 Int32();
2472 static void CheckCast(v8::Value* obj);
2470 }; 2473 };
2471 2474
2472 2475
2473 /** 2476 /**
2474 * A JavaScript value representing a 32-bit unsigned integer. 2477 * A JavaScript value representing a 32-bit unsigned integer.
2475 */ 2478 */
2476 class V8_EXPORT Uint32 : public Integer { 2479 class V8_EXPORT Uint32 : public Integer {
2477 public: 2480 public:
2478 uint32_t Value() const; 2481 uint32_t Value() const;
2482 V8_INLINE static Uint32* Cast(v8::Value* obj);
2483
2479 private: 2484 private:
2480 Uint32(); 2485 Uint32();
2486 static void CheckCast(v8::Value* obj);
2481 }; 2487 };
2482 2488
2483 2489
2484 enum PropertyAttribute { 2490 enum PropertyAttribute {
2485 None = 0, 2491 None = 0,
2486 ReadOnly = 1 << 0, 2492 ReadOnly = 1 << 0,
2487 DontEnum = 1 << 1, 2493 DontEnum = 1 << 1,
2488 DontDelete = 1 << 2 2494 DontDelete = 1 << 2
2489 }; 2495 };
2490 2496
(...skipping 4866 matching lines...) Expand 10 before | Expand all | Expand 10 after
7357 7363
7358 7364
7359 Integer* Integer::Cast(v8::Value* value) { 7365 Integer* Integer::Cast(v8::Value* value) {
7360 #ifdef V8_ENABLE_CHECKS 7366 #ifdef V8_ENABLE_CHECKS
7361 CheckCast(value); 7367 CheckCast(value);
7362 #endif 7368 #endif
7363 return static_cast<Integer*>(value); 7369 return static_cast<Integer*>(value);
7364 } 7370 }
7365 7371
7366 7372
7373 Int32* Int32::Cast(v8::Value* value) {
7374 #ifdef V8_ENABLE_CHECKS
7375 CheckCast(value);
7376 #endif
7377 return static_cast<Int32*>(value);
7378 }
7379
7380
7381 Uint32* Uint32::Cast(v8::Value* value) {
7382 #ifdef V8_ENABLE_CHECKS
7383 CheckCast(value);
7384 #endif
7385 return static_cast<Uint32*>(value);
7386 }
7387
7388
7367 Date* Date::Cast(v8::Value* value) { 7389 Date* Date::Cast(v8::Value* value) {
7368 #ifdef V8_ENABLE_CHECKS 7390 #ifdef V8_ENABLE_CHECKS
7369 CheckCast(value); 7391 CheckCast(value);
7370 #endif 7392 #endif
7371 return static_cast<Date*>(value); 7393 return static_cast<Date*>(value);
7372 } 7394 }
7373 7395
7374 7396
7375 StringObject* StringObject::Cast(v8::Value* value) { 7397 StringObject* StringObject::Cast(v8::Value* value) {
7376 #ifdef V8_ENABLE_CHECKS 7398 #ifdef V8_ENABLE_CHECKS
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
7846 */ 7868 */
7847 7869
7848 7870
7849 } // namespace v8 7871 } // namespace v8
7850 7872
7851 7873
7852 #undef TYPE_CHECK 7874 #undef TYPE_CHECK
7853 7875
7854 7876
7855 #endif // V8_H_ 7877 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698