OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 358 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
359 | 359 |
360 // If the result is an object (in the ECMA sense), we should get rid | 360 // If the result is an object (in the ECMA sense), we should get rid |
361 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 361 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
362 // on page 74. | 362 // on page 74. |
363 Label use_receiver, exit; | 363 Label use_receiver, exit; |
364 // If the result is a smi, it is *not* an object in the ECMA sense. | 364 // If the result is a smi, it is *not* an object in the ECMA sense. |
365 __ JumpIfSmi(rax, &use_receiver); | 365 __ JumpIfSmi(rax, &use_receiver); |
366 | 366 |
367 // If the type of the result (stored in its map) is less than | 367 // If the type of the result (stored in its map) is less than |
368 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 368 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
369 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); | 369 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); |
370 __ j(above_equal, &exit); | 370 __ j(above_equal, &exit); |
371 | 371 |
372 // Throw away the result of the constructor invocation and use the | 372 // Throw away the result of the constructor invocation and use the |
373 // on-stack receiver as the result. | 373 // on-stack receiver as the result. |
374 __ bind(&use_receiver); | 374 __ bind(&use_receiver); |
375 __ movq(rax, Operand(rsp, 0)); | 375 __ movq(rax, Operand(rsp, 0)); |
376 | 376 |
377 // Restore the arguments count and leave the construct frame. | 377 // Restore the arguments count and leave the construct frame. |
378 __ bind(&exit); | 378 __ bind(&exit); |
379 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count | 379 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 694 |
695 // Compute the receiver in non-strict mode. | 695 // Compute the receiver in non-strict mode. |
696 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); | 696 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); |
697 __ JumpIfSmi(rbx, &convert_to_object, Label::kNear); | 697 __ JumpIfSmi(rbx, &convert_to_object, Label::kNear); |
698 | 698 |
699 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 699 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
700 __ j(equal, &use_global_receiver); | 700 __ j(equal, &use_global_receiver); |
701 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 701 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
702 __ j(equal, &use_global_receiver); | 702 __ j(equal, &use_global_receiver); |
703 | 703 |
704 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 704 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
705 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 705 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
706 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | |
707 __ j(above_equal, &shift_arguments); | 706 __ j(above_equal, &shift_arguments); |
708 | 707 |
709 __ bind(&convert_to_object); | 708 __ bind(&convert_to_object); |
710 { | 709 { |
711 // Enter an internal frame in order to preserve argument count. | 710 // Enter an internal frame in order to preserve argument count. |
712 FrameScope scope(masm, StackFrame::INTERNAL); | 711 FrameScope scope(masm, StackFrame::INTERNAL); |
713 __ Integer32ToSmi(rax, rax); | 712 __ Integer32ToSmi(rax, rax); |
714 __ push(rax); | 713 __ push(rax); |
715 | 714 |
716 __ push(rbx); | 715 __ push(rbx); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 869 |
871 // Compute the receiver in non-strict mode. | 870 // Compute the receiver in non-strict mode. |
872 __ JumpIfSmi(rbx, &call_to_object, Label::kNear); | 871 __ JumpIfSmi(rbx, &call_to_object, Label::kNear); |
873 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 872 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
874 __ j(equal, &use_global_receiver); | 873 __ j(equal, &use_global_receiver); |
875 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 874 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
876 __ j(equal, &use_global_receiver); | 875 __ j(equal, &use_global_receiver); |
877 | 876 |
878 // If given receiver is already a JavaScript object then there's no | 877 // If given receiver is already a JavaScript object then there's no |
879 // reason for converting it. | 878 // reason for converting it. |
880 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 879 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
881 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 880 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
882 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | |
883 __ j(above_equal, &push_receiver); | 881 __ j(above_equal, &push_receiver); |
884 | 882 |
885 // Convert the receiver to an object. | 883 // Convert the receiver to an object. |
886 __ bind(&call_to_object); | 884 __ bind(&call_to_object); |
887 __ push(rbx); | 885 __ push(rbx); |
888 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 886 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
889 __ movq(rbx, rax); | 887 __ movq(rbx, rax); |
890 __ jmp(&push_receiver, Label::kNear); | 888 __ jmp(&push_receiver, Label::kNear); |
891 | 889 |
892 // Use the current global receiver object as the receiver. | 890 // Use the current global receiver object as the receiver. |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1534 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1537 generator.Generate(); | 1535 generator.Generate(); |
1538 } | 1536 } |
1539 | 1537 |
1540 | 1538 |
1541 #undef __ | 1539 #undef __ |
1542 | 1540 |
1543 } } // namespace v8::internal | 1541 } } // namespace v8::internal |
1544 | 1542 |
1545 #endif // V8_TARGET_ARCH_X64 | 1543 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |