OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Bad node id. | 40 // Bad node id. |
41 return; | 41 return; |
42 } | 42 } |
43 BreakOnNode(node_id); | 43 BreakOnNode(node_id); |
44 } | 44 } |
45 | 45 |
46 void CodeStubAssembler::Assert(const NodeGenerator& codition_body, | 46 void CodeStubAssembler::Assert(const NodeGenerator& codition_body, |
47 const char* message, const char* file, | 47 const char* message, const char* file, |
48 int line) { | 48 int line) { |
49 #if defined(DEBUG) | 49 #if defined(DEBUG) |
50 Label ok(this); | 50 if (FLAG_debug_code) { |
51 Label not_ok(this, Label::kDeferred); | 51 Label ok(this); |
52 if (message != nullptr && FLAG_code_comments) { | 52 Label not_ok(this, Label::kDeferred); |
53 Comment("[ Assert: %s", message); | 53 if (message != nullptr && FLAG_code_comments) { |
54 } else { | 54 Comment("[ Assert: %s", message); |
55 Comment("[ Assert"); | 55 } else { |
| 56 Comment("[ Assert"); |
| 57 } |
| 58 Node* condition = codition_body(); |
| 59 DCHECK_NOT_NULL(condition); |
| 60 Branch(condition, &ok, ¬_ok); |
| 61 Bind(¬_ok); |
| 62 if (message != nullptr) { |
| 63 char chars[1024]; |
| 64 Vector<char> buffer(chars); |
| 65 if (file != nullptr) { |
| 66 SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file, |
| 67 line); |
| 68 } else { |
| 69 SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message); |
| 70 } |
| 71 CallRuntime( |
| 72 Runtime::kGlobalPrint, SmiConstant(Smi::kZero), |
| 73 HeapConstant(factory()->NewStringFromAsciiChecked(&(buffer[0])))); |
| 74 } |
| 75 DebugBreak(); |
| 76 Goto(&ok); |
| 77 Bind(&ok); |
| 78 Comment("] Assert"); |
56 } | 79 } |
57 Node* condition = codition_body(); | |
58 DCHECK_NOT_NULL(condition); | |
59 Branch(condition, &ok, ¬_ok); | |
60 Bind(¬_ok); | |
61 if (message != nullptr) { | |
62 char chars[1024]; | |
63 Vector<char> buffer(chars); | |
64 if (file != nullptr) { | |
65 SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file, line); | |
66 } else { | |
67 SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message); | |
68 } | |
69 CallRuntime( | |
70 Runtime::kGlobalPrint, SmiConstant(Smi::kZero), | |
71 HeapConstant(factory()->NewStringFromAsciiChecked(&(buffer[0])))); | |
72 } | |
73 DebugBreak(); | |
74 Goto(&ok); | |
75 Bind(&ok); | |
76 Comment("] Assert"); | |
77 #endif | 80 #endif |
78 } | 81 } |
79 | 82 |
80 Node* CodeStubAssembler::Select(Node* condition, const NodeGenerator& true_body, | 83 Node* CodeStubAssembler::Select(Node* condition, const NodeGenerator& true_body, |
81 const NodeGenerator& false_body, | 84 const NodeGenerator& false_body, |
82 MachineRepresentation rep) { | 85 MachineRepresentation rep) { |
83 Variable value(this, rep); | 86 Variable value(this, rep); |
84 Label vtrue(this), vfalse(this), end(this); | 87 Label vtrue(this), vfalse(this), end(this); |
85 Branch(condition, &vtrue, &vfalse); | 88 Branch(condition, &vtrue, &vfalse); |
86 | 89 |
(...skipping 8361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8448 formatted.c_str(), TENURED); | 8451 formatted.c_str(), TENURED); |
8449 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8452 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8450 HeapConstant(string)); | 8453 HeapConstant(string)); |
8451 } | 8454 } |
8452 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8455 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8453 #endif | 8456 #endif |
8454 } | 8457 } |
8455 | 8458 |
8456 } // namespace internal | 8459 } // namespace internal |
8457 } // namespace v8 | 8460 } // namespace v8 |
OLD | NEW |