Commit 13e4b7d8 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Force inlining CopyChars and String::Get.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10332054

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11527 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9889994c
...@@ -345,6 +345,9 @@ F FUNCTION_CAST(Address addr) { ...@@ -345,6 +345,9 @@ F FUNCTION_CAST(Address addr) {
#define INLINE(header) inline __attribute__((always_inline)) header #define INLINE(header) inline __attribute__((always_inline)) header
#define NO_INLINE(header) __attribute__((noinline)) header #define NO_INLINE(header) __attribute__((noinline)) header
#endif #endif
#elif defined(_MSC_VER) && !defined(DEBUG)
#define INLINE(header) __forceinline header
#define NO_INLINE(header) header
#else #else
#define INLINE(header) inline header #define INLINE(header) inline header
#define NO_INLINE(header) header #define NO_INLINE(header) header
......
...@@ -6888,7 +6888,7 @@ class String: public HeapObject { ...@@ -6888,7 +6888,7 @@ class String: public HeapObject {
inline void Set(int index, uint16_t value); inline void Set(int index, uint16_t value);
// Get individual two byte char in the string. Repeated calls // Get individual two byte char in the string. Repeated calls
// to this method are not efficient unless the string is flat. // to this method are not efficient unless the string is flat.
inline uint16_t Get(int index); INLINE(uint16_t Get(int index));
// Try to flatten the string. Checks first inline to see if it is // Try to flatten the string. Checks first inline to see if it is
// necessary. Does nothing if the string is not a cons string. // necessary. Does nothing if the string is not a cons string.
......
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -199,10 +199,13 @@ Vector<const char> ReadFile(FILE* file, ...@@ -199,10 +199,13 @@ Vector<const char> ReadFile(FILE* file,
bool verbose = true); bool verbose = true);
// Copy from ASCII/16bit chars to ASCII/16bit chars. // Copy from ASCII/16bit chars to ASCII/16bit chars.
template <typename sourcechar, typename sinkchar> template <typename sourcechar, typename sinkchar>
inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { INLINE(void 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; sinkchar* limit = dest + chars;
#ifdef V8_HOST_CAN_READ_UNALIGNED #ifdef V8_HOST_CAN_READ_UNALIGNED
if (sizeof(*dest) == sizeof(*src)) { if (sizeof(*dest) == sizeof(*src)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment