| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 | 74 |
| 75 void AllStatic::operator delete(void* p) { | 75 void AllStatic::operator delete(void* p) { |
| 76 UNREACHABLE(); | 76 UNREACHABLE(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 | 81 |
| 82 char* StrDup(const char* str) { | 82 char* StrDup(const char* str) { |
| 83 int length = strlen(str); | 83 int length = StrLength(str); |
| 84 char* result = NewArray<char>(length + 1); | 84 char* result = NewArray<char>(length + 1); |
| 85 memcpy(result, str, length * kCharSize); | 85 memcpy(result, str, length * kCharSize); |
| 86 result[length] = '\0'; | 86 result[length] = '\0'; |
| 87 return result; | 87 return result; |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 char* StrNDup(const char* str, size_t n) { | 91 char* StrNDup(const char* str, int n) { |
| 92 size_t length = strlen(str); | 92 int length = StrLength(str); |
| 93 if (n < length) length = n; | 93 if (n < length) length = n; |
| 94 char* result = NewArray<char>(length + 1); | 94 char* result = NewArray<char>(length + 1); |
| 95 memcpy(result, str, length * kCharSize); | 95 memcpy(result, str, length * kCharSize); |
| 96 result[length] = '\0'; | 96 result[length] = '\0'; |
| 97 return result; | 97 return result; |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 int NativeAllocationChecker::allocation_disallowed_ = 0; | 101 int NativeAllocationChecker::allocation_disallowed_ = 0; |
| 102 | 102 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 previous_->next_ = next_; | 189 previous_->next_ = next_; |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| 193 PreallocatedStorage::PreallocatedStorage(size_t size) | 193 PreallocatedStorage::PreallocatedStorage(size_t size) |
| 194 : size_(size) { | 194 : size_(size) { |
| 195 previous_ = next_ = this; | 195 previous_ = next_ = this; |
| 196 } | 196 } |
| 197 | 197 |
| 198 } } // namespace v8::internal | 198 } } // namespace v8::internal |
| OLD | NEW |