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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 22825023: Uses an object pool on x64 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 26726)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -96,20 +96,16 @@
__ Bind(&done);
}
#endif
- __ LeaveFrame();
+ __ LeaveFrame(true);
__ ret();
- // Generate 8 bytes of NOPs so that the debugger can patch the
+ // Generate 4 bytes of NOPs so that the debugger can patch the
// return pattern with a call to the debug stub.
// Note that the nop(8) byte pattern is not recognized by the debugger.
__ nop(1);
__ nop(1);
__ nop(1);
__ nop(1);
- __ nop(1);
- __ nop(1);
- __ nop(1);
- __ nop(1);
compiler->AddCurrentDescriptor(PcDescriptors::kReturn,
Isolate::kNoDeoptId,
token_pos());
@@ -315,7 +311,7 @@
// The register allocator drops constant definitions that have no uses.
if (!locs()->out().IsInvalid()) {
Register result = locs()->out().reg();
- __ LoadObject(result, value());
+ __ LoadObject(result, value(), Assembler::kNotPatchable);
}
}
@@ -464,12 +460,11 @@
const Array& kNoArgumentNames = Object::null_array();
const int kNumArgumentsChecked = 2;
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
Label check_identity;
- __ cmpq(Address(RSP, 0 * kWordSize), raw_null);
+ __ LoadObject(TMP, Object::Handle(Object::null()));
+ __ cmpq(Address(RSP, 0 * kWordSize), TMP);
__ j(EQUAL, &check_identity);
- __ cmpq(Address(RSP, 1 * kWordSize), raw_null);
+ __ cmpq(Address(RSP, 1 * kWordSize), TMP);
__ j(EQUAL, &check_identity);
ICData& equality_ic_data = ICData::ZoneHandle(original_ic_data.raw());
@@ -510,10 +505,12 @@
__ popq(RDX);
__ cmpq(RAX, RDX);
__ j(EQUAL, &is_true);
- __ LoadObject(RAX, (kind == Token::kEQ) ? Bool::False() : Bool::True());
+ __ LoadObject(RAX, (kind == Token::kEQ) ? Bool::False() : Bool::True(),
+ Assembler::kNotPatchable);
__ jmp(&equality_done);
__ Bind(&is_true);
- __ LoadObject(RAX, (kind == Token::kEQ) ? Bool::True() : Bool::False());
+ __ LoadObject(RAX, (kind == Token::kEQ) ? Bool::True() : Bool::False(),
+ Assembler::kNotPatchable);
if (kind == Token::kNE) {
// Skip not-equal result conversion.
__ jmp(&equality_done);
@@ -536,10 +533,10 @@
// Negate the condition: true label returns false and vice versa.
__ CompareObject(RAX, Bool::True());
__ j(EQUAL, &true_label, Assembler::kNearJump);
- __ LoadObject(RAX, Bool::True());
+ __ LoadObject(RAX, Bool::True(), Assembler::kNotPatchable);
__ jmp(&done, Assembler::kNearJump);
__ Bind(&true_label);
- __ LoadObject(RAX, Bool::False());
+ __ LoadObject(RAX, Bool::False(), Assembler::kNotPatchable);
__ Bind(&done);
}
__ Bind(&equality_done);
@@ -609,10 +606,10 @@
Register result = locs->out().reg();
Label load_true;
__ j(cond, &load_true, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
+ __ LoadObject(result, Bool::False(), Assembler::kNotPatchable);
__ jmp(&done);
__ Bind(&load_true);
- __ LoadObject(result, Bool::True());
+ __ LoadObject(result, Bool::True(), Assembler::kNotPatchable);
}
} else {
const int kNumberOfArguments = 2;
@@ -628,10 +625,10 @@
Label false_label;
__ CompareObject(RAX, Bool::True());
__ j(EQUAL, &false_label, Assembler::kNearJump);
- __ LoadObject(RAX, Bool::True());
+ __ LoadObject(RAX, Bool::True(), Assembler::kNotPatchable);
__ jmp(&done);
__ Bind(&false_label);
- __ LoadObject(RAX, Bool::False());
+ __ LoadObject(RAX, Bool::False(), Assembler::kNotPatchable);
}
} else {
if (branch->is_checked()) {
@@ -665,12 +662,11 @@
__ testq(left, Immediate(kSmiTagMask));
__ j(ZERO, deopt);
// 'left' is not Smi.
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
+
Label identity_compare;
- __ cmpq(right, raw_null);
+ __ CompareObject(right, Object::Handle(Object::null()));
__ j(EQUAL, &identity_compare);
- __ cmpq(left, raw_null);
+ __ CompareObject(left, Object::Handle(Object::null()));
__ j(EQUAL, &identity_compare);
__ LoadClassId(temp, left);
@@ -691,10 +687,12 @@
Register result = locs.out().reg();
__ j(EQUAL, &is_equal, Assembler::kNearJump);
// Not equal.
- __ LoadObject(result, (kind == Token::kEQ) ? Bool::False() : Bool::True());
+ __ LoadObject(result, (kind == Token::kEQ) ? Bool::False() : Bool::True(),
+ Assembler::kNotPatchable);
__ jmp(&done, Assembler::kNearJump);
__ Bind(&is_equal);
- __ LoadObject(result, (kind == Token::kEQ) ? Bool::True() : Bool::False());
+ __ LoadObject(result, (kind == Token::kEQ) ? Bool::True() : Bool::False(),
+ Assembler::kNotPatchable);
__ Bind(&done);
} else {
Condition cond = TokenKindToSmiCondition(kind);
@@ -717,12 +715,11 @@
ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0));
Register left = locs->in(0).reg();
Register right = locs->in(1).reg();
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
+
Label done, identity_compare, non_null_compare;
- __ cmpq(right, raw_null);
+ __ CompareObject(right, Object::Handle(Object::null()));
__ j(EQUAL, &identity_compare, Assembler::kNearJump);
- __ cmpq(left, raw_null);
+ __ CompareObject(left, Object::Handle(Object::null()));
__ j(NOT_EQUAL, &non_null_compare, Assembler::kNearJump);
// Comparison with NULL is "===".
__ Bind(&identity_compare);
@@ -734,10 +731,10 @@
Register result = locs->out().reg();
Label load_true;
__ j(cond, &load_true, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
+ __ LoadObject(result, Bool::False(), Assembler::kNotPatchable);
__ jmp(&done);
__ Bind(&load_true);
- __ LoadObject(result, Bool::True());
+ __ LoadObject(result, Bool::True(), Assembler::kNotPatchable);
}
__ jmp(&done);
__ Bind(&non_null_compare); // Receiver is not null.
@@ -795,10 +792,10 @@
Register result = locs.out().reg();
Label done, is_true;
__ j(true_condition, &is_true);
- __ LoadObject(result, Bool::False());
+ __ LoadObject(result, Bool::False(), Assembler::kNotPatchable);
__ jmp(&done);
__ Bind(&is_true);
- __ LoadObject(result, Bool::True());
+ __ LoadObject(result, Bool::True(), Assembler::kNotPatchable);
__ Bind(&done);
}
}
@@ -1601,7 +1598,8 @@
ASSERT((field_reg != value_reg) && (field_reg != value_cid_reg));
}
- __ LoadObject(field_reg, Field::ZoneHandle(field().raw()));
+ __ LoadObject(field_reg, Field::ZoneHandle(field().raw()),
+ Assembler::kNotPatchable);
FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset());
FieldAddress field_nullability_operand(
@@ -1747,7 +1745,8 @@
}
} else {
if (field_reg != kNoRegister) {
- __ LoadObject(field_reg, Field::ZoneHandle(field().raw()));
+ __ LoadObject(field_reg, Field::ZoneHandle(field().raw()),
+ Assembler::kNotPatchable);
}
if (value_cid == kDynamicCid) {
@@ -1783,9 +1782,7 @@
if (field().is_nullable() && (field_cid != kNullCid)) {
__ j(EQUAL, &ok);
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ cmpq(value_reg, raw_null);
+ __ CompareObject(value_reg, Object::Handle(Object::null()));
}
if (ok_is_fall_through) {
@@ -1910,7 +1907,7 @@
Register value = locs()->in(0).reg();
Register temp = locs()->temp(0).reg();
- __ LoadObject(temp, field());
+ __ LoadObject(temp, field(), Assembler::kNotPatchable);
if (this->value()->NeedsStoreBuffer()) {
__ StoreIntoObject(temp,
FieldAddress(temp, Field::value_offset()), value, CanValueBeSmi());
@@ -2062,9 +2059,7 @@
Label type_arguments_instantiated;
const intptr_t len = type_arguments().Length();
if (type_arguments().IsRawInstantiatedRaw(len)) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ cmpq(instantiator_reg, raw_null);
+ __ CompareObject(instantiator_reg, Object::Handle(Object::null()));
__ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
}
// Instantiate non-null type arguments.
@@ -2111,14 +2106,13 @@
// the type arguments.
Label type_arguments_instantiated;
ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ cmpq(instantiator_reg, raw_null);
+
+ __ CompareObject(instantiator_reg, Object::Handle(Object::null()));
__ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
// Instantiate non-null type arguments.
// In the non-factory case, we rely on the allocation stub to
// instantiate the type arguments.
- __ LoadObject(result_reg, type_arguments());
+ __ LoadObject(result_reg, type_arguments(), Assembler::kNotPatchable);
// result_reg: uninstantiated type arguments.
__ Bind(&type_arguments_instantiated);
@@ -2153,10 +2147,9 @@
// instantiated from null becomes a vector of dynamic, then use null as
// the type arguments and do not pass the instantiator.
ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
+
Label instantiator_not_null;
- __ cmpq(instantiator_reg, raw_null);
+ __ CompareObject(instantiator_reg, Object::Handle(Object::null()));
__ j(NOT_EQUAL, &instantiator_not_null, Assembler::kNearJump);
// Null was used in VisitExtractConstructorTypeArguments as the
// instantiated type arguments, no proper instantiator needed.
@@ -2230,6 +2223,10 @@
try_index(),
compiler->assembler()->CodeSize(),
catch_handler_types_);
+
+ // Restore the pool pointer.
+ __ LoadPoolPointer();
+
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
}
@@ -2309,7 +2306,8 @@
// In unoptimized code check the usage counter to trigger OSR at loop
// stack checks. Use progressively higher thresholds for more deeply
// nested loops to attempt to hit outer loops with OSR when possible.
- __ LoadObject(temp, compiler->parsed_function().function());
+ __ LoadObject(temp, compiler->parsed_function().function(),
+ Assembler::kNotPatchable);
intptr_t threshold =
FLAG_optimization_counter_threshold * (loop_depth() + 1);
__ cmpq(FieldAddress(temp, Function::usage_counter_offset()),
@@ -3756,10 +3754,10 @@
__ addq(RSP, Immediate(16));
__ testl(result, result);
__ j(NOT_ZERO, &non_zero, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
+ __ LoadObject(result, Bool::False(), Assembler::kNotPatchable);
__ jmp(&done);
__ Bind(&non_zero);
- __ LoadObject(result, Bool::True());
+ __ LoadObject(result, Bool::True(), Assembler::kNotPatchable);
__ Bind(&done);
}
@@ -4373,9 +4371,8 @@
if (IsNullCheck()) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptCheckClass);
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ cmpq(locs()->in(0).reg(), raw_null);
+ __ CompareObject(locs()->in(0).reg(),
+ Object::Handle(Object::null()));
__ j(EQUAL, deopt);
return;
}
@@ -4652,7 +4649,8 @@
const bool result = (kind() == Token::kEQ_STRICT) ?
left.constant().raw() == right.constant().raw() :
left.constant().raw() != right.constant().raw();
- __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False());
+ __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False(),
+ Assembler::kNotPatchable);
return;
}
if (left.IsConstant()) {
@@ -4676,10 +4674,10 @@
Label load_true, done;
Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL;
__ j(true_condition, &load_true, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
+ __ LoadObject(result, Bool::False(), Assembler::kNotPatchable);
__ jmp(&done, Assembler::kNearJump);
__ Bind(&load_true);
- __ LoadObject(result, Bool::True());
+ __ LoadObject(result, Bool::True(), Assembler::kNotPatchable);
__ Bind(&done);
}
@@ -4738,7 +4736,7 @@
const Array& arguments_descriptor =
Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
argument_names()));
- __ LoadObject(temp_reg, arguments_descriptor);
+ __ LoadObject(temp_reg, arguments_descriptor, Assembler::kNotPatchable);
ASSERT(temp_reg == R10);
compiler->GenerateDartCall(deopt_id(),
token_pos(),
@@ -4761,10 +4759,10 @@
Register result = locs()->out().reg();
Label done;
- __ LoadObject(result, Bool::True());
+ __ LoadObject(result, Bool::True(), Assembler::kNotPatchable);
__ CompareRegisters(result, value);
__ j(NOT_EQUAL, &done, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
+ __ LoadObject(result, Bool::False(), Assembler::kNotPatchable);
__ Bind(&done);
}

Powered by Google App Engine
This is Rietveld 408576698