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

Unified Diff: runtime/vm/object.cc

Issue 1375283003: Fill the header of an Instructions object with null (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 11cd82bf551d184b8534b81d16cf345d63d33828..725ce07c02d3538abd59b796da2b913d1c000b94 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1761,10 +1761,22 @@ void Object::InitializeObject(uword address,
intptr_t class_id,
intptr_t size,
bool is_vm_object) {
- uword initial_value = (class_id == kInstructionsCid)
- ? Assembler::GetBreakInstructionFiller() : reinterpret_cast<uword>(null_);
+ const uword break_instruction_value = Assembler::GetBreakInstructionFiller();
+ const uword null_value = reinterpret_cast<uword>(null_);
+ const bool is_instructions = class_id == kInstructionsCid;
+ uword initial_value =
+ is_instructions ? break_instruction_value : null_value;
uword cur = address;
uword end = address + size;
+ if (is_instructions) {
+ // Fill the header with null. The remainder of the Instructions object will
+ // be filled with the break_instruction_value.
+ uword header_end = address + Instructions::HeaderSize();
+ while (cur < header_end) {
+ *reinterpret_cast<uword*>(cur) = null_value;
+ cur += kWordSize;
+ }
+ }
while (cur < end) {
*reinterpret_cast<uword*>(cur) = initial_value;
cur += kWordSize;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698