OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 __ testl(rbx, Immediate(kSmiTagMask)); | 387 __ testl(rbx, Immediate(kSmiTagMask)); |
388 __ j(zero, &call_to_object); | 388 __ j(zero, &call_to_object); |
389 __ Cmp(rbx, Factory::null_value()); | 389 __ Cmp(rbx, Factory::null_value()); |
390 __ j(equal, &use_global_receiver); | 390 __ j(equal, &use_global_receiver); |
391 __ Cmp(rbx, Factory::undefined_value()); | 391 __ Cmp(rbx, Factory::undefined_value()); |
392 __ j(equal, &use_global_receiver); | 392 __ j(equal, &use_global_receiver); |
393 | 393 |
394 // If given receiver is already a JavaScript object then there's no | 394 // If given receiver is already a JavaScript object then there's no |
395 // reason for converting it. | 395 // reason for converting it. |
396 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 396 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); |
397 __ j(less, &call_to_object); | 397 __ j(below, &call_to_object); |
398 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); | 398 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); |
399 __ j(less_equal, &push_receiver); | 399 __ j(below_equal, &push_receiver); |
400 | 400 |
401 // Convert the receiver to an object. | 401 // Convert the receiver to an object. |
402 __ bind(&call_to_object); | 402 __ bind(&call_to_object); |
403 __ push(rbx); | 403 __ push(rbx); |
404 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 404 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
405 __ movq(rbx, rax); | 405 __ movq(rbx, rax); |
406 __ jmp(&push_receiver); | 406 __ jmp(&push_receiver); |
407 | 407 |
408 // Use the current global receiver object as the receiver. | 408 // Use the current global receiver object as the receiver. |
409 __ bind(&use_global_receiver); | 409 __ bind(&use_global_receiver); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 555 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
556 // on page 74. | 556 // on page 74. |
557 Label use_receiver, exit; | 557 Label use_receiver, exit; |
558 // If the result is a smi, it is *not* an object in the ECMA sense. | 558 // If the result is a smi, it is *not* an object in the ECMA sense. |
559 __ testl(rax, Immediate(kSmiTagMask)); | 559 __ testl(rax, Immediate(kSmiTagMask)); |
560 __ j(zero, &use_receiver); | 560 __ j(zero, &use_receiver); |
561 | 561 |
562 // If the type of the result (stored in its map) is less than | 562 // If the type of the result (stored in its map) is less than |
563 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 563 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. |
564 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); | 564 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); |
565 __ j(greater_equal, &exit); | 565 __ j(above_equal, &exit); |
566 | 566 |
567 // Throw away the result of the constructor invocation and use the | 567 // Throw away the result of the constructor invocation and use the |
568 // on-stack receiver as the result. | 568 // on-stack receiver as the result. |
569 __ bind(&use_receiver); | 569 __ bind(&use_receiver); |
570 __ movq(rax, Operand(rsp, 0)); | 570 __ movq(rax, Operand(rsp, 0)); |
571 | 571 |
572 // Restore the arguments count and leave the construct frame. | 572 // Restore the arguments count and leave the construct frame. |
573 __ bind(&exit); | 573 __ bind(&exit); |
574 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count | 574 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count |
575 __ LeaveConstructFrame(); | 575 __ LeaveConstructFrame(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 698 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
699 Generate_JSEntryTrampolineHelper(masm, false); | 699 Generate_JSEntryTrampolineHelper(masm, false); |
700 } | 700 } |
701 | 701 |
702 | 702 |
703 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 703 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
704 Generate_JSEntryTrampolineHelper(masm, true); | 704 Generate_JSEntryTrampolineHelper(masm, true); |
705 } | 705 } |
706 | 706 |
707 } } // namespace v8::internal | 707 } } // namespace v8::internal |
OLD | NEW |