| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 | 6 |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
| 10 #include "src/snapshot/serialize.h" // TODO(turbofan): RootIndexMap |
| 10 | 11 |
| 11 namespace v8 { | 12 namespace v8 { |
| 12 namespace internal { | 13 namespace internal { |
| 13 namespace compiler { | 14 namespace compiler { |
| 14 | 15 |
| 15 class CodeGenerator::JumpTable final : public ZoneObject { | 16 class CodeGenerator::JumpTable final : public ZoneObject { |
| 16 public: | 17 public: |
| 17 JumpTable(JumpTable* next, Label** targets, size_t target_count) | 18 JumpTable(JumpTable* next, Label** targets, size_t target_count) |
| 18 : next_(next), targets_(targets), target_count_(target_count) {} | 19 : next_(next), targets_(targets), target_count_(target_count) {} |
| 19 | 20 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return true; | 232 return true; |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 return false; | 235 return false; |
| 235 } | 236 } |
| 236 | 237 |
| 237 | 238 |
| 238 bool CodeGenerator::IsMaterializableFromRoot( | 239 bool CodeGenerator::IsMaterializableFromRoot( |
| 239 Handle<HeapObject> object, Heap::RootListIndex* index_return) { | 240 Handle<HeapObject> object, Heap::RootListIndex* index_return) { |
| 240 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { | 241 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { |
| 241 // Check if {object} is one of the non-smi roots that cannot be written | 242 RootIndexMap map(isolate()); |
| 242 // after initialization. | 243 int root_index = map.Lookup(*object); |
| 243 for (int i = 0; i < Heap::kSmiRootsStart; ++i) { | 244 if (root_index != RootIndexMap::kInvalidRootIndex) { |
| 244 Heap::RootListIndex const index = static_cast<Heap::RootListIndex>(i); | 245 *index_return = static_cast<Heap::RootListIndex>(root_index); |
| 245 if (!Heap::RootCanBeWrittenAfterInitialization(index) && | 246 return true; |
| 246 *object == isolate()->heap()->root(index)) { | |
| 247 *index_return = index; | |
| 248 return true; | |
| 249 } | |
| 250 } | 247 } |
| 251 } | 248 } |
| 252 return false; | 249 return false; |
| 253 } | 250 } |
| 254 | 251 |
| 255 | 252 |
| 256 void CodeGenerator::AssembleInstruction(Instruction* instr) { | 253 void CodeGenerator::AssembleInstruction(Instruction* instr) { |
| 257 AssembleGaps(instr); | 254 AssembleGaps(instr); |
| 258 AssembleSourcePosition(instr); | 255 AssembleSourcePosition(instr); |
| 259 // Assemble architecture-specific code for the instruction. | 256 // Assemble architecture-specific code for the instruction. |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 : masm_(gen->masm()), next_(gen->ools_) { | 705 : masm_(gen->masm()), next_(gen->ools_) { |
| 709 gen->ools_ = this; | 706 gen->ools_ = this; |
| 710 } | 707 } |
| 711 | 708 |
| 712 | 709 |
| 713 OutOfLineCode::~OutOfLineCode() {} | 710 OutOfLineCode::~OutOfLineCode() {} |
| 714 | 711 |
| 715 } // namespace compiler | 712 } // namespace compiler |
| 716 } // namespace internal | 713 } // namespace internal |
| 717 } // namespace v8 | 714 } // namespace v8 |
| OLD | NEW |