| Index: src/x64/code-stubs-x64.h
|
| ===================================================================
|
| --- src/x64/code-stubs-x64.h (revision 6941)
|
| +++ src/x64/code-stubs-x64.h (working copy)
|
| @@ -87,7 +87,7 @@
|
| ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
|
| }
|
|
|
| - GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info)
|
| + GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type)
|
| : op_(OpBits::decode(key)),
|
| mode_(ModeBits::decode(key)),
|
| flags_(FlagBits::decode(key)),
|
| @@ -95,7 +95,7 @@
|
| args_reversed_(ArgsReversedBits::decode(key)),
|
| static_operands_type_(TypeInfo::ExpandedRepresentation(
|
| StaticTypeInfoBits::decode(key))),
|
| - runtime_operands_type_(type_info),
|
| + runtime_operands_type_(runtime_operands_type),
|
| name_(NULL) {
|
| }
|
|
|
| @@ -131,7 +131,7 @@
|
| #ifdef DEBUG
|
| void Print() {
|
| PrintF("GenericBinaryOpStub %d (op %s), "
|
| - "(mode %d, flags %d, registers %d, reversed %d, only_numbers %s)\n",
|
| + "(mode %d, flags %d, registers %d, reversed %d, type_info %s)\n",
|
| MinorKey(),
|
| Token::String(op_),
|
| static_cast<int>(mode_),
|
| @@ -200,6 +200,104 @@
|
| friend class CodeGenerator;
|
| };
|
|
|
| +
|
| +class TypeRecordingBinaryOpStub: public CodeStub {
|
| + public:
|
| + TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode)
|
| + : op_(op),
|
| + mode_(mode),
|
| + operands_type_(TRBinaryOpIC::UNINITIALIZED),
|
| + result_type_(TRBinaryOpIC::UNINITIALIZED),
|
| + name_(NULL) {
|
| + ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
|
| + }
|
| +
|
| + TypeRecordingBinaryOpStub(
|
| + int key,
|
| + TRBinaryOpIC::TypeInfo operands_type,
|
| + TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED)
|
| + : op_(OpBits::decode(key)),
|
| + mode_(ModeBits::decode(key)),
|
| + operands_type_(operands_type),
|
| + result_type_(result_type),
|
| + name_(NULL) { }
|
| +
|
| + private:
|
| + enum SmiCodeGenerateHeapNumberResults {
|
| + ALLOW_HEAPNUMBER_RESULTS,
|
| + NO_HEAPNUMBER_RESULTS
|
| + };
|
| +
|
| + Token::Value op_;
|
| + OverwriteMode mode_;
|
| +
|
| + // Operand type information determined at runtime.
|
| + TRBinaryOpIC::TypeInfo operands_type_;
|
| + TRBinaryOpIC::TypeInfo result_type_;
|
| +
|
| + char* name_;
|
| +
|
| + const char* GetName();
|
| +
|
| +#ifdef DEBUG
|
| + void Print() {
|
| + PrintF("TypeRecordingBinaryOpStub %d (op %s), "
|
| + "(mode %d, runtime_type_info %s)\n",
|
| + MinorKey(),
|
| + Token::String(op_),
|
| + static_cast<int>(mode_),
|
| + TRBinaryOpIC::GetName(operands_type_));
|
| + }
|
| +#endif
|
| +
|
| + // Minor key encoding in 15 bits RRRTTTOOOOOOOMM.
|
| + class ModeBits: public BitField<OverwriteMode, 0, 2> {};
|
| + class OpBits: public BitField<Token::Value, 2, 7> {};
|
| + class OperandTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 9, 3> {};
|
| + class ResultTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 12, 3> {};
|
| +
|
| + Major MajorKey() { return TypeRecordingBinaryOp; }
|
| + int MinorKey() {
|
| + return OpBits::encode(op_)
|
| + | ModeBits::encode(mode_)
|
| + | OperandTypeInfoBits::encode(operands_type_)
|
| + | ResultTypeInfoBits::encode(result_type_);
|
| + }
|
| +
|
| + void Generate(MacroAssembler* masm);
|
| + void GenerateGeneric(MacroAssembler* masm);
|
| + void GenerateSmiCode(MacroAssembler* masm,
|
| + Label* slow,
|
| + SmiCodeGenerateHeapNumberResults heapnumber_results);
|
| + void GenerateLoadArguments(MacroAssembler* masm);
|
| + void GenerateReturn(MacroAssembler* masm);
|
| + void GenerateUninitializedStub(MacroAssembler* masm);
|
| + void GenerateSmiStub(MacroAssembler* masm);
|
| + void GenerateInt32Stub(MacroAssembler* masm);
|
| + void GenerateHeapNumberStub(MacroAssembler* masm);
|
| + void GenerateStringStub(MacroAssembler* masm);
|
| + void GenerateGenericStub(MacroAssembler* masm);
|
| +
|
| + void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure);
|
| + void GenerateRegisterArgsPush(MacroAssembler* masm);
|
| + void GenerateTypeTransition(MacroAssembler* masm);
|
| + void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm);
|
| +
|
| + virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; }
|
| +
|
| + virtual InlineCacheState GetICState() {
|
| + return TRBinaryOpIC::ToState(operands_type_);
|
| + }
|
| +
|
| + virtual void FinishCode(Code* code) {
|
| + code->set_type_recording_binary_op_type(operands_type_);
|
| + code->set_type_recording_binary_op_result_type(result_type_);
|
| + }
|
| +
|
| + friend class CodeGenerator;
|
| +};
|
| +
|
| +
|
| class StringHelper : public AllStatic {
|
| public:
|
| // Generate code for copying characters using a simple loop. This should only
|
| @@ -348,42 +446,6 @@
|
| };
|
|
|
|
|
| -class RecordWriteStub : public CodeStub {
|
| - public:
|
| - RecordWriteStub(Register object, Register addr, Register scratch)
|
| - : object_(object), addr_(addr), scratch_(scratch) { }
|
| -
|
| - void Generate(MacroAssembler* masm);
|
| -
|
| - private:
|
| - Register object_;
|
| - Register addr_;
|
| - Register scratch_;
|
| -
|
| -#ifdef DEBUG
|
| - void Print() {
|
| - PrintF("RecordWriteStub (object reg %d), (addr reg %d), (scratch reg %d)\n",
|
| - object_.code(), addr_.code(), scratch_.code());
|
| - }
|
| -#endif
|
| -
|
| - // Minor key encoding in 12 bits. 4 bits for each of the three
|
| - // registers (object, address and scratch) OOOOAAAASSSS.
|
| - class ScratchBits : public BitField<uint32_t, 0, 4> {};
|
| - class AddressBits : public BitField<uint32_t, 4, 4> {};
|
| - class ObjectBits : public BitField<uint32_t, 8, 4> {};
|
| -
|
| - Major MajorKey() { return RecordWrite; }
|
| -
|
| - int MinorKey() {
|
| - // Encode the registers.
|
| - return ObjectBits::encode(object_.code()) |
|
| - AddressBits::encode(addr_.code()) |
|
| - ScratchBits::encode(scratch_.code());
|
| - }
|
| -};
|
| -
|
| -
|
| } } // namespace v8::internal
|
|
|
| #endif // V8_X64_CODE_STUBS_X64_H_
|
|
|