Reviewers: Jakob,

Message:
PTAL.

Description:
Force inlining CopyChars and String::Get.

BUG=
TEST=


Please review this at http://codereview.chromium.org/10332054/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/globals.h
  M src/objects.h
  M src/v8utils.h


Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index 25d4ffe89bd98ec68d070cd00269941b41609f17..ff6a26f357179caef9cb23a8fdac5f1637c910db 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -345,6 +345,9 @@ F FUNCTION_CAST(Address addr) {
 #define INLINE(header) inline __attribute__((always_inline)) header
 #define NO_INLINE(header) __attribute__((noinline)) header
 #endif
+#elif defined(_MSC_VER)
+#define INLINE(header) __forceinline header
+#define NO_INLINE(header) header
 #else
 #define INLINE(header) inline header
 #define NO_INLINE(header) header
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e3a1fd0d25c53f5874718fe86510a047082f768b..7cc3c6c17f06d38c33a7939d19c9737747d60655 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6886,7 +6886,7 @@ class String: public HeapObject {
   inline void Set(int index, uint16_t value);
   // Get individual two byte char in the string.  Repeated calls
   // to this method are not efficient unless the string is flat.
-  inline uint16_t Get(int index);
+  uint16_t INLINE(Get(int index));

   // Try to flatten the string.  Checks first inline to see if it is
   // necessary.  Does nothing if the string is not a cons string.
Index: src/v8utils.h
diff --git a/src/v8utils.h b/src/v8utils.h
index c73222a29b489cdce94285af574e1c6aa1acd76e..d6a6b253685840cb7592282daed08500a6f3b747 100644
--- a/src/v8utils.h
+++ b/src/v8utils.h
@@ -199,10 +199,13 @@ Vector<const char> ReadFile(FILE* file,
                             bool verbose = true);


-
 // Copy from ASCII/16bit chars to ASCII/16bit chars.
 template <typename sourcechar, typename sinkchar>
-inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
+void INLINE(CopyChars(sinkchar* dest, const sourcechar* src, int chars));
+
+
+template <typename sourcechar, typename sinkchar>
+void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
   sinkchar* limit = dest + chars;
 #ifdef V8_HOST_CAN_READ_UNALIGNED
   if (sizeof(*dest) == sizeof(*src)) {


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to