OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4972 Register object = eax; // Object (lhs). | 4972 Register object = eax; // Object (lhs). |
4973 Register map = ebx; // Map of the object. | 4973 Register map = ebx; // Map of the object. |
4974 Register function = edx; // Function (rhs). | 4974 Register function = edx; // Function (rhs). |
4975 Register prototype = edi; // Prototype of the function. | 4975 Register prototype = edi; // Prototype of the function. |
4976 Register scratch = ecx; | 4976 Register scratch = ecx; |
4977 | 4977 |
4978 // Constants describing the call site code to patch. | 4978 // Constants describing the call site code to patch. |
4979 static const int kDeltaToCmpImmediate = 2; | 4979 static const int kDeltaToCmpImmediate = 2; |
4980 static const int kDeltaToMov = 8; | 4980 static const int kDeltaToMov = 8; |
4981 static const int kDeltaToMovImmediate = 9; | 4981 static const int kDeltaToMovImmediate = 9; |
4982 static const int8_t kCmpEdiImmediateByte1 = BitCast<int8_t, uint8_t>(0x81); | 4982 static const int8_t kCmpEdiOperandByte1 = BitCast<int8_t, uint8_t>(0x3b); |
4983 static const int8_t kCmpEdiImmediateByte2 = BitCast<int8_t, uint8_t>(0xff); | 4983 static const int8_t kCmpEdiOperandByte2 = BitCast<int8_t, uint8_t>(0x3d); |
4984 static const int8_t kMovEaxImmediateByte = BitCast<int8_t, uint8_t>(0xb8); | 4984 static const int8_t kMovEaxImmediateByte = BitCast<int8_t, uint8_t>(0xb8); |
4985 | 4985 |
4986 ExternalReference roots_array_start = | 4986 ExternalReference roots_array_start = |
4987 ExternalReference::roots_array_start(masm->isolate()); | 4987 ExternalReference::roots_array_start(masm->isolate()); |
4988 | 4988 |
4989 ASSERT_EQ(object.code(), InstanceofStub::left().code()); | 4989 ASSERT_EQ(object.code(), InstanceofStub::left().code()); |
4990 ASSERT_EQ(function.code(), InstanceofStub::right().code()); | 4990 ASSERT_EQ(function.code(), InstanceofStub::right().code()); |
4991 | 4991 |
4992 // Get the object and function - they are always both needed. | 4992 // Get the object and function - they are always both needed. |
4993 Label slow, not_js_object; | 4993 Label slow, not_js_object; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5038 __ mov(Operand::StaticArray(scratch, times_pointer_size, roots_array_start), | 5038 __ mov(Operand::StaticArray(scratch, times_pointer_size, roots_array_start), |
5039 function); | 5039 function); |
5040 } else { | 5040 } else { |
5041 // The constants for the code patching are based on no push instructions | 5041 // The constants for the code patching are based on no push instructions |
5042 // at the call site. | 5042 // at the call site. |
5043 ASSERT(HasArgsInRegisters()); | 5043 ASSERT(HasArgsInRegisters()); |
5044 // Get return address and delta to inlined map check. | 5044 // Get return address and delta to inlined map check. |
5045 __ mov(scratch, Operand(esp, 0 * kPointerSize)); | 5045 __ mov(scratch, Operand(esp, 0 * kPointerSize)); |
5046 __ sub(scratch, Operand(esp, 1 * kPointerSize)); | 5046 __ sub(scratch, Operand(esp, 1 * kPointerSize)); |
5047 if (FLAG_debug_code) { | 5047 if (FLAG_debug_code) { |
5048 __ cmpb(Operand(scratch, 0), kCmpEdiImmediateByte1); | 5048 __ cmpb(Operand(scratch, 0), kCmpEdiOperandByte1); |
5049 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 1)"); | 5049 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 1)"); |
5050 __ cmpb(Operand(scratch, 1), kCmpEdiImmediateByte2); | 5050 __ cmpb(Operand(scratch, 1), kCmpEdiOperandByte2); |
5051 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 2)"); | 5051 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 2)"); |
5052 } | 5052 } |
5053 __ mov(Operand(scratch, kDeltaToCmpImmediate), map); | 5053 __ mov(scratch, Operand(scratch, kDeltaToCmpImmediate)); |
| 5054 __ mov(Operand(scratch, 0), map); |
5054 } | 5055 } |
5055 | 5056 |
5056 // Loop through the prototype chain of the object looking for the function | 5057 // Loop through the prototype chain of the object looking for the function |
5057 // prototype. | 5058 // prototype. |
5058 __ mov(scratch, FieldOperand(map, Map::kPrototypeOffset)); | 5059 __ mov(scratch, FieldOperand(map, Map::kPrototypeOffset)); |
5059 Label loop, is_instance, is_not_instance; | 5060 Label loop, is_instance, is_not_instance; |
5060 __ bind(&loop); | 5061 __ bind(&loop); |
5061 __ cmp(scratch, prototype); | 5062 __ cmp(scratch, prototype); |
5062 __ j(equal, &is_instance, Label::kNear); | 5063 __ j(equal, &is_instance, Label::kNear); |
5063 Factory* factory = masm->isolate()->factory(); | 5064 Factory* factory = masm->isolate()->factory(); |
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7171 false); | 7172 false); |
7172 __ pop(edx); | 7173 __ pop(edx); |
7173 __ ret(0); | 7174 __ ret(0); |
7174 } | 7175 } |
7175 | 7176 |
7176 #undef __ | 7177 #undef __ |
7177 | 7178 |
7178 } } // namespace v8::internal | 7179 } } // namespace v8::internal |
7179 | 7180 |
7180 #endif // V8_TARGET_ARCH_IA32 | 7181 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |