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

Side by Side Diff: src/runtime.cc

Issue 24337005: Make Heap::AllocateRawFixedArray methods private. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Another minor cleanup. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 7934 matching lines...) Expand 10 before | Expand all | Expand 10 after
7945 const int length = args.smi_at(2); 7945 const int length = args.smi_at(2);
7946 7946
7947 Object* result; 7947 Object* result;
7948 { MaybeObject* maybe_result = 7948 { MaybeObject* maybe_result =
7949 isolate->heap()->AllocateArgumentsObject(callee, length); 7949 isolate->heap()->AllocateArgumentsObject(callee, length);
7950 if (!maybe_result->ToObject(&result)) return maybe_result; 7950 if (!maybe_result->ToObject(&result)) return maybe_result;
7951 } 7951 }
7952 // Allocate the elements if needed. 7952 // Allocate the elements if needed.
7953 if (length > 0) { 7953 if (length > 0) {
7954 // Allocate the fixed array. 7954 // Allocate the fixed array.
7955 Object* obj; 7955 FixedArray* array;
7956 { MaybeObject* maybe_obj = isolate->heap()->AllocateRawFixedArray(length); 7956 { MaybeObject* maybe_obj =
7957 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 7957 isolate->heap()->AllocateUninitializedFixedArray(length);
7958 if (!maybe_obj->To(&array)) return maybe_obj;
7958 } 7959 }
7959 7960
7960 DisallowHeapAllocation no_gc; 7961 DisallowHeapAllocation no_gc;
7961 FixedArray* array = reinterpret_cast<FixedArray*>(obj);
7962 array->set_map_no_write_barrier(isolate->heap()->fixed_array_map());
7963 array->set_length(length);
7964
7965 WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc); 7962 WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc);
7966 for (int i = 0; i < length; i++) { 7963 for (int i = 0; i < length; i++) {
7967 array->set(i, *--parameters, mode); 7964 array->set(i, *--parameters, mode);
7968 } 7965 }
7969 JSObject::cast(result)->set_elements(FixedArray::cast(obj)); 7966 JSObject::cast(result)->set_elements(array);
7970 } 7967 }
7971 return result; 7968 return result;
7972 } 7969 }
7973 7970
7974 7971
7975 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosureFromStubFailure) { 7972 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosureFromStubFailure) {
7976 HandleScope scope(isolate); 7973 HandleScope scope(isolate);
7977 ASSERT(args.length() == 1); 7974 ASSERT(args.length() == 1);
7978 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); 7975 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
7979 Handle<Context> context(isolate->context()); 7976 Handle<Context> context(isolate->context());
(...skipping 6828 matching lines...) Expand 10 before | Expand all | Expand 10 after
14808 // Handle last resort GC and make sure to allow future allocations 14805 // Handle last resort GC and make sure to allow future allocations
14809 // to grow the heap without causing GCs (if possible). 14806 // to grow the heap without causing GCs (if possible).
14810 isolate->counters()->gc_last_resort_from_js()->Increment(); 14807 isolate->counters()->gc_last_resort_from_js()->Increment();
14811 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14808 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14812 "Runtime::PerformGC"); 14809 "Runtime::PerformGC");
14813 } 14810 }
14814 } 14811 }
14815 14812
14816 14813
14817 } } // namespace v8::internal 14814 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698