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

Unified Diff: src/allocation.cc

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/allocation.h ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/allocation.cc
===================================================================
--- src/allocation.cc (revision 5846)
+++ src/allocation.cc (working copy)
@@ -27,16 +27,21 @@
#include <stdlib.h>
-#include "v8.h"
+#include "../include/v8stdint.h"
+#include "globals.h"
+#include "checks.h"
+#include "allocation.h"
+#include "utils.h"
namespace v8 {
namespace internal {
-
void* Malloced::New(size_t size) {
ASSERT(NativeAllocationChecker::allocation_allowed());
void* result = malloc(size);
- if (result == NULL) V8::FatalProcessOutOfMemory("Malloced operator new");
+ if (result == NULL) {
+ v8::internal::FatalProcessOutOfMemory("Malloced operator new");
+ }
return result;
}
@@ -47,7 +52,7 @@
void Malloced::FatalProcessOutOfMemory() {
- V8::FatalProcessOutOfMemory("Out of memory");
+ v8::internal::FatalProcessOutOfMemory("Out of memory");
}
@@ -82,7 +87,7 @@
char* StrDup(const char* str) {
int length = StrLength(str);
char* result = NewArray<char>(length + 1);
- memcpy(result, str, length * kCharSize);
+ memcpy(result, str, length);
result[length] = '\0';
return result;
}
@@ -92,7 +97,7 @@
int length = StrLength(str);
if (n < length) length = n;
char* result = NewArray<char>(length + 1);
- memcpy(result, str, length * kCharSize);
+ memcpy(result, str, length);
result[length] = '\0';
return result;
}
@@ -124,6 +129,7 @@
}
ASSERT(free_list_.next_ != &free_list_);
ASSERT(free_list_.previous_ != &free_list_);
+
size = (size + kPointerSize - 1) & ~(kPointerSize - 1);
// Search for exact fit.
for (PreallocatedStorage* storage = free_list_.next_;
« no previous file with comments | « src/allocation.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698