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

Side by Side Diff: src/x87/debug-x87.cc

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x87/codegen-x87.cc ('k') | src/x87/deoptimizer-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
11 11
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 bool BreakLocationIterator::IsDebugBreakAtReturn() { 16 bool BreakLocationIterator::IsDebugBreakAtReturn() {
17 return Debug::IsDebugBreakAtReturn(rinfo()); 17 return Debug::IsDebugBreakAtReturn(rinfo());
18 } 18 }
19 19
20 20
21 // Patch the JS frame exit code with a debug break call. See 21 // Patch the JS frame exit code with a debug break call. See
22 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-x87.cc 22 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-x87.cc
23 // for the precise return instructions sequence. 23 // for the precise return instructions sequence.
24 void BreakLocationIterator::SetDebugBreakAtReturn() { 24 void BreakLocationIterator::SetDebugBreakAtReturn() {
25 ASSERT(Assembler::kJSReturnSequenceLength >= 25 DCHECK(Assembler::kJSReturnSequenceLength >=
26 Assembler::kCallInstructionLength); 26 Assembler::kCallInstructionLength);
27 rinfo()->PatchCodeWithCall( 27 rinfo()->PatchCodeWithCall(
28 debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(), 28 debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(),
29 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength); 29 Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength);
30 } 30 }
31 31
32 32
33 // Restore the JS frame exit code. 33 // Restore the JS frame exit code.
34 void BreakLocationIterator::ClearDebugBreakAtReturn() { 34 void BreakLocationIterator::ClearDebugBreakAtReturn() {
35 rinfo()->PatchCode(original_rinfo()->pc(), 35 rinfo()->PatchCode(original_rinfo()->pc(),
36 Assembler::kJSReturnSequenceLength); 36 Assembler::kJSReturnSequenceLength);
37 } 37 }
38 38
39 39
40 // A debug break in the frame exit code is identified by the JS frame exit code 40 // A debug break in the frame exit code is identified by the JS frame exit code
41 // having been patched with a call instruction. 41 // having been patched with a call instruction.
42 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { 42 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
43 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); 43 DCHECK(RelocInfo::IsJSReturn(rinfo->rmode()));
44 return rinfo->IsPatchedReturnSequence(); 44 return rinfo->IsPatchedReturnSequence();
45 } 45 }
46 46
47 47
48 bool BreakLocationIterator::IsDebugBreakAtSlot() { 48 bool BreakLocationIterator::IsDebugBreakAtSlot() {
49 ASSERT(IsDebugBreakSlot()); 49 DCHECK(IsDebugBreakSlot());
50 // Check whether the debug break slot instructions have been patched. 50 // Check whether the debug break slot instructions have been patched.
51 return rinfo()->IsPatchedDebugBreakSlotSequence(); 51 return rinfo()->IsPatchedDebugBreakSlotSequence();
52 } 52 }
53 53
54 54
55 void BreakLocationIterator::SetDebugBreakAtSlot() { 55 void BreakLocationIterator::SetDebugBreakAtSlot() {
56 ASSERT(IsDebugBreakSlot()); 56 DCHECK(IsDebugBreakSlot());
57 Isolate* isolate = debug_info_->GetIsolate(); 57 Isolate* isolate = debug_info_->GetIsolate();
58 rinfo()->PatchCodeWithCall( 58 rinfo()->PatchCodeWithCall(
59 isolate->builtins()->Slot_DebugBreak()->entry(), 59 isolate->builtins()->Slot_DebugBreak()->entry(),
60 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); 60 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength);
61 } 61 }
62 62
63 63
64 void BreakLocationIterator::ClearDebugBreakAtSlot() { 64 void BreakLocationIterator::ClearDebugBreakAtSlot() {
65 ASSERT(IsDebugBreakSlot()); 65 DCHECK(IsDebugBreakSlot());
66 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); 66 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength);
67 } 67 }
68 68
69 69
70 #define __ ACCESS_MASM(masm) 70 #define __ ACCESS_MASM(masm)
71 71
72 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, 72 static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
73 RegList object_regs, 73 RegList object_regs,
74 RegList non_object_regs, 74 RegList non_object_regs,
75 bool convert_call_to_jmp) { 75 bool convert_call_to_jmp) {
76 // Enter an internal frame. 76 // Enter an internal frame.
77 { 77 {
78 FrameScope scope(masm, StackFrame::INTERNAL); 78 FrameScope scope(masm, StackFrame::INTERNAL);
79 79
80 // Load padding words on stack. 80 // Load padding words on stack.
81 for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) { 81 for (int i = 0; i < LiveEdit::kFramePaddingInitialSize; i++) {
82 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingValue))); 82 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingValue)));
83 } 83 }
84 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingInitialSize))); 84 __ push(Immediate(Smi::FromInt(LiveEdit::kFramePaddingInitialSize)));
85 85
86 // Store the registers containing live values on the expression stack to 86 // Store the registers containing live values on the expression stack to
87 // make sure that these are correctly updated during GC. Non object values 87 // make sure that these are correctly updated during GC. Non object values
88 // are stored as a smi causing it to be untouched by GC. 88 // are stored as a smi causing it to be untouched by GC.
89 ASSERT((object_regs & ~kJSCallerSaved) == 0); 89 DCHECK((object_regs & ~kJSCallerSaved) == 0);
90 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); 90 DCHECK((non_object_regs & ~kJSCallerSaved) == 0);
91 ASSERT((object_regs & non_object_regs) == 0); 91 DCHECK((object_regs & non_object_regs) == 0);
92 for (int i = 0; i < kNumJSCallerSaved; i++) { 92 for (int i = 0; i < kNumJSCallerSaved; i++) {
93 int r = JSCallerSavedCode(i); 93 int r = JSCallerSavedCode(i);
94 Register reg = { r }; 94 Register reg = { r };
95 if ((object_regs & (1 << r)) != 0) { 95 if ((object_regs & (1 << r)) != 0) {
96 __ push(reg); 96 __ push(reg);
97 } 97 }
98 if ((non_object_regs & (1 << r)) != 0) { 98 if ((non_object_regs & (1 << r)) != 0) {
99 if (FLAG_debug_code) { 99 if (FLAG_debug_code) {
100 __ test(reg, Immediate(0xc0000000)); 100 __ test(reg, Immediate(0xc0000000));
101 __ Assert(zero, kUnableToEncodeValueAsSmi); 101 __ Assert(zero, kUnableToEncodeValueAsSmi);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if ((non_object_regs & (1 << r)) != 0) { 134 if ((non_object_regs & (1 << r)) != 0) {
135 __ pop(reg); 135 __ pop(reg);
136 __ SmiUntag(reg); 136 __ SmiUntag(reg);
137 taken = true; 137 taken = true;
138 } 138 }
139 if (!taken) { 139 if (!taken) {
140 unused_reg = reg; 140 unused_reg = reg;
141 } 141 }
142 } 142 }
143 143
144 ASSERT(unused_reg.code() != -1); 144 DCHECK(unused_reg.code() != -1);
145 145
146 // Read current padding counter and skip corresponding number of words. 146 // Read current padding counter and skip corresponding number of words.
147 __ pop(unused_reg); 147 __ pop(unused_reg);
148 // We divide stored value by 2 (untagging) and multiply it by word's size. 148 // We divide stored value by 2 (untagging) and multiply it by word's size.
149 STATIC_ASSERT(kSmiTagSize == 1 && kSmiShiftSize == 0); 149 STATIC_ASSERT(kSmiTagSize == 1 && kSmiShiftSize == 0);
150 __ lea(esp, Operand(esp, unused_reg, times_half_pointer_size, 0)); 150 __ lea(esp, Operand(esp, unused_reg, times_half_pointer_size, 0));
151 151
152 // Get rid of the internal frame. 152 // Get rid of the internal frame.
153 } 153 }
154 154
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 eax.bit(), false); 268 eax.bit(), false);
269 } 269 }
270 270
271 271
272 void DebugCodegen::GenerateSlot(MacroAssembler* masm) { 272 void DebugCodegen::GenerateSlot(MacroAssembler* masm) {
273 // Generate enough nop's to make space for a call instruction. 273 // Generate enough nop's to make space for a call instruction.
274 Label check_codesize; 274 Label check_codesize;
275 __ bind(&check_codesize); 275 __ bind(&check_codesize);
276 __ RecordDebugBreakSlot(); 276 __ RecordDebugBreakSlot();
277 __ Nop(Assembler::kDebugBreakSlotLength); 277 __ Nop(Assembler::kDebugBreakSlotLength);
278 ASSERT_EQ(Assembler::kDebugBreakSlotLength, 278 DCHECK_EQ(Assembler::kDebugBreakSlotLength,
279 masm->SizeOfCodeGeneratedSince(&check_codesize)); 279 masm->SizeOfCodeGeneratedSince(&check_codesize));
280 } 280 }
281 281
282 282
283 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) { 283 void DebugCodegen::GenerateSlotDebugBreak(MacroAssembler* masm) {
284 // In the places where a debug break slot is inserted no registers can contain 284 // In the places where a debug break slot is inserted no registers can contain
285 // object pointers. 285 // object pointers.
286 Generate_DebugBreakCallHelper(masm, 0, 0, true); 286 Generate_DebugBreakCallHelper(masm, 0, 0, true);
287 } 287 }
288 288
(...skipping 28 matching lines...) Expand all
317 } 317 }
318 318
319 319
320 const bool LiveEdit::kFrameDropperSupported = true; 320 const bool LiveEdit::kFrameDropperSupported = true;
321 321
322 #undef __ 322 #undef __
323 323
324 } } // namespace v8::internal 324 } } // namespace v8::internal
325 325
326 #endif // V8_TARGET_ARCH_X87 326 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/codegen-x87.cc ('k') | src/x87/deoptimizer-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698