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

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 1226143011: Trace allocation of arrays (Closed) Base URL: git@github.com:dart-lang/sdk.git@try_allocate_realz
Patch Set: Created 5 years, 5 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 | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 1c33d47f161ebdf0e646a4d57068f7ca374d0a8c..e50c2604e9c5eadb58636d5648637fd31d3026ec 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -611,13 +611,20 @@ void StubCode::GeneratePatchableAllocateArrayStub(Assembler* assembler,
__ LoadPoolPointer(new_pp);
*entry_patch_offset = assembler->CodeSize();
Label slow_case;
+ Isolate* isolate = Isolate::Current();
+ const Class& cls = Class::Handle(isolate->object_store()->array_class());
+ ASSERT(!cls.IsNull());
// Compute the size to be allocated, it is based on the array length
// and is computed as:
// RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
__ movq(RDI, R10); // Array Length.
// Check that length is a positive Smi.
__ testq(RDI, Immediate(kSmiTagMask));
- __ j(NOT_ZERO, &slow_case);
+ if (FLAG_use_slow_path || cls.trace_allocation()) {
+ __ jmp(&slow_case);
+ } else {
+ __ j(NOT_ZERO, &slow_case);
+ }
__ cmpq(RDI, Immediate(0));
__ j(LESS, &slow_case);
// Check for maximum allowed length.
@@ -630,7 +637,6 @@ void StubCode::GeneratePatchableAllocateArrayStub(Assembler* assembler,
ASSERT(kSmiTagShift == 1);
__ andq(RDI, Immediate(-kObjectAlignment));
- Isolate* isolate = Isolate::Current();
Heap* heap = isolate->heap();
const intptr_t cid = kArrayCid;
Heap::Space space = heap->SpaceForAllocation(cid);
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698