OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5157 | 5157 |
5158 __ bind(&object_not_null_or_smi); | 5158 __ bind(&object_not_null_or_smi); |
5159 // String values is not instance of anything. | 5159 // String values is not instance of anything. |
5160 Condition is_string = masm->IsObjectStringType(object, scratch, scratch); | 5160 Condition is_string = masm->IsObjectStringType(object, scratch, scratch); |
5161 __ j(NegateCondition(is_string), &slow); | 5161 __ j(NegateCondition(is_string), &slow); |
5162 __ Set(eax, Immediate(Smi::FromInt(1))); | 5162 __ Set(eax, Immediate(Smi::FromInt(1))); |
5163 __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); | 5163 __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); |
5164 | 5164 |
5165 // Slow-case: Go through the JavaScript implementation. | 5165 // Slow-case: Go through the JavaScript implementation. |
5166 __ bind(&slow); | 5166 __ bind(&slow); |
5167 if (HasArgsInRegisters()) { | 5167 if (!ReturnTrueFalseObject()) { |
5168 // Push arguments below return address. | 5168 // Tail call the builtin which returns 0 or 1. |
5169 __ pop(scratch); | 5169 if (HasArgsInRegisters()) { |
| 5170 // Push arguments below return address. |
| 5171 __ pop(scratch); |
| 5172 __ push(object); |
| 5173 __ push(function); |
| 5174 __ push(scratch); |
| 5175 } |
| 5176 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5177 } else { |
| 5178 // Call the builtin and convert 0/1 to true/false. |
5170 __ push(object); | 5179 __ push(object); |
5171 __ push(function); | 5180 __ push(function); |
5172 __ push(scratch); | 5181 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); |
| 5182 NearLabel true_value, done; |
| 5183 __ test(eax, Operand(eax)); |
| 5184 __ j(zero, &true_value); |
| 5185 __ mov(eax, Factory::false_value()); |
| 5186 __ jmp(&done); |
| 5187 __ bind(&true_value); |
| 5188 __ mov(eax, Factory::true_value()); |
| 5189 __ bind(&done); |
| 5190 __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); |
5173 } | 5191 } |
5174 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | |
5175 } | 5192 } |
5176 | 5193 |
5177 | 5194 |
5178 Register InstanceofStub::left() { return eax; } | 5195 Register InstanceofStub::left() { return eax; } |
5179 | 5196 |
5180 | 5197 |
5181 Register InstanceofStub::right() { return edx; } | 5198 Register InstanceofStub::right() { return edx; } |
5182 | 5199 |
5183 | 5200 |
5184 int CompareStub::MinorKey() { | 5201 int CompareStub::MinorKey() { |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6489 // Do a tail call to the rewritten stub. | 6506 // Do a tail call to the rewritten stub. |
6490 __ jmp(Operand(edi)); | 6507 __ jmp(Operand(edi)); |
6491 } | 6508 } |
6492 | 6509 |
6493 | 6510 |
6494 #undef __ | 6511 #undef __ |
6495 | 6512 |
6496 } } // namespace v8::internal | 6513 } } // namespace v8::internal |
6497 | 6514 |
6498 #endif // V8_TARGET_ARCH_IA32 | 6515 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |