| 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 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 Label done, null, function, non_function_constructor; | 2213 Label done, null, function, non_function_constructor; |
| 2214 | 2214 |
| 2215 VisitForValue(args->at(0), kAccumulator); | 2215 VisitForValue(args->at(0), kAccumulator); |
| 2216 | 2216 |
| 2217 // If the object is a smi, we return null. | 2217 // If the object is a smi, we return null. |
| 2218 __ test(eax, Immediate(kSmiTagMask)); | 2218 __ test(eax, Immediate(kSmiTagMask)); |
| 2219 __ j(zero, &null); | 2219 __ j(zero, &null); |
| 2220 | 2220 |
| 2221 // Check that the object is a JS object but take special care of JS | 2221 // Check that the object is a JS object but take special care of JS |
| 2222 // functions to make sure they have 'Function' as their class. | 2222 // functions to make sure they have 'Function' as their class. |
| 2223 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 2223 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, eax); // Map is now in eax. |
| 2224 __ movzx_b(ebx, FieldOperand(eax, Map::kInstanceTypeOffset)); | |
| 2225 __ cmp(ebx, FIRST_JS_OBJECT_TYPE); | |
| 2226 __ j(below, &null); | 2224 __ j(below, &null); |
| 2227 | 2225 |
| 2228 // As long as JS_FUNCTION_TYPE is the last instance type and it is | 2226 // As long as JS_FUNCTION_TYPE is the last instance type and it is |
| 2229 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for | 2227 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for |
| 2230 // LAST_JS_OBJECT_TYPE. | 2228 // LAST_JS_OBJECT_TYPE. |
| 2231 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 2229 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
| 2232 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 2230 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |
| 2233 __ cmp(ebx, JS_FUNCTION_TYPE); | 2231 __ cmp(ebx, JS_FUNCTION_TYPE); |
| 2234 __ j(equal, &function); | 2232 __ j(equal, &function); |
| 2235 | 2233 |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3236 // And return. | 3234 // And return. |
| 3237 __ ret(0); | 3235 __ ret(0); |
| 3238 } | 3236 } |
| 3239 | 3237 |
| 3240 | 3238 |
| 3241 #undef __ | 3239 #undef __ |
| 3242 | 3240 |
| 3243 } } // namespace v8::internal | 3241 } } // namespace v8::internal |
| 3244 | 3242 |
| 3245 #endif // V8_TARGET_ARCH_IA32 | 3243 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |