diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 577ac6332c..9e5cc378b9 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -2905,7 +2905,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { const Register prototype = r4; // Prototype of the function. const Register scratch = r2; Label slow, loop, is_instance, is_not_instance, not_js_object; - if (!args_in_registers()) { + if (!HasArgsInRegisters()) { __ ldr(object, MemOperand(sp, 1 * kPointerSize)); __ ldr(function, MemOperand(sp, 0)); } @@ -2923,7 +2923,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { __ cmp(map, ip); __ b(ne, &miss); __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); - __ Ret(args_in_registers() ? 0 : 2); + __ Ret(HasArgsInRegisters() ? 0 : 2); __ bind(&miss); __ TryGetFunctionPrototype(function, prototype, scratch, &slow); @@ -2953,12 +2953,12 @@ void InstanceofStub::Generate(MacroAssembler* masm) { __ bind(&is_instance); __ mov(r0, Operand(Smi::FromInt(0))); __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); - __ Ret(args_in_registers() ? 0 : 2); + __ Ret(HasArgsInRegisters() ? 0 : 2); __ bind(&is_not_instance); __ mov(r0, Operand(Smi::FromInt(1))); __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); - __ Ret(args_in_registers() ? 0 : 2); + __ Ret(HasArgsInRegisters() ? 0 : 2); Label object_not_null, object_not_null_or_smi; __ bind(¬_js_object); @@ -2972,22 +2972,22 @@ void InstanceofStub::Generate(MacroAssembler* masm) { __ cmp(scratch, Operand(Factory::null_value())); __ b(ne, &object_not_null); __ mov(r0, Operand(Smi::FromInt(1))); - __ Ret(args_in_registers() ? 0 : 2); + __ Ret(HasArgsInRegisters() ? 0 : 2); __ bind(&object_not_null); // Smi values are not instances of anything. __ BranchOnNotSmi(object, &object_not_null_or_smi); __ mov(r0, Operand(Smi::FromInt(1))); - __ Ret(args_in_registers() ? 0 : 2); + __ Ret(HasArgsInRegisters() ? 0 : 2); __ bind(&object_not_null_or_smi); // String values are not instances of anything. __ IsObjectJSStringType(object, scratch, &slow); __ mov(r0, Operand(Smi::FromInt(1))); - __ Ret(args_in_registers() ? 0 : 2); + __ Ret(HasArgsInRegisters() ? 0 : 2); // Slow-case. Tail call builtin. - if (args_in_registers()) { + if (HasArgsInRegisters()) { __ Push(r0, r1); } __ bind(&slow); diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 87efc92c8d..4ab918d9b6 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1306,6 +1306,14 @@ LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { } +LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( + HInstanceOfKnownGlobal* instr) { + LInstruction* result = + new LInstanceOfKnownGlobal(UseFixed(instr->value(), r0)); + return MarkAsCall(DefineFixed(result, r0), instr); +} + + LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { LOperand* function = UseFixed(instr->function(), r1); LOperand* receiver = UseFixed(instr->receiver(), r0); diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index 2f8cc1c7f3..cc461d0ff6 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -62,6 +62,7 @@ class Translation; // LDivI // LInstanceOf // LInstanceOfAndBranch +// LInstanceOfKnownGlobal // LLoadKeyedFastElement // LLoadKeyedGeneric // LModI @@ -204,6 +205,7 @@ class Translation; V(Goto) \ V(InstanceOf) \ V(InstanceOfAndBranch) \ + V(InstanceOfKnownGlobal) \ V(Integer32ToDouble) \ V(IsNull) \ V(IsNullAndBranch) \ @@ -993,6 +995,19 @@ class LInstanceOfAndBranch: public LInstanceOf { }; +class LInstanceOfKnownGlobal: public LUnaryOperation { + public: + explicit LInstanceOfKnownGlobal(LOperand* left) + : LUnaryOperation(left) { } + + DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, + "instance-of-known-global") + DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) + + Handle function() const { return hydrogen()->function(); } +}; + + class LBoundsCheck: public LBinaryOperation { public: LBoundsCheck(LOperand* index, LOperand* length) diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index bb2461ced2..711d0ca3c8 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -1431,6 +1431,10 @@ void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { } +void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { + Abort("DoInstanceOfKnownGlobal unimplemented."); +} + static Condition ComputeCompareCondition(Token::Value op) { switch (op) { diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 1b0d8b0b6f..1552b7a0e8 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -197,4 +197,34 @@ void ICCompareStub::Generate(MacroAssembler* masm) { } +const char* InstanceofStub::GetName() { + if (name_ != NULL) return name_; + const int kMaxNameLength = 100; + name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); + if (name_ == NULL) return "OOM"; + + const char* args = ""; + if (HasArgsInRegisters()) { + args = "_REGS"; + } + + const char* inline_check = ""; + if (HasCallSiteInlineCheck()) { + inline_check = "_INLINE"; + } + + const char* return_true_false_object = ""; + if (ReturnTrueFalseObject()) { + return_true_false_object = "_TRUEFALSE"; + } + + OS::SNPrintF(Vector(name_, kMaxNameLength), + "InstanceofStub%s%s%s", + args, + inline_check, + return_true_false_object); + return name_; +} + + } } // namespace v8::internal diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index e51a6736a4..f14013d925 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -5182,36 +5182,6 @@ Register InstanceofStub::left() { return eax; } Register InstanceofStub::right() { return edx; } -const char* InstanceofStub::GetName() { - if (name_ != NULL) return name_; - const int kMaxNameLength = 100; - name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); - if (name_ == NULL) return "OOM"; - - const char* args = ""; - if (HasArgsInRegisters()) { - args = "_REGS"; - } - - const char* inline_check = ""; - if (HasCallSiteInlineCheck()) { - inline_check = "_INLINE"; - } - - const char* return_true_false_object = ""; - if (ReturnTrueFalseObject()) { - return_true_false_object = "_TRUEFALSE"; - } - - OS::SNPrintF(Vector(name_, kMaxNameLength), - "InstanceofStub%s%s%s", - args, - inline_check, - return_true_false_object); - return name_; -} - - int CompareStub::MinorKey() { // Encode the three parameters in a unique 16 bit value. To avoid duplicate // stubs the never NaN NaN condition is only taken into account if the