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

Side by Side Diff: include/v8.h

Issue 22549003: Fix -Wconversion warnings in external V8 headers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 // 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 5526 matching lines...) Expand 10 before | Expand all | Expand 10 after
5537 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); 5537 return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
5538 } 5538 }
5539 5539
5540 V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) { 5540 V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) {
5541 int representation = (instance_type & kFullStringRepresentationMask); 5541 int representation = (instance_type & kFullStringRepresentationMask);
5542 return representation == kExternalTwoByteRepresentationTag; 5542 return representation == kExternalTwoByteRepresentationTag;
5543 } 5543 }
5544 5544
5545 V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { 5545 V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) {
5546 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 5546 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5547 return *addr & (1 << shift); 5547 return *addr & static_cast<uint8_t>(1U << shift);
5548 } 5548 }
5549 5549
5550 V8_INLINE(static void UpdateNodeFlag(internal::Object** obj, 5550 V8_INLINE(static void UpdateNodeFlag(internal::Object** obj,
5551 bool value, int shift)) { 5551 bool value, int shift)) {
5552 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 5552 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5553 uint8_t mask = 1 << shift; 5553 uint8_t mask = static_cast<uint8_t>(1 << shift);
5554 *addr = (*addr & ~mask) | (value << shift); 5554 *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift));
5555 } 5555 }
5556 5556
5557 V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) { 5557 V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) {
5558 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 5558 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5559 return *addr & kNodeStateMask; 5559 return *addr & kNodeStateMask;
5560 } 5560 }
5561 5561
5562 V8_INLINE(static void UpdateNodeState(internal::Object** obj, 5562 V8_INLINE(static void UpdateNodeState(internal::Object** obj,
5563 uint8_t value)) { 5563 uint8_t value)) {
5564 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 5564 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5565 *addr = (*addr & ~kNodeStateMask) | value; 5565 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
5566 } 5566 }
5567 5567
5568 V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) { 5568 V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) {
5569 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + 5569 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
5570 kIsolateEmbedderDataOffset; 5570 kIsolateEmbedderDataOffset;
5571 *reinterpret_cast<void**>(addr) = data; 5571 *reinterpret_cast<void**>(addr) = data;
5572 } 5572 }
5573 5573
5574 V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) { 5574 V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) {
5575 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + 5575 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 return; 5920 return;
5921 } 5921 }
5922 Set(Integer::New(i, GetIsolate())); 5922 Set(Integer::New(i, GetIsolate()));
5923 } 5923 }
5924 5924
5925 template<typename T> 5925 template<typename T>
5926 void ReturnValue<T>::Set(uint32_t i) { 5926 void ReturnValue<T>::Set(uint32_t i) {
5927 TYPE_CHECK(T, Integer); 5927 TYPE_CHECK(T, Integer);
5928 typedef internal::Internals I; 5928 typedef internal::Internals I;
5929 // Can't simply use INT32_MAX here for whatever reason. 5929 // Can't simply use INT32_MAX here for whatever reason.
5930 bool fits_into_int32_t = (i & (1 << 31)) == 0; 5930 bool fits_into_int32_t = (i & (1U << 31)) == 0;
5931 if (V8_LIKELY(fits_into_int32_t)) { 5931 if (V8_LIKELY(fits_into_int32_t)) {
5932 Set(static_cast<int32_t>(i)); 5932 Set(static_cast<int32_t>(i));
5933 return; 5933 return;
5934 } 5934 }
5935 Set(Integer::NewFromUnsigned(i, GetIsolate())); 5935 Set(Integer::NewFromUnsigned(i, GetIsolate()));
5936 } 5936 }
5937 5937
5938 template<typename T> 5938 template<typename T>
5939 void ReturnValue<T>::Set(bool value) { 5939 void ReturnValue<T>::Set(bool value) {
5940 TYPE_CHECK(T, Boolean); 5940 TYPE_CHECK(T, Boolean);
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
6586 */ 6586 */
6587 6587
6588 6588
6589 } // namespace v8 6589 } // namespace v8
6590 6590
6591 6591
6592 #undef TYPE_CHECK 6592 #undef TYPE_CHECK
6593 6593
6594 6594
6595 #endif // V8_H_ 6595 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698