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

Unified Diff: src/builtins.cc

Issue 669060: Add runtime function for string to array conversion. (Closed)
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/factory.h » ('j') | src/factory.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index d14953028e693c9a22ca4299fc0169ff2d9501bd..b51de33d923581d9dd7a8e529fe719a6d15a476f 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -242,16 +242,6 @@ BUILTIN(ArrayCodeGeneric) {
}
-static Object* AllocateUninitializedFixedArray(int len) {
- Object* obj = Heap::AllocateRawFixedArray(len);
- if (obj->IsFailure()) return obj;
-
- reinterpret_cast<FixedArray*>(obj)->set_map(Heap::fixed_array_map());
- FixedArray::cast(obj)->set_length(len);
- return obj;
-}
-
-
static Object* AllocateJSArray() {
JSFunction* array_function =
Top::context()->global_context()->array_function();
@@ -363,7 +353,7 @@ BUILTIN(ArrayPush) {
if (new_length > elms->length()) {
// New backing storage is needed.
int capacity = new_length + (new_length >> 1) + 16;
- Object* obj = AllocateUninitializedFixedArray(capacity);
+ Object* obj = Heap::AllocateUninitializedFixedArray(capacity);
if (obj->IsFailure()) return obj;
FixedArray* new_elms = FixedArray::cast(obj);
@@ -473,7 +463,7 @@ BUILTIN(ArrayUnshift) {
if (new_length > elms->length()) {
// New backing storage is needed.
int capacity = new_length + (new_length >> 1) + 16;
- Object* obj = AllocateUninitializedFixedArray(capacity);
+ Object* obj = Heap::AllocateUninitializedFixedArray(capacity);
if (obj->IsFailure()) return obj;
FixedArray* new_elms = FixedArray::cast(obj);
@@ -553,7 +543,7 @@ BUILTIN(ArraySlice) {
if (result->IsFailure()) return result;
JSArray* result_array = JSArray::cast(result);
- result = AllocateUninitializedFixedArray(result_len);
+ result = Heap::AllocateUninitializedFixedArray(result_len);
if (result->IsFailure()) return result;
FixedArray* result_elms = FixedArray::cast(result);
@@ -622,7 +612,7 @@ BUILTIN(ArraySplice) {
if (result->IsFailure()) return result;
JSArray* result_array = JSArray::cast(result);
- result = AllocateUninitializedFixedArray(actualDeleteCount);
+ result = Heap::AllocateUninitializedFixedArray(actualDeleteCount);
if (result->IsFailure()) return result;
FixedArray* result_elms = FixedArray::cast(result);
@@ -660,7 +650,7 @@ BUILTIN(ArraySplice) {
if (new_length > elms->length()) {
// New backing storage is needed.
int capacity = new_length + (new_length >> 1) + 16;
- Object* obj = AllocateUninitializedFixedArray(capacity);
+ Object* obj = Heap::AllocateUninitializedFixedArray(capacity);
if (obj->IsFailure()) return obj;
FixedArray* new_elms = FixedArray::cast(obj);
« no previous file with comments | « no previous file | src/factory.h » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698