OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 492 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
493 | 493 |
494 // Check that the receiver isn't a smi. | 494 // Check that the receiver isn't a smi. |
495 __ test(edx, Immediate(kSmiTagMask)); | 495 __ test(edx, Immediate(kSmiTagMask)); |
496 __ j(zero, &miss, not_taken); | 496 __ j(zero, &miss, not_taken); |
497 | 497 |
498 // Do the right check and compute the holder register. | 498 // Do the right check and compute the holder register. |
499 Register reg = | 499 Register reg = |
500 __ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss); | 500 __ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss); |
501 | 501 |
502 // Get the properties array of the holder and get the function from the field. | 502 // Adjust for the number of properties stored in the holder. |
503 int offset = index * kPointerSize + Array::kHeaderSize; | 503 index -= holder->map()->inobject_properties(); |
504 __ mov(edi, FieldOperand(reg, JSObject::kPropertiesOffset)); | 504 if (index < 0) { |
505 __ mov(edi, FieldOperand(edi, offset)); | 505 // Get the property straight out of the holder. |
| 506 int offset = holder->map()->instance_size() + (index * kPointerSize); |
| 507 __ mov(edi, FieldOperand(reg, offset)); |
| 508 } else { |
| 509 // Get the properties array of the holder and get the function from |
| 510 // the field. |
| 511 int offset = index * kPointerSize + Array::kHeaderSize; |
| 512 __ mov(edi, FieldOperand(reg, JSObject::kPropertiesOffset)); |
| 513 __ mov(edi, FieldOperand(edi, offset)); |
| 514 } |
506 | 515 |
507 // Check that the function really is a function. | 516 // Check that the function really is a function. |
508 __ test(edi, Immediate(kSmiTagMask)); | 517 __ test(edi, Immediate(kSmiTagMask)); |
509 __ j(zero, &miss, not_taken); | 518 __ j(zero, &miss, not_taken); |
510 __ mov(ebx, FieldOperand(edi, HeapObject::kMapOffset)); // get the map | 519 __ mov(ebx, FieldOperand(edi, HeapObject::kMapOffset)); // get the map |
511 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 520 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
512 __ cmp(ebx, JS_FUNCTION_TYPE); | 521 __ cmp(ebx, JS_FUNCTION_TYPE); |
513 __ j(not_equal, &miss, not_taken); | 522 __ j(not_equal, &miss, not_taken); |
514 | 523 |
515 // Invoke the function. | 524 // Invoke the function. |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1246 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1238 | 1247 |
1239 // Return the generated code. | 1248 // Return the generated code. |
1240 return GetCode(CALLBACKS); | 1249 return GetCode(CALLBACKS); |
1241 } | 1250 } |
1242 | 1251 |
1243 | 1252 |
1244 #undef __ | 1253 #undef __ |
1245 | 1254 |
1246 } } // namespace v8::internal | 1255 } } // namespace v8::internal |
OLD | NEW |