| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-stub-assembler.h" | 5 #include "src/compiler/code-stub-assembler.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 Node* CodeStubAssembler::ExternalConstant(ExternalReference address) { | 100 Node* CodeStubAssembler::ExternalConstant(ExternalReference address) { |
| 101 return raw_assembler_->ExternalConstant(address); | 101 return raw_assembler_->ExternalConstant(address); |
| 102 } | 102 } |
| 103 | 103 |
| 104 Node* CodeStubAssembler::Float64Constant(double value) { | 104 Node* CodeStubAssembler::Float64Constant(double value) { |
| 105 return raw_assembler_->Float64Constant(value); | 105 return raw_assembler_->Float64Constant(value); |
| 106 } | 106 } |
| 107 | 107 |
| 108 Node* CodeStubAssembler::BooleanMapConstant() { |
| 109 return HeapConstant(isolate()->factory()->boolean_map()); |
| 110 } |
| 111 |
| 108 Node* CodeStubAssembler::HeapNumberMapConstant() { | 112 Node* CodeStubAssembler::HeapNumberMapConstant() { |
| 109 return HeapConstant(isolate()->factory()->heap_number_map()); | 113 return HeapConstant(isolate()->factory()->heap_number_map()); |
| 110 } | 114 } |
| 111 | 115 |
| 112 Node* CodeStubAssembler::Parameter(int value) { | 116 Node* CodeStubAssembler::Parameter(int value) { |
| 113 return raw_assembler_->Parameter(value); | 117 return raw_assembler_->Parameter(value); |
| 114 } | 118 } |
| 115 | 119 |
| 116 | 120 |
| 117 void CodeStubAssembler::Return(Node* value) { | 121 void CodeStubAssembler::Return(Node* value) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { | 219 Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { |
| 216 return raw_assembler_->Load(MachineType::AnyTagged(), object, | 220 return raw_assembler_->Load(MachineType::AnyTagged(), object, |
| 217 IntPtrConstant(offset - kHeapObjectTag)); | 221 IntPtrConstant(offset - kHeapObjectTag)); |
| 218 } | 222 } |
| 219 | 223 |
| 220 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { | 224 Node* CodeStubAssembler::LoadHeapNumberValue(Node* object) { |
| 221 return Load(MachineType::Float64(), object, | 225 return Load(MachineType::Float64(), object, |
| 222 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); | 226 IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag)); |
| 223 } | 227 } |
| 224 | 228 |
| 229 Node* CodeStubAssembler::LoadMapBitField(Node* map) { |
| 230 return Load(MachineType::Uint8(), map, |
| 231 IntPtrConstant(Map::kBitFieldOffset - kHeapObjectTag)); |
| 232 } |
| 233 |
| 225 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { | 234 Node* CodeStubAssembler::LoadMapInstanceType(Node* map) { |
| 226 return Load(MachineType::Uint8(), map, | 235 return Load(MachineType::Uint8(), map, |
| 227 IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag)); | 236 IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag)); |
| 228 } | 237 } |
| 229 | 238 |
| 230 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, | 239 Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, |
| 231 Node* smi_index, | 240 Node* smi_index, |
| 232 int additional_offset) { | 241 int additional_offset) { |
| 233 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; | 242 int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; |
| 234 Node* header_size = IntPtrConstant(additional_offset + | 243 Node* header_size = IntPtrConstant(additional_offset + |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 Node* CodeStubAssembler::StoreNoWriteBarrier(MachineRepresentation rep, | 431 Node* CodeStubAssembler::StoreNoWriteBarrier(MachineRepresentation rep, |
| 423 Node* base, Node* index, | 432 Node* base, Node* index, |
| 424 Node* value) { | 433 Node* value) { |
| 425 return raw_assembler_->Store(rep, base, index, value, kNoWriteBarrier); | 434 return raw_assembler_->Store(rep, base, index, value, kNoWriteBarrier); |
| 426 } | 435 } |
| 427 | 436 |
| 428 Node* CodeStubAssembler::Projection(int index, Node* value) { | 437 Node* CodeStubAssembler::Projection(int index, Node* value) { |
| 429 return raw_assembler_->Projection(index, value); | 438 return raw_assembler_->Projection(index, value); |
| 430 } | 439 } |
| 431 | 440 |
| 441 Node* CodeStubAssembler::LoadMap(Node* object) { |
| 442 return LoadObjectField(object, HeapObject::kMapOffset); |
| 443 } |
| 444 |
| 432 Node* CodeStubAssembler::LoadInstanceType(Node* object) { | 445 Node* CodeStubAssembler::LoadInstanceType(Node* object) { |
| 433 return LoadMapInstanceType(LoadObjectField(object, HeapObject::kMapOffset)); | 446 return LoadMapInstanceType(LoadMap(object)); |
| 434 } | 447 } |
| 435 | 448 |
| 436 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 449 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
| 437 uint32_t mask) { | 450 uint32_t mask) { |
| 438 return raw_assembler_->Word32Shr( | 451 return raw_assembler_->Word32Shr( |
| 439 raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), | 452 raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), |
| 440 raw_assembler_->Int32Constant(shift)); | 453 raw_assembler_->Int32Constant(shift)); |
| 441 } | 454 } |
| 442 | 455 |
| 443 void CodeStubAssembler::BranchIfInt32LessThan(Node* a, Node* b, Label* if_true, | 456 void CodeStubAssembler::BranchIfInt32LessThan(Node* a, Node* b, Label* if_true, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 Label* if_false) { | 533 Label* if_false) { |
| 521 Label if_greaterthanorequal(this), if_notgreaterthanorequal(this); | 534 Label if_greaterthanorequal(this), if_notgreaterthanorequal(this); |
| 522 Branch(Float64GreaterThanOrEqual(a, b), &if_greaterthanorequal, | 535 Branch(Float64GreaterThanOrEqual(a, b), &if_greaterthanorequal, |
| 523 &if_notgreaterthanorequal); | 536 &if_notgreaterthanorequal); |
| 524 Bind(&if_greaterthanorequal); | 537 Bind(&if_greaterthanorequal); |
| 525 Goto(if_true); | 538 Goto(if_true); |
| 526 Bind(&if_notgreaterthanorequal); | 539 Bind(&if_notgreaterthanorequal); |
| 527 Goto(if_false); | 540 Goto(if_false); |
| 528 } | 541 } |
| 529 | 542 |
| 543 void CodeStubAssembler::BranchIfWord32Equal(Node* a, Node* b, Label* if_true, |
| 544 Label* if_false) { |
| 545 Label if_equal(this), if_notequal(this); |
| 546 Branch(Word32Equal(a, b), &if_equal, &if_notequal); |
| 547 Bind(&if_equal); |
| 548 Goto(if_true); |
| 549 Bind(&if_notequal); |
| 550 Goto(if_false); |
| 551 } |
| 552 |
| 530 Node* CodeStubAssembler::CallN(CallDescriptor* descriptor, Node* code_target, | 553 Node* CodeStubAssembler::CallN(CallDescriptor* descriptor, Node* code_target, |
| 531 Node** args) { | 554 Node** args) { |
| 532 CallPrologue(); | 555 CallPrologue(); |
| 533 Node* return_value = raw_assembler_->CallN(descriptor, code_target, args); | 556 Node* return_value = raw_assembler_->CallN(descriptor, code_target, args); |
| 534 CallEpilogue(); | 557 CallEpilogue(); |
| 535 return return_value; | 558 return return_value; |
| 536 } | 559 } |
| 537 | 560 |
| 538 | 561 |
| 539 Node* CodeStubAssembler::TailCallN(CallDescriptor* descriptor, | 562 Node* CodeStubAssembler::TailCallN(CallDescriptor* descriptor, |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 } | 951 } |
| 929 } | 952 } |
| 930 } | 953 } |
| 931 | 954 |
| 932 bound_ = true; | 955 bound_ = true; |
| 933 } | 956 } |
| 934 | 957 |
| 935 } // namespace compiler | 958 } // namespace compiler |
| 936 } // namespace internal | 959 } // namespace internal |
| 937 } // namespace v8 | 960 } // namespace v8 |
| OLD | NEW |