Begins removing intptr_t from raw object fields.

R=asiva@google.com

Review URL: https://codereview.chromium.org//328893002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37285 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
zra@google.com
2014-06-12 19:56:46 +00:00
parent 24cd5e2385
commit 47e2465545
11 changed files with 165 additions and 149 deletions
+8 -10
View File
@@ -22,8 +22,6 @@ namespace dart {
// Forward declarations.
class RuntimeEntry;
// TODO(zra): Label, Address, and FieldAddress are copied from ARM,
// they must be adapted to ARM64.
class Label : public ValueObject {
public:
Label() : position_(0) { }
@@ -245,8 +243,8 @@ class Address : public ValueObject {
class FieldAddress : public Address {
public:
FieldAddress(Register base, int32_t disp)
: Address(base, disp - kHeapObjectTag) { }
FieldAddress(Register base, int32_t disp, OperandSize sz = kDoubleWord)
: Address(base, disp - kHeapObjectTag, Offset, sz) { }
FieldAddress(const FieldAddress& other) : Address(other) { }
@@ -1071,9 +1069,9 @@ class Assembler : public ValueObject {
void LoadFromOffset(Register dest, Register base, int32_t offset,
Register pp, OperandSize sz = kDoubleWord);
void LoadFieldFromOffset(
Register dest, Register base, int32_t offset, Register pp) {
LoadFromOffset(dest, base, offset - kHeapObjectTag, pp);
void LoadFieldFromOffset(Register dest, Register base, int32_t offset,
Register pp, OperandSize sz = kDoubleWord) {
LoadFromOffset(dest, base, offset - kHeapObjectTag, pp, sz);
}
void LoadDFromOffset(
VRegister dest, Register base, int32_t offset, Register pp);
@@ -1090,9 +1088,9 @@ class Assembler : public ValueObject {
void StoreToOffset(Register src, Register base, int32_t offset,
Register pp, OperandSize sz = kDoubleWord);
void StoreFieldToOffset(
Register src, Register base, int32_t offset, Register pp) {
StoreToOffset(src, base, offset - kHeapObjectTag, pp);
void StoreFieldToOffset(Register src, Register base, int32_t offset,
Register pp, OperandSize sz = kDoubleWord) {
StoreToOffset(src, base, offset - kHeapObjectTag, pp, sz);
}
void StoreDToOffset(
VRegister src, Register base, int32_t offset, Register pp);
+6
View File
@@ -240,6 +240,12 @@ void Assembler::movl(const Address& dst, Register src) {
}
void Assembler::movl(const Address& dst, const Immediate& imm) {
movl(TMP, imm);
movl(dst, TMP);
}
void Assembler::movzxb(Register dst, Register src) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
Operand operand(src);
+1
View File
@@ -350,6 +350,7 @@ class Assembler : public ValueObject {
void movl(Register dst, const Immediate& imm);
void movl(Register dst, const Address& src);
void movl(const Address& dst, Register src);
void movl(const Address& dst, const Immediate& imm);
void movzxb(Register dst, Register src);
void movzxb(Register dst, const Address& src);
+2 -2
View File
@@ -974,7 +974,7 @@ void FlowGraphCompiler::EmitFrameEntry() {
intptr_t threshold = FLAG_optimization_counter_threshold;
__ LoadFieldFromOffset(
R7, function_reg, Function::usage_counter_offset(), new_pp);
R7, function_reg, Function::usage_counter_offset(), new_pp, kWord);
if (is_optimizing()) {
// Reoptimization of an optimized function is triggered by counting in
// IC stubs, but not at the entry of the function.
@@ -982,7 +982,7 @@ void FlowGraphCompiler::EmitFrameEntry() {
} else {
__ add(R7, R7, Operand(1));
__ StoreFieldToOffset(
R7, function_reg, Function::usage_counter_offset(), new_pp);
R7, function_reg, Function::usage_counter_offset(), new_pp, kWord);
}
__ CompareImmediate(R7, threshold, new_pp);
ASSERT(function_reg == R6);
+5 -7
View File
@@ -1005,16 +1005,14 @@ void FlowGraphCompiler::EmitFrameEntry() {
if (is_optimizing()) {
// Reoptimization of an optimized function is triggered by counting in
// IC stubs, but not at the entry of the function.
__ CompareImmediate(
__ cmpl(
FieldAddress(function_reg, Function::usage_counter_offset()),
Immediate(FLAG_reoptimization_counter_threshold),
new_pp);
Immediate(FLAG_reoptimization_counter_threshold));
} else {
__ incq(FieldAddress(function_reg, Function::usage_counter_offset()));
__ CompareImmediate(
__ incl(FieldAddress(function_reg, Function::usage_counter_offset()));
__ cmpl(
FieldAddress(function_reg, Function::usage_counter_offset()),
Immediate(FLAG_optimization_counter_threshold),
new_pp);
Immediate(FLAG_optimization_counter_threshold));
}
ASSERT(function_reg == RDI);
__ J(GREATER_EQUAL, &StubCode::OptimizeFunctionLabel(), R13);
+28 -24
View File
@@ -1416,24 +1416,25 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (emit_full_guard) {
__ LoadObject(field_reg, Field::ZoneHandle(field().raw()), PP);
FieldAddress field_cid_operand(field_reg, Field::guarded_cid_offset());
FieldAddress field_cid_operand(
field_reg, Field::guarded_cid_offset(), kWord);
FieldAddress field_nullability_operand(
field_reg, Field::is_nullable_offset());
field_reg, Field::is_nullable_offset(), kWord);
if (value_cid == kDynamicCid) {
LoadValueCid(compiler, value_cid_reg, value_reg);
Label skip_length_check;
__ ldr(TMP, field_cid_operand);
__ ldr(TMP, field_cid_operand, kWord);
__ CompareRegisters(value_cid_reg, TMP);
__ b(&ok, EQ);
__ ldr(TMP, field_nullability_operand);
__ ldr(TMP, field_nullability_operand, kWord);
__ CompareRegisters(value_cid_reg, TMP);
} else if (value_cid == kNullCid) {
__ ldr(value_cid_reg, field_nullability_operand);
__ ldr(value_cid_reg, field_nullability_operand, kWord);
__ CompareImmediate(value_cid_reg, value_cid, PP);
} else {
Label skip_length_check;
__ ldr(value_cid_reg, field_cid_operand);
__ ldr(value_cid_reg, field_cid_operand, kWord);
__ CompareImmediate(value_cid_reg, value_cid, PP);
}
__ b(&ok, EQ);
@@ -1447,17 +1448,17 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (!field().needs_length_check()) {
// Uninitialized field can be handled inline. Check if the
// field is still unitialized.
__ ldr(TMP, field_cid_operand);
__ ldr(TMP, field_cid_operand, kWord);
__ CompareImmediate(TMP, kIllegalCid, PP);
__ b(fail, NE);
if (value_cid == kDynamicCid) {
__ str(value_cid_reg, field_cid_operand);
__ str(value_cid_reg, field_nullability_operand);
__ str(value_cid_reg, field_cid_operand, kWord);
__ str(value_cid_reg, field_nullability_operand, kWord);
} else {
__ LoadImmediate(TMP, value_cid, PP);
__ str(TMP, field_cid_operand);
__ str(TMP, field_nullability_operand);
__ str(TMP, field_cid_operand, kWord);
__ str(TMP, field_nullability_operand, kWord);
}
if (deopt == NULL) {
@@ -1470,7 +1471,8 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(!compiler->is_optimizing());
__ Bind(fail);
__ LoadFieldFromOffset(TMP, field_reg, Field::guarded_cid_offset(), PP);
__ LoadFieldFromOffset(
TMP, field_reg, Field::guarded_cid_offset(), PP, kWord);
__ CompareImmediate(TMP, kDynamicCid, PP);
__ b(&ok, EQ);
@@ -1737,7 +1739,7 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ LoadObject(temp, Field::ZoneHandle(field().raw()), PP);
__ LoadFieldFromOffset(temp2, temp, Field::is_nullable_offset(), PP);
__ LoadFieldFromOffset(temp2, temp, Field::is_nullable_offset(), PP, kWord);
__ CompareImmediate(temp2, kNullCid, PP);
__ b(&store_pointer, EQ);
@@ -1747,15 +1749,15 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ tsti(temp2, 1 << Field::kUnboxingCandidateBit);
__ b(&store_pointer, EQ);
__ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP);
__ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP, kWord);
__ CompareImmediate(temp2, kDoubleCid, PP);
__ b(&store_double, EQ);
__ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP);
__ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP, kWord);
__ CompareImmediate(temp2, kFloat32x4Cid, PP);
__ b(&store_float32x4, EQ);
__ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP);
__ LoadFieldFromOffset(temp2, temp, Field::guarded_cid_offset(), PP, kWord);
__ CompareImmediate(temp2, kFloat64x2Cid, PP);
__ b(&store_float64x2, EQ);
@@ -2124,23 +2126,24 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ LoadObject(result_reg, Field::ZoneHandle(field()->raw()), PP);
FieldAddress field_cid_operand(result_reg, Field::guarded_cid_offset());
FieldAddress field_nullability_operand(result_reg,
Field::is_nullable_offset());
FieldAddress field_cid_operand(
result_reg, Field::guarded_cid_offset(), kWord);
FieldAddress field_nullability_operand(
result_reg, Field::is_nullable_offset(), kWord);
__ ldr(temp, field_nullability_operand);
__ ldr(temp, field_nullability_operand, kWord);
__ CompareImmediate(temp, kNullCid, PP);
__ b(&load_pointer, EQ);
__ ldr(temp, field_cid_operand);
__ ldr(temp, field_cid_operand, kWord);
__ CompareImmediate(temp, kDoubleCid, PP);
__ b(&load_double, EQ);
__ ldr(temp, field_cid_operand);
__ ldr(temp, field_cid_operand, kWord);
__ CompareImmediate(temp, kFloat32x4Cid, PP);
__ b(&load_float32x4, EQ);
__ ldr(temp, field_cid_operand);
__ ldr(temp, field_cid_operand, kWord);
__ CompareImmediate(temp, kFloat64x2Cid, PP);
__ b(&load_float64x2, EQ);
@@ -2475,7 +2478,8 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ LoadObject(temp, compiler->parsed_function().function(), PP);
intptr_t threshold =
FLAG_optimization_counter_threshold * (loop_depth() + 1);
__ LoadFieldFromOffset(temp, temp, Function::usage_counter_offset(), PP);
__ LoadFieldFromOffset(
temp, temp, Function::usage_counter_offset(), PP, kWord);
__ CompareImmediate(temp, threshold, PP);
__ b(slow_path->osr_entry_label(), GE);
}
+21 -21
View File
@@ -1376,13 +1376,13 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (value_cid == kDynamicCid) {
LoadValueCid(compiler, value_cid_reg, value_reg);
__ cmpq(value_cid_reg, field_cid_operand);
__ cmpl(value_cid_reg, field_cid_operand);
__ j(EQUAL, &ok);
__ cmpq(value_cid_reg, field_nullability_operand);
__ cmpl(value_cid_reg, field_nullability_operand);
} else if (value_cid == kNullCid) {
__ CompareImmediate(field_nullability_operand, Immediate(value_cid), PP);
__ cmpl(field_nullability_operand, Immediate(value_cid));
} else {
__ CompareImmediate(field_cid_operand, Immediate(value_cid), PP);
__ cmpl(field_cid_operand, Immediate(value_cid));
}
__ j(EQUAL, &ok);
@@ -1393,16 +1393,16 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (!field().needs_length_check()) {
// Uninitialized field can be handled inline. Check if the
// field is still unitialized.
__ CompareImmediate(field_cid_operand, Immediate(kIllegalCid), PP);
__ cmpl(field_cid_operand, Immediate(kIllegalCid));
__ j(NOT_EQUAL, fail);
if (value_cid == kDynamicCid) {
__ movq(field_cid_operand, value_cid_reg);
__ movq(field_nullability_operand, value_cid_reg);
__ movl(field_cid_operand, value_cid_reg);
__ movl(field_nullability_operand, value_cid_reg);
} else {
ASSERT(field_reg != kNoRegister);
__ LoadImmediate(field_cid_operand, Immediate(value_cid), PP);
__ LoadImmediate(field_nullability_operand, Immediate(value_cid), PP);
__ movl(field_cid_operand, Immediate(value_cid));
__ movl(field_nullability_operand, Immediate(value_cid));
}
if (deopt == NULL) {
@@ -1415,8 +1415,8 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(!compiler->is_optimizing());
__ Bind(fail);
__ CompareImmediate(FieldAddress(field_reg, Field::guarded_cid_offset()),
Immediate(kDynamicCid), PP);
__ cmpl(FieldAddress(field_reg, Field::guarded_cid_offset()),
Immediate(kDynamicCid));
__ j(EQUAL, &ok);
__ pushq(field_reg);
@@ -1685,7 +1685,7 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ LoadObject(temp, Field::ZoneHandle(field().raw()), PP);
__ cmpq(FieldAddress(temp, Field::is_nullable_offset()),
__ cmpl(FieldAddress(temp, Field::is_nullable_offset()),
Immediate(kNullCid));
__ j(EQUAL, &store_pointer);
@@ -1693,11 +1693,11 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ testq(temp2, Immediate(1 << Field::kUnboxingCandidateBit));
__ j(ZERO, &store_pointer);
__ cmpq(FieldAddress(temp, Field::guarded_cid_offset()),
__ cmpl(FieldAddress(temp, Field::guarded_cid_offset()),
Immediate(kDoubleCid));
__ j(EQUAL, &store_double);
__ cmpq(FieldAddress(temp, Field::guarded_cid_offset()),
__ cmpl(FieldAddress(temp, Field::guarded_cid_offset()),
Immediate(kFloat32x4Cid));
__ j(EQUAL, &store_float32x4);
@@ -2187,19 +2187,19 @@ void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ LoadObject(result, Field::ZoneHandle(field()->raw()), PP);
__ cmpq(FieldAddress(result, Field::is_nullable_offset()),
__ cmpl(FieldAddress(result, Field::is_nullable_offset()),
Immediate(kNullCid));
__ j(EQUAL, &load_pointer);
__ cmpq(FieldAddress(result, Field::guarded_cid_offset()),
__ cmpl(FieldAddress(result, Field::guarded_cid_offset()),
Immediate(kDoubleCid));
__ j(EQUAL, &load_double);
__ cmpq(FieldAddress(result, Field::guarded_cid_offset()),
__ cmpl(FieldAddress(result, Field::guarded_cid_offset()),
Immediate(kFloat32x4Cid));
__ j(EQUAL, &load_float32x4);
__ cmpq(FieldAddress(result, Field::guarded_cid_offset()),
__ cmpl(FieldAddress(result, Field::guarded_cid_offset()),
Immediate(kFloat64x2Cid));
__ j(EQUAL, &load_float64x2);
@@ -2542,10 +2542,10 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// 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(), PP);
intptr_t threshold =
int32_t threshold =
FLAG_optimization_counter_threshold * (loop_depth() + 1);
__ CompareImmediate(FieldAddress(temp, Function::usage_counter_offset()),
Immediate(threshold), PP);
__ cmpl(FieldAddress(temp, Function::usage_counter_offset()),
Immediate(threshold));
__ j(GREATER_EQUAL, slow_path->osr_entry_label());
}
if (compiler->ForceSlowPathForStackOverflow()) {
+23 -23
View File
@@ -507,10 +507,10 @@ class RawClass : public RawObject {
cpp_vtable handle_vtable_;
intptr_t id_; // Class Id, also index in the class table.
intptr_t token_pos_;
intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len.
intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld.
intptr_t next_field_offset_in_words_; // Offset of the next instance field.
int32_t token_pos_;
int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len.
int32_t type_arguments_field_offset_in_words_; // Offset of type args fld.
int32_t next_field_offset_in_words_; // Offset of the next instance field.
int16_t num_type_arguments_; // Number of type arguments in flatten vector.
int16_t num_own_type_arguments_; // Number of non-overlapping type arguments.
uint16_t num_native_fields_; // Number of native fields in class.
@@ -535,7 +535,7 @@ class RawUnresolvedClass : public RawObject {
RawObject** to() {
return reinterpret_cast<RawObject**>(&ptr()->ident_);
}
intptr_t token_pos_;
int32_t token_pos_;
};
@@ -624,9 +624,9 @@ class RawFunction : public RawObject {
return reinterpret_cast<RawObject**>(&ptr()->data_);
}
intptr_t token_pos_;
intptr_t end_token_pos_;
intptr_t usage_counter_; // Incremented while function is running.
int32_t token_pos_;
int32_t end_token_pos_;
int32_t usage_counter_; // Incremented while function is running.
int16_t num_fixed_parameters_;
int16_t num_optional_parameters_; // > 0: positional; < 0: named.
int16_t deoptimization_counter_;
@@ -684,10 +684,10 @@ class RawField : public RawObject {
return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_);
}
intptr_t token_pos_;
intptr_t guarded_cid_;
intptr_t is_nullable_; // kNullCid if field can contain null value and
// any other value otherwise.
int32_t token_pos_;
int32_t guarded_cid_;
int32_t is_nullable_; // kNullCid if field can contain null value and
// any other value otherwise.
// Offset to the guarded length field inside an instance of class matching
// guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code
// generated on platforms with weak addressing modes (ARM, MIPS).
@@ -749,8 +749,8 @@ class RawScript : public RawObject {
RawTokenStream* tokens_;
RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->tokens_); }
intptr_t line_offset_;
intptr_t col_offset_;
int32_t line_offset_;
int32_t col_offset_;
int8_t kind_; // Of type Kind.
};
@@ -781,9 +781,9 @@ class RawLibrary : public RawObject {
return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_);
}
intptr_t index_; // Library id number.
intptr_t num_imports_; // Number of entries in imports_.
intptr_t num_anonymous_; // Number of entries in anonymous_classes_.
int32_t index_; // Library id number.
int32_t num_imports_; // Number of entries in imports_.
int32_t num_anonymous_; // Number of entries in anonymous_classes_.
Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives.
Dart_NativeEntrySymbol native_entry_symbol_resolver_;
bool corelib_imported_;
@@ -1066,7 +1066,7 @@ class RawMegamorphicCache : public RawObject {
return reinterpret_cast<RawObject**>(&ptr()->mask_);
}
intptr_t filled_entry_count_;
int32_t filled_entry_count_;
};
@@ -1107,7 +1107,7 @@ class RawLanguageError : public RawError {
RawObject** to() {
return reinterpret_cast<RawObject**>(&ptr()->formatted_message_);
}
intptr_t token_pos_; // Source position in script_.
int32_t token_pos_; // Source position in script_.
int8_t kind_; // Of type LanguageError::Kind.
};
@@ -1155,7 +1155,7 @@ class RawLibraryPrefix : public RawInstance {
RawObject** to() {
return reinterpret_cast<RawObject**>(&ptr()->dependent_code_);
}
intptr_t num_imports_; // Number of library entries in libraries_.
int32_t num_imports_; // Number of library entries in libraries_.
bool is_deferred_load_;
bool is_loaded_;
};
@@ -1191,7 +1191,7 @@ class RawType : public RawAbstractType {
RawObject** to() {
return reinterpret_cast<RawObject**>(&ptr()->error_);
}
intptr_t token_pos_;
int32_t token_pos_;
int8_t type_state_;
};
@@ -1221,8 +1221,8 @@ class RawTypeParameter : public RawAbstractType {
RawString* name_;
RawAbstractType* bound_; // ObjectType if no explicit bound specified.
RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); }
intptr_t index_;
intptr_t token_pos_;
int32_t index_;
int32_t token_pos_;
int8_t type_state_;
};
+56 -51
View File
@@ -39,7 +39,7 @@ RawClass* Class::ReadFrom(SnapshotReader* reader,
if ((kind == Snapshot::kFull) ||
(kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) {
// Read in the base information.
intptr_t class_id = reader->ReadIntptrValue();
int32_t class_id = reader->Read<int32_t>();
// Allocate class object of specified kind.
if (kind == Snapshot::kFull) {
@@ -60,14 +60,14 @@ RawClass* Class::ReadFrom(SnapshotReader* reader,
// Set all non object fields.
if (!RawObject::IsInternalVMdefinedClassId(class_id)) {
// Instance size of a VM defined class is already set up.
cls.set_instance_size_in_words(reader->ReadIntptrValue());
cls.set_next_field_offset_in_words(reader->ReadIntptrValue());
cls.set_instance_size_in_words(reader->Read<int32_t>());
cls.set_next_field_offset_in_words(reader->Read<int32_t>());
}
cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue());
cls.set_type_arguments_field_offset_in_words(reader->Read<int32_t>());
cls.set_num_type_arguments(reader->Read<int16_t>());
cls.set_num_own_type_arguments(reader->Read<int16_t>());
cls.set_num_native_fields(reader->Read<uint16_t>());
cls.set_token_pos(reader->ReadIntptrValue());
cls.set_token_pos(reader->Read<int32_t>());
cls.set_state_bits(reader->Read<uint16_t>());
// Set all the object fields.
@@ -101,20 +101,20 @@ void RawClass::WriteTo(SnapshotWriter* writer,
// Write out all the non object pointer fields.
// NOTE: cpp_vtable_ is not written.
intptr_t class_id = ptr()->id_;
writer->WriteIntptrValue(class_id);
int32_t class_id = ptr()->id_;
writer->Write<int32_t>(class_id);
if (!RawObject::IsInternalVMdefinedClassId(class_id)) {
// We don't write the instance size of VM defined classes as they
// are already setup during initialization as part of pre populating
// the class table.
writer->WriteIntptrValue(ptr()->instance_size_in_words_);
writer->WriteIntptrValue(ptr()->next_field_offset_in_words_);
writer->Write<int32_t>(ptr()->instance_size_in_words_);
writer->Write<int32_t>(ptr()->next_field_offset_in_words_);
}
writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_);
writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_);
writer->Write<int16_t>(ptr()->num_type_arguments_);
writer->Write<int16_t>(ptr()->num_own_type_arguments_);
writer->Write<uint16_t>(ptr()->num_native_fields_);
writer->WriteIntptrValue(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<uint16_t>(ptr()->state_bits_);
// Write out all the object pointer fields.
@@ -141,7 +141,7 @@ RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader,
unresolved_class.set_tags(tags);
// Set all non object fields.
unresolved_class.set_token_pos(reader->ReadIntptrValue());
unresolved_class.set_token_pos(reader->Read<int32_t>());
// Set all the object fields.
// TODO(5411462): Need to assert No GC can happen here, even though
@@ -170,7 +170,7 @@ void RawUnresolvedClass::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->WriteIntptrValue(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->token_pos_);
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -205,7 +205,7 @@ RawType* Type::ReadFrom(SnapshotReader* reader,
reader->AddBackRef(object_id, &type, kIsDeserialized);
// Set all non object fields.
type.set_token_pos(reader->ReadIntptrValue());
type.set_token_pos(reader->Read<int32_t>());
type.set_type_state(reader->Read<int8_t>());
// Set all the object fields.
@@ -256,7 +256,7 @@ void RawType::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->WriteIntptrValue(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<int8_t>(ptr()->type_state_);
// Write out all the object pointer fields. Since we will be canonicalizing
@@ -328,8 +328,8 @@ RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader,
type_parameter.set_tags(tags);
// Set all non object fields.
type_parameter.set_index(reader->ReadIntptrValue());
type_parameter.set_token_pos(reader->ReadIntptrValue());
type_parameter.set_index(reader->Read<int32_t>());
type_parameter.set_token_pos(reader->Read<int32_t>());
type_parameter.set_type_state(reader->Read<int8_t>());
// Set all the object fields.
@@ -363,8 +363,8 @@ void RawTypeParameter::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->WriteIntptrValue(ptr()->index_);
writer->WriteIntptrValue(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->index_);
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<int8_t>(ptr()->type_state_);
// Write out all the object pointer fields.
@@ -692,12 +692,12 @@ RawFunction* Function::ReadFrom(SnapshotReader* reader,
func.set_tags(tags);
// Set all the non object fields.
func.set_token_pos(reader->ReadIntptrValue());
func.set_end_token_pos(reader->ReadIntptrValue());
func.set_usage_counter(reader->ReadIntptrValue());
func.set_num_fixed_parameters(reader->ReadIntptrValue());
func.set_num_optional_parameters(reader->ReadIntptrValue());
func.set_deoptimization_counter(reader->ReadIntptrValue());
func.set_token_pos(reader->Read<int32_t>());
func.set_end_token_pos(reader->Read<int32_t>());
func.set_usage_counter(reader->Read<int32_t>());
func.set_num_fixed_parameters(reader->Read<int16_t>());
func.set_num_optional_parameters(reader->Read<int16_t>());
func.set_deoptimization_counter(reader->Read<int16_t>());
func.set_kind_tag(reader->Read<uint16_t>());
func.set_optimized_instruction_count(reader->Read<uint16_t>());
func.set_optimized_call_site_count(reader->Read<uint16_t>());
@@ -705,13 +705,14 @@ RawFunction* Function::ReadFrom(SnapshotReader* reader,
// Set all the object fields.
// TODO(5411462): Need to assert No GC can happen here, even though
// allocations may happen.
intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from());
intptr_t num_flds = (func.raw()->to() - func.raw()->from());
for (intptr_t i = 0; i <= num_flds; i++) {
*(func.raw()->from() + i) = reader->ReadObjectRef();
}
// Initialize all fields that are not part of the snapshot.
func.ClearCode();
// Set up code pointer with the lazy-compile-stub.
func.SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code()));
return func.raw();
}
@@ -732,19 +733,23 @@ void RawFunction::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all the non object fields.
writer->WriteIntptrValue(ptr()->token_pos_);
writer->WriteIntptrValue(ptr()->end_token_pos_);
writer->WriteIntptrValue(ptr()->usage_counter_);
writer->WriteIntptrValue(ptr()->num_fixed_parameters_);
writer->WriteIntptrValue(ptr()->num_optional_parameters_);
writer->WriteIntptrValue(ptr()->deoptimization_counter_);
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->end_token_pos_);
writer->Write<int32_t>(ptr()->usage_counter_);
writer->Write<int16_t>(ptr()->num_fixed_parameters_);
writer->Write<int16_t>(ptr()->num_optional_parameters_);
writer->Write<int16_t>(ptr()->deoptimization_counter_);
writer->Write<uint16_t>(ptr()->kind_tag_);
writer->Write<uint16_t>(ptr()->optimized_instruction_count_);
writer->Write<uint16_t>(ptr()->optimized_call_site_count_);
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
visitor.VisitPointers(from(), to_snapshot());
visitor.VisitPointers(from(), to_no_code());
// Write null for the instructions and unoptimized code.
writer->WriteVMIsolateObject(kNullObject);
writer->WriteVMIsolateObject(kNullObject);
}
@@ -765,9 +770,9 @@ RawField* Field::ReadFrom(SnapshotReader* reader,
field.set_tags(tags);
// Set all non object fields.
field.set_token_pos(reader->ReadIntptrValue());
field.set_guarded_cid(reader->ReadIntptrValue());
field.set_is_nullable(reader->ReadIntptrValue());
field.set_token_pos(reader->Read<int32_t>());
field.set_guarded_cid(reader->Read<int32_t>());
field.set_is_nullable(reader->Read<int32_t>());
field.set_kind_bits(reader->Read<uint8_t>());
// Set all the object fields.
@@ -800,9 +805,9 @@ void RawField::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all the non object fields.
writer->WriteIntptrValue(ptr()->token_pos_);
writer->WriteIntptrValue(ptr()->guarded_cid_);
writer->WriteIntptrValue(ptr()->is_nullable_);
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->guarded_cid_);
writer->Write<int32_t>(ptr()->is_nullable_);
writer->Write<uint8_t>(ptr()->kind_bits_);
// Write out all the object pointer fields.
@@ -1011,9 +1016,9 @@ RawLibrary* Library::ReadFrom(SnapshotReader* reader,
library.set_tags(tags);
// Set all non object fields.
library.raw_ptr()->index_ = reader->ReadIntptrValue();
library.raw_ptr()->num_imports_ = reader->ReadIntptrValue();
library.raw_ptr()->num_anonymous_ = reader->ReadIntptrValue();
library.raw_ptr()->index_ = reader->Read<int32_t>();
library.raw_ptr()->num_imports_ = reader->Read<int32_t>();
library.raw_ptr()->num_anonymous_ = reader->Read<int32_t>();
library.raw_ptr()->corelib_imported_ = reader->Read<bool>();
library.raw_ptr()->is_dart_scheme_ = reader->Read<bool>();
library.raw_ptr()->debuggable_ = reader->Read<bool>();
@@ -1066,9 +1071,9 @@ void RawLibrary::WriteTo(SnapshotWriter* writer,
writer->WriteObjectImpl(ptr()->url_);
} else {
// Write out all non object fields.
writer->WriteIntptrValue(ptr()->index_);
writer->WriteIntptrValue(ptr()->num_imports_);
writer->WriteIntptrValue(ptr()->num_anonymous_);
writer->Write<int32_t>(ptr()->index_);
writer->Write<int32_t>(ptr()->num_imports_);
writer->Write<int32_t>(ptr()->num_anonymous_);
writer->Write<bool>(ptr()->corelib_imported_);
writer->Write<bool>(ptr()->is_dart_scheme_);
writer->Write<bool>(ptr()->debuggable_);
@@ -1108,7 +1113,7 @@ RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader,
prefix.set_tags(tags);
// Set all non object fields.
prefix.raw_ptr()->num_imports_ = reader->ReadIntptrValue();
prefix.raw_ptr()->num_imports_ = reader->Read<int32_t>();
prefix.raw_ptr()->is_deferred_load_ = reader->Read<bool>();
prefix.raw_ptr()->is_loaded_ = reader->Read<bool>();
@@ -1140,7 +1145,7 @@ void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all non object fields.
writer->WriteIntptrValue(ptr()->num_imports_);
writer->Write<int32_t>(ptr()->num_imports_);
writer->Write<bool>(ptr()->is_deferred_load_);
writer->Write<bool>(ptr()->is_loaded_);
@@ -1514,7 +1519,7 @@ RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader,
language_error.set_tags(tags);
// Set all non object fields.
language_error.set_token_pos(reader->ReadIntptrValue());
language_error.set_token_pos(reader->Read<int32_t>());
language_error.set_kind(reader->Read<uint8_t>());
// Set all the object fields.
@@ -1545,7 +1550,7 @@ void RawLanguageError::WriteTo(SnapshotWriter* writer,
writer->WriteIntptrValue(writer->GetObjectTags(this));
// Write out all the non object fields.
writer->WriteIntptrValue(ptr()->token_pos_);
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<uint8_t>(ptr()->kind_);
// Write out all the object pointer fields.
+11 -7
View File
@@ -1292,9 +1292,11 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) {
__ Pop(R6); // Restore.
__ LeaveStubFrame();
}
__ LoadFieldFromOffset(R7, func_reg, Function::usage_counter_offset(), kNoPP);
__ LoadFieldFromOffset(
R7, func_reg, Function::usage_counter_offset(), kNoPP, kWord);
__ add(R7, R7, Operand(1));
__ StoreFieldToOffset(R7, func_reg, Function::usage_counter_offset(), kNoPP);
__ StoreFieldToOffset(
R7, func_reg, Function::usage_counter_offset(), kNoPP, kWord);
}
@@ -1305,9 +1307,11 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler,
Register func_reg = temp_reg;
ASSERT(temp_reg == R6);
__ LoadFieldFromOffset(func_reg, ic_reg, ICData::owner_offset(), kNoPP);
__ LoadFieldFromOffset(R7, func_reg, Function::usage_counter_offset(), kNoPP);
__ LoadFieldFromOffset(
R7, func_reg, Function::usage_counter_offset(), kNoPP, kWord);
__ AddImmediate(R7, R7, 1, kNoPP);
__ StoreFieldToOffset(R7, func_reg, Function::usage_counter_offset(), kNoPP);
__ StoreFieldToOffset(
R7, func_reg, Function::usage_counter_offset(), kNoPP, kWord);
}
@@ -1360,7 +1364,7 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(
// Load arguments descriptor into R4.
__ LoadFieldFromOffset(R4, R5, ICData::arguments_descriptor_offset(), kNoPP);
// Loop that checks if there is an IC data match.
Label loop, update, test, found, get_class_id_as_smi;
Label loop, update, test, found;
// R5: IC data object (preserved).
__ LoadFieldFromOffset(R6, R5, ICData::ic_data_offset(), kNoPP);
// R6: ic_data_array with check entries: classes and target functions.
@@ -1677,8 +1681,8 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
// Compute instance type arguments into R4.
Label has_no_type_arguments;
__ LoadObject(R4, Object::null_object(), PP);
__ LoadFieldFromOffset(
R5, R3, Class::type_arguments_field_offset_in_words_offset(), kNoPP);
__ LoadFieldFromOffset(R5, R3,
Class::type_arguments_field_offset_in_words_offset(), kNoPP, kWord);
__ CompareImmediate(R5, Class::kNoTypeArguments, kNoPP);
__ b(&has_no_type_arguments, EQ);
__ add(R5, R0, Operand(R5, LSL, 3));
+4 -4
View File
@@ -1221,7 +1221,7 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) {
__ popq(func_reg); // Restore.
__ LeaveStubFrame();
}
__ incq(FieldAddress(func_reg, Function::usage_counter_offset()));
__ incl(FieldAddress(func_reg, Function::usage_counter_offset()));
}
@@ -1232,7 +1232,7 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler,
Register func_reg = temp_reg;
ASSERT(ic_reg != func_reg);
__ movq(func_reg, FieldAddress(ic_reg, ICData::owner_offset()));
__ incq(FieldAddress(func_reg, Function::usage_counter_offset()));
__ incl(FieldAddress(func_reg, Function::usage_counter_offset()));
}
@@ -1600,9 +1600,9 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
// Compute instance type arguments into R13.
Label has_no_type_arguments;
__ movq(R13, R12);
__ movq(RDI, FieldAddress(R10,
__ movl(RDI, FieldAddress(R10,
Class::type_arguments_field_offset_in_words_offset()));
__ cmpq(RDI, Immediate(Class::kNoTypeArguments));
__ cmpl(RDI, Immediate(Class::kNoTypeArguments));
__ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump);
__ movq(R13, FieldAddress(RAX, RDI, TIMES_8, 0));
__ Bind(&has_no_type_arguments);