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

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 2398603002: [turbofan][x64] Improve code generation for external reference access. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/pipeline.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/compiler/instruction-selector-impl.h" 10 #include "src/compiler/instruction-selector-impl.h"
11 #include "src/compiler/node-matchers.h" 11 #include "src/compiler/node-matchers.h"
12 #include "src/compiler/pipeline.h" 12 #include "src/compiler/pipeline.h"
13 #include "src/compiler/schedule.h" 13 #include "src/compiler/schedule.h"
14 #include "src/compiler/state-values-utils.h" 14 #include "src/compiler/state-values-utils.h"
15 #include "src/deoptimizer.h" 15 #include "src/deoptimizer.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 namespace compiler { 19 namespace compiler {
20 20
21 InstructionSelector::InstructionSelector( 21 InstructionSelector::InstructionSelector(
22 Zone* zone, size_t node_count, Linkage* linkage, 22 Zone* zone, size_t node_count, Linkage* linkage,
23 InstructionSequence* sequence, Schedule* schedule, 23 InstructionSequence* sequence, Schedule* schedule,
24 SourcePositionTable* source_positions, Frame* frame, 24 SourcePositionTable* source_positions, Frame* frame,
25 SourcePositionMode source_position_mode, Features features, 25 SourcePositionMode source_position_mode, Features features,
26 EnableScheduling enable_scheduling) 26 EnableScheduling enable_scheduling,
27 EnableSerialization enable_serialization)
27 : zone_(zone), 28 : zone_(zone),
28 linkage_(linkage), 29 linkage_(linkage),
29 sequence_(sequence), 30 sequence_(sequence),
30 source_positions_(source_positions), 31 source_positions_(source_positions),
31 source_position_mode_(source_position_mode), 32 source_position_mode_(source_position_mode),
32 features_(features), 33 features_(features),
33 schedule_(schedule), 34 schedule_(schedule),
34 current_block_(nullptr), 35 current_block_(nullptr),
35 instructions_(zone), 36 instructions_(zone),
36 defined_(node_count, false, zone), 37 defined_(node_count, false, zone),
37 used_(node_count, false, zone), 38 used_(node_count, false, zone),
38 effect_level_(node_count, 0, zone), 39 effect_level_(node_count, 0, zone),
39 virtual_registers_(node_count, 40 virtual_registers_(node_count,
40 InstructionOperand::kInvalidVirtualRegister, zone), 41 InstructionOperand::kInvalidVirtualRegister, zone),
41 virtual_register_rename_(zone), 42 virtual_register_rename_(zone),
42 scheduler_(nullptr), 43 scheduler_(nullptr),
43 enable_scheduling_(enable_scheduling), 44 enable_scheduling_(enable_scheduling),
45 enable_serialization_(enable_serialization),
44 frame_(frame), 46 frame_(frame),
45 instruction_selection_failed_(false) { 47 instruction_selection_failed_(false) {
46 instructions_.reserve(node_count); 48 instructions_.reserve(node_count);
47 } 49 }
48 50
49 bool InstructionSelector::SelectInstructions() { 51 bool InstructionSelector::SelectInstructions() {
50 // Mark the inputs of all phis in loop headers as used. 52 // Mark the inputs of all phis in loop headers as used.
51 BasicBlockVector* blocks = schedule()->rpo_order(); 53 BasicBlockVector* blocks = schedule()->rpo_order();
52 for (auto const block : *blocks) { 54 for (auto const block : *blocks) {
53 if (!block->IsLoopHeader()) continue; 55 if (!block->IsLoopHeader()) continue;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return effect_level_[id]; 384 return effect_level_[id];
383 } 385 }
384 386
385 void InstructionSelector::SetEffectLevel(Node* node, int effect_level) { 387 void InstructionSelector::SetEffectLevel(Node* node, int effect_level) {
386 DCHECK_NOT_NULL(node); 388 DCHECK_NOT_NULL(node);
387 size_t const id = node->id(); 389 size_t const id = node->id();
388 DCHECK_LT(id, effect_level_.size()); 390 DCHECK_LT(id, effect_level_.size());
389 effect_level_[id] = effect_level; 391 effect_level_[id] = effect_level;
390 } 392 }
391 393
394 bool InstructionSelector::CanAddressRelativeToRootsRegister() const {
395 return (enable_serialization_ == kDisableSerialization &&
396 (linkage()->GetIncomingDescriptor()->flags() &
397 CallDescriptor::kCanUseRoots));
398 }
399
392 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep, 400 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep,
393 const InstructionOperand& op) { 401 const InstructionOperand& op) {
394 UnallocatedOperand unalloc = UnallocatedOperand::cast(op); 402 UnallocatedOperand unalloc = UnallocatedOperand::cast(op);
395 sequence()->MarkAsRepresentation(rep, unalloc.virtual_register()); 403 sequence()->MarkAsRepresentation(rep, unalloc.virtual_register());
396 } 404 }
397 405
398 406
399 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep, 407 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep,
400 Node* node) { 408 Node* node) {
401 sequence()->MarkAsRepresentation(rep, GetVirtualRegister(node)); 409 sequence()->MarkAsRepresentation(rep, GetVirtualRegister(node));
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 return new (instruction_zone()) FrameStateDescriptor( 2121 return new (instruction_zone()) FrameStateDescriptor(
2114 instruction_zone(), state_info.type(), state_info.bailout_id(), 2122 instruction_zone(), state_info.type(), state_info.bailout_id(),
2115 state_info.state_combine(), parameters, locals, stack, 2123 state_info.state_combine(), parameters, locals, stack,
2116 state_info.shared_info(), outer_state); 2124 state_info.shared_info(), outer_state);
2117 } 2125 }
2118 2126
2119 2127
2120 } // namespace compiler 2128 } // namespace compiler
2121 } // namespace internal 2129 } // namespace internal
2122 } // namespace v8 2130 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698