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 { |
11 | 11 |
12 using compiler::Node; | 12 using compiler::Node; |
13 | 13 |
| 14 CodeStubAssembler::CodeStubAssembler(compiler::CodeAssemblerState* state) |
| 15 : compiler::CodeAssembler(state) { |
| 16 if (DEBUG_BOOL && FLAG_csa_trap_on_node != nullptr) { |
| 17 HandleBreakOnNode(); |
| 18 } |
| 19 } |
| 20 |
| 21 void CodeStubAssembler::HandleBreakOnNode() { |
| 22 // FLAG_csa_trap_on_node should be in a form "STUB,NODE" where STUB is a |
| 23 // string specifying the name of a stub and NODE is number specifying node id. |
| 24 const char* name = state()->name(); |
| 25 size_t name_length = strlen(name); |
| 26 if (strncmp(FLAG_csa_trap_on_node, name, name_length) != 0) { |
| 27 // Different name. |
| 28 return; |
| 29 } |
| 30 size_t option_length = strlen(FLAG_csa_trap_on_node); |
| 31 if (option_length < name_length + 2 || |
| 32 FLAG_csa_trap_on_node[name_length] != ',') { |
| 33 // Option is too short. |
| 34 return; |
| 35 } |
| 36 const char* start = &FLAG_csa_trap_on_node[name_length + 1]; |
| 37 char* end; |
| 38 int node_id = static_cast<int>(strtol(start, &end, 10)); |
| 39 if (start == end) { |
| 40 // Bad node id. |
| 41 return; |
| 42 } |
| 43 BreakOnNode(node_id); |
| 44 } |
| 45 |
14 void CodeStubAssembler::Assert(const NodeGenerator& codition_body, | 46 void CodeStubAssembler::Assert(const NodeGenerator& codition_body, |
15 const char* message, const char* file, | 47 const char* message, const char* file, |
16 int line) { | 48 int line) { |
17 #if defined(DEBUG) | 49 #if defined(DEBUG) |
18 Label ok(this); | 50 Label ok(this); |
19 Label not_ok(this, Label::kDeferred); | 51 Label not_ok(this, Label::kDeferred); |
20 if (message != nullptr && FLAG_code_comments) { | 52 if (message != nullptr && FLAG_code_comments) { |
21 Comment("[ Assert: %s", message); | 53 Comment("[ Assert: %s", message); |
22 } else { | 54 } else { |
23 Comment("[ Assert"); | 55 Comment("[ Assert"); |
(...skipping 8257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8281 Heap::kUndefinedValueRootIndex); | 8313 Heap::kUndefinedValueRootIndex); |
8282 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, | 8314 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, |
8283 Heap::kUndefinedValueRootIndex); | 8315 Heap::kUndefinedValueRootIndex); |
8284 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8316 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
8285 context); | 8317 context); |
8286 return result; | 8318 return result; |
8287 } | 8319 } |
8288 | 8320 |
8289 } // namespace internal | 8321 } // namespace internal |
8290 } // namespace v8 | 8322 } // namespace v8 |
OLD | NEW |