Index: runtime/vm/intrinsifier_x64.cc |
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc |
index a034e69d36a4a0faabb46c476d9124478a9e2be0..545d426c6456c3fae80020c45f8107f3ccc0c1c3 100644 |
--- a/runtime/vm/intrinsifier_x64.cc |
+++ b/runtime/vm/intrinsifier_x64.cc |
@@ -72,7 +72,9 @@ void Intrinsifier::GrowableArray_Allocate(Assembler* assembler) { |
// Try allocating in new space. |
const Class& cls = Class::Handle( |
Isolate::Current()->object_store()->growable_object_array_class()); |
- __ TryAllocate(cls, &fall_through, Assembler::kFarJump, RAX, kNoRegister); |
+ __ TryAllocate(cls, &fall_through, Assembler::kFarJump, RAX, |
+ kNoRegister, // Pool pointer might not be loaded. |
+ R13); // temp |
// Store backing array object in growable array object. |
__ movq(RCX, Address(RSP, kArrayOffset)); // data argument. |
@@ -130,7 +132,8 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
#define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ |
Label fall_through; \ |
const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ |
- __ MaybeTraceAllocation(cid, &fall_through, false); \ |
+ __ MaybeTraceAllocation(cid, &fall_through, false, \ |
+ /* inline_isolate = */ false); \ |
__ movq(RDI, Address(RSP, kArrayLengthStackOffset)); /* Array length. */ \ |
/* Check that length is a positive Smi. */ \ |
/* RDI: requested array length argument. */ \ |
@@ -153,10 +156,9 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
__ leaq(RDI, Address(RDI, scale_factor, fixed_size)); \ |
__ andq(RDI, Immediate(-kObjectAlignment)); \ |
- Heap* heap = Isolate::Current()->heap(); \ |
- Heap::Space space = heap->SpaceForAllocation(cid); \ |
- __ movq(RAX, Immediate(heap->TopAddress(space))); \ |
- __ movq(RAX, Address(RAX, 0)); \ |
+ Heap::Space space = Heap::SpaceForAllocation(cid); \ |
+ __ movq(R13, Address(THR, Thread::heap_offset())); \ |
+ __ movq(RAX, Address(R13, Heap::TopOffset(space))); \ |
__ movq(RCX, RAX); \ |
\ |
/* RDI: allocation size. */ \ |
@@ -167,17 +169,16 @@ void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
/* RAX: potential new object start. */ \ |
/* RCX: potential next object start. */ \ |
/* RDI: allocation size. */ \ |
- /* R13: scratch register. */ \ |
- __ movq(R13, Immediate(heap->EndAddress(space))); \ |
- __ cmpq(RCX, Address(R13, 0)); \ |
+ /* R13: heap. */ \ |
+ __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); \ |
__ j(ABOVE_EQUAL, &fall_through); \ |
\ |
/* Successfully allocated the object(s), now update top to point to */ \ |
/* next object start and initialize the object. */ \ |
- __ movq(R13, Immediate(heap->TopAddress(space))); \ |
- __ movq(Address(R13, 0), RCX); \ |
+ __ movq(Address(R13, Heap::TopOffset(space)), RCX); \ |
__ addq(RAX, Immediate(kHeapObjectTag)); \ |
- __ UpdateAllocationStatsWithSize(cid, RDI, space); \ |
+ __ UpdateAllocationStatsWithSize(cid, RDI, space, \ |
+ /* inline_isolate = */ false); \ |
/* Initialize the tags. */ \ |
/* RAX: new object start as a tagged pointer. */ \ |
/* RCX: new object end address. */ \ |
@@ -1322,7 +1323,8 @@ static void DoubleArithmeticOperations(Assembler* assembler, Token::Kind kind) { |
&fall_through, |
Assembler::kFarJump, |
RAX, // Result register. |
- kNoRegister); // Pool pointer might not be loaded. |
+ kNoRegister, // Pool pointer might not be loaded. |
+ R13); // temp |
__ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); |
__ ret(); |
__ Bind(&fall_through); |
@@ -1367,7 +1369,8 @@ void Intrinsifier::Double_mulFromInteger(Assembler* assembler) { |
&fall_through, |
Assembler::kFarJump, |
RAX, // Result register. |
- kNoRegister); // Pool pointer might not be loaded. |
+ kNoRegister, // Pool pointer might not be loaded. |
+ R13); |
__ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); |
__ ret(); |
__ Bind(&fall_through); |
@@ -1389,7 +1392,8 @@ void Intrinsifier::DoubleFromInteger(Assembler* assembler) { |
&fall_through, |
Assembler::kFarJump, |
RAX, // Result register. |
- kNoRegister); // Pool pointer might not be loaded. |
+ kNoRegister, // Pool pointer might not be loaded. |
+ R13); |
__ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); |
__ ret(); |
__ Bind(&fall_through); |
@@ -1463,7 +1467,8 @@ void Intrinsifier::MathSqrt(Assembler* assembler) { |
&fall_through, |
Assembler::kFarJump, |
RAX, // Result register. |
- kNoRegister); // Pool pointer might not be loaded. |
+ kNoRegister, // Pool pointer might not be loaded. |
+ R13); |
__ movsd(FieldAddress(RAX, Double::value_offset()), XMM0); |
__ ret(); |
__ Bind(&is_smi); |
@@ -1737,7 +1742,8 @@ static void TryAllocateOnebyteString(Assembler* assembler, |
Label* ok, |
Label* failure, |
Register length_reg) { |
- __ MaybeTraceAllocation(kOneByteStringCid, failure, false); |
+ __ MaybeTraceAllocation(kOneByteStringCid, failure, false, |
+ /* inline_isolate = */ false); |
if (length_reg != RDI) { |
__ movq(RDI, length_reg); |
} |
@@ -1748,12 +1754,10 @@ static void TryAllocateOnebyteString(Assembler* assembler, |
__ leaq(RDI, Address(RDI, TIMES_1, fixed_size)); // RDI is a Smi. |
__ andq(RDI, Immediate(-kObjectAlignment)); |
- Isolate* isolate = Isolate::Current(); |
- Heap* heap = isolate->heap(); |
const intptr_t cid = kOneByteStringCid; |
- Heap::Space space = heap->SpaceForAllocation(cid); |
- __ movq(RAX, Immediate(heap->TopAddress(space))); |
- __ movq(RAX, Address(RAX, 0)); |
+ Heap::Space space = Heap::SpaceForAllocation(cid); |
+ __ movq(R13, Address(THR, Thread::heap_offset())); |
+ __ movq(RAX, Address(R13, Heap::TopOffset(space))); |
// RDI: allocation size. |
__ movq(RCX, RAX); |
@@ -1764,16 +1768,16 @@ static void TryAllocateOnebyteString(Assembler* assembler, |
// RAX: potential new object start. |
// RCX: potential next object start. |
// RDI: allocation size. |
- __ movq(R13, Immediate(heap->EndAddress(space))); |
- __ cmpq(RCX, Address(R13, 0)); |
+ // R13: heap. |
+ __ cmpq(RCX, Address(R13, Heap::EndOffset(space))); |
__ j(ABOVE_EQUAL, &pop_and_fail); |
// Successfully allocated the object(s), now update top to point to |
// next object start and initialize the object. |
- __ movq(R13, Immediate(heap->TopAddress(space))); |
- __ movq(Address(R13, 0), RCX); |
+ __ movq(Address(R13, Heap::TopOffset(space)), RCX); |
__ addq(RAX, Immediate(kHeapObjectTag)); |
- __ UpdateAllocationStatsWithSize(cid, RDI, space); |
+ __ UpdateAllocationStatsWithSize(cid, RDI, space, |
+ /* inline_isolate = */ false); |
// Initialize the tags. |
// RAX: new object start as a tagged pointer. |