| 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 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5074 Register object = eax; // Object (lhs). | 5074 Register object = eax; // Object (lhs). |
| 5075 Register map = ebx; // Map of the object. | 5075 Register map = ebx; // Map of the object. |
| 5076 Register function = edx; // Function (rhs). | 5076 Register function = edx; // Function (rhs). |
| 5077 Register prototype = edi; // Prototype of the function. | 5077 Register prototype = edi; // Prototype of the function. |
| 5078 Register scratch = ecx; | 5078 Register scratch = ecx; |
| 5079 | 5079 |
| 5080 // Constants describing the call site code to patch. | 5080 // Constants describing the call site code to patch. |
| 5081 static const int kDeltaToCmpImmediate = 2; | 5081 static const int kDeltaToCmpImmediate = 2; |
| 5082 static const int kDeltaToMov = 8; | 5082 static const int kDeltaToMov = 8; |
| 5083 static const int kDeltaToMovImmediate = 9; | 5083 static const int kDeltaToMovImmediate = 9; |
| 5084 static const int8_t kCmpEdiImmediateByte1 = BitCast<int8_t, uint8_t>(0x81); | 5084 static const int8_t kCmpEdiOperandByte1 = BitCast<int8_t, uint8_t>(0x3b); |
| 5085 static const int8_t kCmpEdiImmediateByte2 = BitCast<int8_t, uint8_t>(0xff); | 5085 static const int8_t kCmpEdiOperandByte2 = BitCast<int8_t, uint8_t>(0x3d); |
| 5086 static const int8_t kMovEaxImmediateByte = BitCast<int8_t, uint8_t>(0xb8); | 5086 static const int8_t kMovEaxImmediateByte = BitCast<int8_t, uint8_t>(0xb8); |
| 5087 | 5087 |
| 5088 ExternalReference roots_array_start = | 5088 ExternalReference roots_array_start = |
| 5089 ExternalReference::roots_array_start(masm->isolate()); | 5089 ExternalReference::roots_array_start(masm->isolate()); |
| 5090 | 5090 |
| 5091 ASSERT_EQ(object.code(), InstanceofStub::left().code()); | 5091 ASSERT_EQ(object.code(), InstanceofStub::left().code()); |
| 5092 ASSERT_EQ(function.code(), InstanceofStub::right().code()); | 5092 ASSERT_EQ(function.code(), InstanceofStub::right().code()); |
| 5093 | 5093 |
| 5094 // Get the object and function - they are always both needed. | 5094 // Get the object and function - they are always both needed. |
| 5095 Label slow, not_js_object; | 5095 Label slow, not_js_object; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5140 __ mov(Operand::StaticArray(scratch, times_pointer_size, roots_array_start), | 5140 __ mov(Operand::StaticArray(scratch, times_pointer_size, roots_array_start), |
| 5141 function); | 5141 function); |
| 5142 } else { | 5142 } else { |
| 5143 // The constants for the code patching are based on no push instructions | 5143 // The constants for the code patching are based on no push instructions |
| 5144 // at the call site. | 5144 // at the call site. |
| 5145 ASSERT(HasArgsInRegisters()); | 5145 ASSERT(HasArgsInRegisters()); |
| 5146 // Get return address and delta to inlined map check. | 5146 // Get return address and delta to inlined map check. |
| 5147 __ mov(scratch, Operand(esp, 0 * kPointerSize)); | 5147 __ mov(scratch, Operand(esp, 0 * kPointerSize)); |
| 5148 __ sub(scratch, Operand(esp, 1 * kPointerSize)); | 5148 __ sub(scratch, Operand(esp, 1 * kPointerSize)); |
| 5149 if (FLAG_debug_code) { | 5149 if (FLAG_debug_code) { |
| 5150 __ cmpb(Operand(scratch, 0), kCmpEdiImmediateByte1); | 5150 __ cmpb(Operand(scratch, 0), kCmpEdiOperandByte1); |
| 5151 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 1)"); | 5151 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 1)"); |
| 5152 __ cmpb(Operand(scratch, 1), kCmpEdiImmediateByte2); | 5152 __ cmpb(Operand(scratch, 1), kCmpEdiOperandByte2); |
| 5153 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 2)"); | 5153 __ Assert(equal, "InstanceofStub unexpected call site cache (cmp 2)"); |
| 5154 } | 5154 } |
| 5155 __ mov(Operand(scratch, kDeltaToCmpImmediate), map); | 5155 __ mov(scratch, Operand(scratch, kDeltaToCmpImmediate)); |
| 5156 __ mov(Operand(scratch, 0), map); |
| 5156 } | 5157 } |
| 5157 | 5158 |
| 5158 // Loop through the prototype chain of the object looking for the function | 5159 // Loop through the prototype chain of the object looking for the function |
| 5159 // prototype. | 5160 // prototype. |
| 5160 __ mov(scratch, FieldOperand(map, Map::kPrototypeOffset)); | 5161 __ mov(scratch, FieldOperand(map, Map::kPrototypeOffset)); |
| 5161 Label loop, is_instance, is_not_instance; | 5162 Label loop, is_instance, is_not_instance; |
| 5162 __ bind(&loop); | 5163 __ bind(&loop); |
| 5163 __ cmp(scratch, prototype); | 5164 __ cmp(scratch, prototype); |
| 5164 __ j(equal, &is_instance, Label::kNear); | 5165 __ j(equal, &is_instance, Label::kNear); |
| 5165 Factory* factory = masm->isolate()->factory(); | 5166 Factory* factory = masm->isolate()->factory(); |
| (...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7346 false); | 7347 false); |
| 7347 __ pop(edx); | 7348 __ pop(edx); |
| 7348 __ ret(0); | 7349 __ ret(0); |
| 7349 } | 7350 } |
| 7350 | 7351 |
| 7351 #undef __ | 7352 #undef __ |
| 7352 | 7353 |
| 7353 } } // namespace v8::internal | 7354 } } // namespace v8::internal |
| 7354 | 7355 |
| 7355 #endif // V8_TARGET_ARCH_IA32 | 7356 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |