OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 __ mov(ebx, | 988 __ mov(ebx, |
989 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 989 Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
990 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); | 990 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
991 | 991 |
992 // Push the receiver. | 992 // Push the receiver. |
993 __ bind(&push_receiver); | 993 __ bind(&push_receiver); |
994 __ push(ebx); | 994 __ push(ebx); |
995 | 995 |
996 // Copy all arguments from the array to the stack. | 996 // Copy all arguments from the array to the stack. |
997 Label entry, loop; | 997 Label entry, loop; |
998 __ mov(ecx, Operand(ebp, kIndexOffset)); | 998 Register receiver = LoadIC::ReceiverRegister(); |
| 999 Register key = LoadIC::NameRegister(); |
| 1000 __ mov(key, Operand(ebp, kIndexOffset)); |
999 __ jmp(&entry); | 1001 __ jmp(&entry); |
1000 __ bind(&loop); | 1002 __ bind(&loop); |
1001 __ mov(edx, Operand(ebp, kArgumentsOffset)); // load arguments | 1003 __ mov(receiver, Operand(ebp, kArgumentsOffset)); // load arguments |
1002 | 1004 |
1003 // Use inline caching to speed up access to arguments. | 1005 // Use inline caching to speed up access to arguments. |
1004 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Initialize(); | 1006 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Initialize(); |
1005 __ call(ic, RelocInfo::CODE_TARGET); | 1007 __ call(ic, RelocInfo::CODE_TARGET); |
1006 // It is important that we do not have a test instruction after the | 1008 // It is important that we do not have a test instruction after the |
1007 // call. A test instruction after the call is used to indicate that | 1009 // call. A test instruction after the call is used to indicate that |
1008 // we have generated an inline version of the keyed load. In this | 1010 // we have generated an inline version of the keyed load. In this |
1009 // case, we know that we are not generating a test instruction next. | 1011 // case, we know that we are not generating a test instruction next. |
1010 | 1012 |
1011 // Push the nth argument. | 1013 // Push the nth argument. |
1012 __ push(eax); | 1014 __ push(eax); |
1013 | 1015 |
1014 // Update the index on the stack and in register eax. | 1016 // Update the index on the stack and in register key. |
1015 __ mov(ecx, Operand(ebp, kIndexOffset)); | 1017 __ mov(key, Operand(ebp, kIndexOffset)); |
1016 __ add(ecx, Immediate(1 << kSmiTagSize)); | 1018 __ add(key, Immediate(1 << kSmiTagSize)); |
1017 __ mov(Operand(ebp, kIndexOffset), ecx); | 1019 __ mov(Operand(ebp, kIndexOffset), key); |
1018 | 1020 |
1019 __ bind(&entry); | 1021 __ bind(&entry); |
1020 __ cmp(ecx, Operand(ebp, kLimitOffset)); | 1022 __ cmp(key, Operand(ebp, kLimitOffset)); |
1021 __ j(not_equal, &loop); | 1023 __ j(not_equal, &loop); |
1022 | 1024 |
1023 // Call the function. | 1025 // Call the function. |
1024 Label call_proxy; | 1026 Label call_proxy; |
1025 __ mov(eax, ecx); | |
1026 ParameterCount actual(eax); | 1027 ParameterCount actual(eax); |
| 1028 __ Move(eax, key); |
1027 __ SmiUntag(eax); | 1029 __ SmiUntag(eax); |
1028 __ mov(edi, Operand(ebp, kFunctionOffset)); | 1030 __ mov(edi, Operand(ebp, kFunctionOffset)); |
1029 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 1031 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
1030 __ j(not_equal, &call_proxy); | 1032 __ j(not_equal, &call_proxy); |
1031 __ InvokeFunction(edi, actual, CALL_FUNCTION, NullCallWrapper()); | 1033 __ InvokeFunction(edi, actual, CALL_FUNCTION, NullCallWrapper()); |
1032 | 1034 |
1033 frame_scope.GenerateLeaveFrame(); | 1035 frame_scope.GenerateLeaveFrame(); |
1034 __ ret(3 * kPointerSize); // remove this, receiver, and arguments | 1036 __ ret(3 * kPointerSize); // remove this, receiver, and arguments |
1035 | 1037 |
1036 // Call the function proxy. | 1038 // Call the function proxy. |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 | 1445 |
1444 __ bind(&ok); | 1446 __ bind(&ok); |
1445 __ ret(0); | 1447 __ ret(0); |
1446 } | 1448 } |
1447 | 1449 |
1448 #undef __ | 1450 #undef __ |
1449 } | 1451 } |
1450 } // namespace v8::internal | 1452 } // namespace v8::internal |
1451 | 1453 |
1452 #endif // V8_TARGET_ARCH_X87 | 1454 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |