| 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/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); | 1046 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
| 1047 __ j(above_equal, &shift_arguments); | 1047 __ j(above_equal, &shift_arguments); |
| 1048 | 1048 |
| 1049 __ bind(&convert_to_object); | 1049 __ bind(&convert_to_object); |
| 1050 { | 1050 { |
| 1051 // Enter an internal frame in order to preserve argument count. | 1051 // Enter an internal frame in order to preserve argument count. |
| 1052 FrameScope scope(masm, StackFrame::INTERNAL); | 1052 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1053 __ Integer32ToSmi(rax, rax); | 1053 __ Integer32ToSmi(rax, rax); |
| 1054 __ Push(rax); | 1054 __ Push(rax); |
| 1055 | 1055 |
| 1056 __ Push(rbx); | 1056 __ movp(rax, rbx); |
| 1057 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1057 ToObjectStub stub(masm->isolate()); |
| 1058 __ CallStub(&stub); |
| 1058 __ movp(rbx, rax); | 1059 __ movp(rbx, rax); |
| 1059 __ Set(rdx, 0); // indicate regular JS_FUNCTION | 1060 __ Set(rdx, 0); // indicate regular JS_FUNCTION |
| 1060 | 1061 |
| 1061 __ Pop(rax); | 1062 __ Pop(rax); |
| 1062 __ SmiToInteger32(rax, rax); | 1063 __ SmiToInteger32(rax, rax); |
| 1063 } | 1064 } |
| 1064 | 1065 |
| 1065 // Restore the function to rdi. | 1066 // Restore the function to rdi. |
| 1066 __ movp(rdi, args.GetReceiverOperand()); | 1067 __ movp(rdi, args.GetReceiverOperand()); |
| 1067 __ jmp(&patch_receiver, Label::kNear); | 1068 __ jmp(&patch_receiver, Label::kNear); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 __ j(equal, &use_global_proxy); | 1268 __ j(equal, &use_global_proxy); |
| 1268 | 1269 |
| 1269 // If given receiver is already a JavaScript object then there's no | 1270 // If given receiver is already a JavaScript object then there's no |
| 1270 // reason for converting it. | 1271 // reason for converting it. |
| 1271 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 1272 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1272 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); | 1273 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
| 1273 __ j(above_equal, &push_receiver); | 1274 __ j(above_equal, &push_receiver); |
| 1274 | 1275 |
| 1275 // Convert the receiver to an object. | 1276 // Convert the receiver to an object. |
| 1276 __ bind(&call_to_object); | 1277 __ bind(&call_to_object); |
| 1277 __ Push(rbx); | 1278 __ movp(rax, rbx); |
| 1278 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1279 ToObjectStub stub(masm->isolate()); |
| 1280 __ CallStub(&stub); |
| 1279 __ movp(rbx, rax); | 1281 __ movp(rbx, rax); |
| 1280 __ jmp(&push_receiver, Label::kNear); | 1282 __ jmp(&push_receiver, Label::kNear); |
| 1281 | 1283 |
| 1282 __ bind(&use_global_proxy); | 1284 __ bind(&use_global_proxy); |
| 1283 __ movp(rbx, | 1285 __ movp(rbx, |
| 1284 Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 1286 Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 1285 __ movp(rbx, FieldOperand(rbx, GlobalObject::kGlobalProxyOffset)); | 1287 __ movp(rbx, FieldOperand(rbx, GlobalObject::kGlobalProxyOffset)); |
| 1286 | 1288 |
| 1287 // Push the receiver. | 1289 // Push the receiver. |
| 1288 __ bind(&push_receiver); | 1290 __ bind(&push_receiver); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 __ ret(0); | 1834 __ ret(0); |
| 1833 } | 1835 } |
| 1834 | 1836 |
| 1835 | 1837 |
| 1836 #undef __ | 1838 #undef __ |
| 1837 | 1839 |
| 1838 } // namespace internal | 1840 } // namespace internal |
| 1839 } // namespace v8 | 1841 } // namespace v8 |
| 1840 | 1842 |
| 1841 #endif // V8_TARGET_ARCH_X64 | 1843 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |