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_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 __ movp(rbx, | 1059 __ movp(rbx, |
1060 Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 1060 Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
1061 __ movp(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); | 1061 __ movp(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); |
1062 | 1062 |
1063 // Push the receiver. | 1063 // Push the receiver. |
1064 __ bind(&push_receiver); | 1064 __ bind(&push_receiver); |
1065 __ Push(rbx); | 1065 __ Push(rbx); |
1066 | 1066 |
1067 // Copy all arguments from the array to the stack. | 1067 // Copy all arguments from the array to the stack. |
1068 Label entry, loop; | 1068 Label entry, loop; |
1069 __ movp(rax, Operand(rbp, kIndexOffset)); | 1069 Register receiver = LoadIC::ReceiverRegister(); |
| 1070 Register key = LoadIC::NameRegister(); |
| 1071 __ movp(key, Operand(rbp, kIndexOffset)); |
1070 __ jmp(&entry); | 1072 __ jmp(&entry); |
1071 __ bind(&loop); | 1073 __ bind(&loop); |
1072 __ movp(rdx, Operand(rbp, kArgumentsOffset)); // load arguments | 1074 __ movp(receiver, Operand(rbp, kArgumentsOffset)); // load arguments |
1073 | 1075 |
1074 // Use inline caching to speed up access to arguments. | 1076 // Use inline caching to speed up access to arguments. |
1075 Handle<Code> ic = | 1077 Handle<Code> ic = |
1076 masm->isolate()->builtins()->KeyedLoadIC_Initialize(); | 1078 masm->isolate()->builtins()->KeyedLoadIC_Initialize(); |
1077 __ Call(ic, RelocInfo::CODE_TARGET); | 1079 __ Call(ic, RelocInfo::CODE_TARGET); |
1078 // It is important that we do not have a test instruction after the | 1080 // It is important that we do not have a test instruction after the |
1079 // call. A test instruction after the call is used to indicate that | 1081 // call. A test instruction after the call is used to indicate that |
1080 // we have generated an inline version of the keyed load. In this | 1082 // we have generated an inline version of the keyed load. In this |
1081 // case, we know that we are not generating a test instruction next. | 1083 // case, we know that we are not generating a test instruction next. |
1082 | 1084 |
1083 // Push the nth argument. | 1085 // Push the nth argument. |
1084 __ Push(rax); | 1086 __ Push(rax); |
1085 | 1087 |
1086 // Update the index on the stack and in register rax. | 1088 // Update the index on the stack and in register key. |
1087 __ movp(rax, Operand(rbp, kIndexOffset)); | 1089 __ movp(key, Operand(rbp, kIndexOffset)); |
1088 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); | 1090 __ SmiAddConstant(key, key, Smi::FromInt(1)); |
1089 __ movp(Operand(rbp, kIndexOffset), rax); | 1091 __ movp(Operand(rbp, kIndexOffset), key); |
1090 | 1092 |
1091 __ bind(&entry); | 1093 __ bind(&entry); |
1092 __ cmpp(rax, Operand(rbp, kLimitOffset)); | 1094 __ cmpp(key, Operand(rbp, kLimitOffset)); |
1093 __ j(not_equal, &loop); | 1095 __ j(not_equal, &loop); |
1094 | 1096 |
1095 // Call the function. | 1097 // Call the function. |
1096 Label call_proxy; | 1098 Label call_proxy; |
1097 ParameterCount actual(rax); | 1099 ParameterCount actual(rax); |
1098 __ SmiToInteger32(rax, rax); | 1100 __ SmiToInteger32(rax, key); |
1099 __ movp(rdi, Operand(rbp, kFunctionOffset)); | 1101 __ movp(rdi, Operand(rbp, kFunctionOffset)); |
1100 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 1102 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
1101 __ j(not_equal, &call_proxy); | 1103 __ j(not_equal, &call_proxy); |
1102 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); | 1104 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); |
1103 | 1105 |
1104 frame_scope.GenerateLeaveFrame(); | 1106 frame_scope.GenerateLeaveFrame(); |
1105 __ ret(3 * kPointerSize); // remove this, receiver, and arguments | 1107 __ ret(3 * kPointerSize); // remove this, receiver, and arguments |
1106 | 1108 |
1107 // Call the function proxy. | 1109 // Call the function proxy. |
1108 __ bind(&call_proxy); | 1110 __ bind(&call_proxy); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 __ bind(&ok); | 1515 __ bind(&ok); |
1514 __ ret(0); | 1516 __ ret(0); |
1515 } | 1517 } |
1516 | 1518 |
1517 | 1519 |
1518 #undef __ | 1520 #undef __ |
1519 | 1521 |
1520 } } // namespace v8::internal | 1522 } } // namespace v8::internal |
1521 | 1523 |
1522 #endif // V8_TARGET_ARCH_X64 | 1524 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |