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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 460068: Add alignment check to object allocated in generated code for x64 and ARM (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 intptr_t p1 = reinterpret_cast<intptr_t>(msg); 281 intptr_t p1 = reinterpret_cast<intptr_t>(msg);
282 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; 282 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag;
283 // Note: p0 might not be a valid Smi *value*, but it has a valid Smi tag. 283 // Note: p0 might not be a valid Smi *value*, but it has a valid Smi tag.
284 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); 284 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi());
285 #ifdef DEBUG 285 #ifdef DEBUG
286 if (msg != NULL) { 286 if (msg != NULL) {
287 RecordComment("Abort message: "); 287 RecordComment("Abort message: ");
288 RecordComment(msg); 288 RecordComment(msg);
289 } 289 }
290 #endif 290 #endif
291 // Disable stub call restrictions to always allow calls to abort.
292 set_allow_stub_calls(true);
293
291 push(rax); 294 push(rax);
292 movq(kScratchRegister, p0, RelocInfo::NONE); 295 movq(kScratchRegister, p0, RelocInfo::NONE);
293 push(kScratchRegister); 296 push(kScratchRegister);
294 movq(kScratchRegister, 297 movq(kScratchRegister,
295 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(p1 - p0))), 298 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(p1 - p0))),
296 RelocInfo::NONE); 299 RelocInfo::NONE);
297 push(kScratchRegister); 300 push(kScratchRegister);
298 CallRuntime(Runtime::kAbort, 2); 301 CallRuntime(Runtime::kAbort, 2);
299 // will not return here 302 // will not return here
303 int3();
300 } 304 }
301 305
302 306
303 void MacroAssembler::CallStub(CodeStub* stub) { 307 void MacroAssembler::CallStub(CodeStub* stub) {
304 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs 308 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
305 Call(stub->GetCode(), RelocInfo::CODE_TARGET); 309 Call(stub->GetCode(), RelocInfo::CODE_TARGET);
306 } 310 }
307 311
308 312
309 void MacroAssembler::StubReturn(int argc) { 313 void MacroAssembler::StubReturn(int argc) {
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 } else { 2091 } else {
2088 ASSERT(!scratch.is(result_end)); 2092 ASSERT(!scratch.is(result_end));
2089 movq(scratch, new_space_allocation_top); 2093 movq(scratch, new_space_allocation_top);
2090 movq(result, Operand(scratch, 0)); 2094 movq(result, Operand(scratch, 0));
2091 } 2095 }
2092 } 2096 }
2093 2097
2094 2098
2095 void MacroAssembler::UpdateAllocationTopHelper(Register result_end, 2099 void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
2096 Register scratch) { 2100 Register scratch) {
2101 if (FLAG_debug_code) {
2102 testq(result_end, Immediate(kObjectAlignmentMask));
2103 Check(zero, "Unaligned allocation in new space");
2104 }
2105
2097 ExternalReference new_space_allocation_top = 2106 ExternalReference new_space_allocation_top =
2098 ExternalReference::new_space_allocation_top_address(); 2107 ExternalReference::new_space_allocation_top_address();
2099 2108
2100 // Update new top. 2109 // Update new top.
2101 if (result_end.is(rax)) { 2110 if (result_end.is(rax)) {
2102 // rax can be stored directly to a memory location. 2111 // rax can be stored directly to a memory location.
2103 store_rax(new_space_allocation_top); 2112 store_rax(new_space_allocation_top);
2104 } else { 2113 } else {
2105 // Register required - use scratch provided if available. 2114 // Register required - use scratch provided if available.
2106 if (scratch.is(no_reg)) { 2115 if (scratch.is(no_reg)) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 CodePatcher::~CodePatcher() { 2275 CodePatcher::~CodePatcher() {
2267 // Indicate that code has changed. 2276 // Indicate that code has changed.
2268 CPU::FlushICache(address_, size_); 2277 CPU::FlushICache(address_, size_);
2269 2278
2270 // Check that the code was patched as expected. 2279 // Check that the code was patched as expected.
2271 ASSERT(masm_.pc_ == address_ + size_); 2280 ASSERT(masm_.pc_ == address_ + size_);
2272 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2281 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2273 } 2282 }
2274 2283
2275 } } // namespace v8::internal 2284 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698