Chromium Code Reviews| Index: src/compiler/code-stub-assembler.cc |
| diff --git a/src/compiler/code-stub-assembler.cc b/src/compiler/code-stub-assembler.cc |
| index f4ecab605bc2977eda7de9d79d3fd1291cc9db29..8507d6fcd8299bd6baebf4daa54e217f63daa17f 100644 |
| --- a/src/compiler/code-stub-assembler.cc |
| +++ b/src/compiler/code-stub-assembler.cc |
| @@ -37,7 +37,24 @@ CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, |
| flags_(flags), |
| name_(name), |
| code_generated_(false), |
| - variables_(zone) {} |
| + variables_(zone), |
| + linkage_type_(LinkageDescriptorType::kStubCall), |
| + parameter_count_(descriptor.GetParameterCount()) {} |
| + |
| + |
| +CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, |
| + int parameter_count, Code::Flags flags, |
| + const char* name) |
| + : raw_assembler_(new RawMachineAssembler( |
| + isolate, new (zone) Graph(zone), |
| + Linkage::GetJSCallDescriptor(zone, false, parameter_count, |
| + CallDescriptor::kNoFlags))), |
| + flags_(flags), |
| + name_(name), |
| + code_generated_(false), |
| + variables_(zone), |
| + linkage_type_(LinkageDescriptorType::kJSCall), |
| + parameter_count_(parameter_count) {} |
| CodeStubAssembler::~CodeStubAssembler() {} |
| @@ -128,14 +145,17 @@ Node* CodeStubAssembler::SmiUntag(Node* value) { |
| CODE_STUB_ASSEMBLER_BINARY_OP_LIST(DEFINE_CODE_STUB_ASSEMBER_BINARY_OP) |
| #undef DEFINE_CODE_STUB_ASSEMBER_BINARY_OP |
| -Node* CodeStubAssembler::ChangeInt32ToInt64(Node* value) { |
| - return raw_assembler_->ChangeInt32ToInt64(value); |
| -} |
| - |
| Node* CodeStubAssembler::WordShl(Node* value, int shift) { |
| return raw_assembler_->WordShl(value, Int32Constant(shift)); |
| } |
| + |
| +#define DEFINE_CODE_STUB_ASSEMBER_UNARY_OP(name) \ |
| + Node* CodeStubAssembler::name(Node* a) { return raw_assembler_->name(a); } |
| +CODE_STUB_ASSEMBLER_UNARY_OP_LIST(DEFINE_CODE_STUB_ASSEMBER_UNARY_OP) |
| +#undef DEFINE_CODE_STUB_ASSEMBER_UNARY_OP |
| + |
| + |
| Node* CodeStubAssembler::WordIsSmi(Node* a) { |
| return WordEqual(raw_assembler_->WordAnd(a, Int32Constant(kSmiTagMask)), |
| Int32Constant(0)); |
| @@ -151,6 +171,11 @@ Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) { |
| IntPtrConstant(offset - kHeapObjectTag)); |
| } |
| +Node* CodeStubAssembler::LoadHeapNumber(Node* object) { |
| + return raw_assembler_->Load(MachineType::Float64(), object, |
| + IntPtrConstant(HeapNumber::kValueOffset)); |
| +} |
| + |
| Node* CodeStubAssembler::LoadFixedArrayElementSmiIndex(Node* object, |
| Node* smi_index, |
| int additional_offset) { |
| @@ -226,6 +251,30 @@ Node* CodeStubAssembler::Projection(int index, Node* value) { |
| return raw_assembler_->Projection(index, value); |
| } |
| +Node* CodeStubAssembler::InstanceType(Node* object) { |
| + return raw_assembler_->WordAnd( |
| + LoadObjectField(LoadObjectField(object, HeapObject::kMapOffset), |
| + Map::kInstanceTypeOffset), |
| + raw_assembler_->Int32Constant(255)); |
| +} |
| + |
| +Node* CodeStubAssembler::BitFieldValue(Node* word32, uint32_t shift, |
| + uint32_t mask) { |
| + return raw_assembler_->Word32Shr( |
| + raw_assembler_->Word32And(word32, raw_assembler_->Int32Constant(mask)), |
| + raw_assembler_->Int32Constant(shift)); |
| +} |
| + |
| +Node* CodeStubAssembler::Context() { |
|
binji
2016/02/12 01:46:56
This seems a bit weird, but seems to work. Better
Benedikt Meurer
2016/02/12 05:58:38
I think we shouldn't have this helper method, it's
binji
2016/02/12 20:35:18
Done.
|
| + switch (linkage_type_) { |
| + case LinkageDescriptorType::kStubCall: |
| + return Parameter(Linkage::GetStubCallContextParamIndex(parameter_count_)); |
| + |
| + case LinkageDescriptorType::kJSCall: |
| + return Parameter(Linkage::GetJSCallContextParamIndex(parameter_count_)); |
| + } |
| +} |
| + |
| Node* CodeStubAssembler::CallN(CallDescriptor* descriptor, Node* code_target, |
| Node** args) { |
| CallPrologue(); |
| @@ -286,6 +335,11 @@ Node* CodeStubAssembler::CallRuntime(Runtime::FunctionId function_id, |
| } |
| Node* CodeStubAssembler::TailCallRuntime(Runtime::FunctionId function_id, |
| + Node* context) { |
| + return raw_assembler_->TailCallRuntime0(function_id, context); |
| +} |
| + |
| +Node* CodeStubAssembler::TailCallRuntime(Runtime::FunctionId function_id, |
| Node* context, Node* arg1) { |
| return raw_assembler_->TailCallRuntime1(function_id, arg1, context); |
| } |