| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 5638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5649 | 5649 |
| 5650 void CodeGenerator::VisitCallNew(CallNew* node) { | 5650 void CodeGenerator::VisitCallNew(CallNew* node) { |
| 5651 Comment cmnt(masm_, "[ CallNew"); | 5651 Comment cmnt(masm_, "[ CallNew"); |
| 5652 | 5652 |
| 5653 // According to ECMA-262, section 11.2.2, page 44, the function | 5653 // According to ECMA-262, section 11.2.2, page 44, the function |
| 5654 // expression in new calls must be evaluated before the | 5654 // expression in new calls must be evaluated before the |
| 5655 // arguments. This is different from ordinary calls, where the | 5655 // arguments. This is different from ordinary calls, where the |
| 5656 // actual function to call is resolved after the arguments have been | 5656 // actual function to call is resolved after the arguments have been |
| 5657 // evaluated. | 5657 // evaluated. |
| 5658 | 5658 |
| 5659 // Compute function to call and use the global object as the | 5659 // Push constructor on the stack. If it's not a function it's used as |
| 5660 // receiver. There is no need to use the global proxy here because | 5660 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
| 5661 // it will always be replaced with a newly allocated object. | 5661 // ignored. |
| 5662 Load(node->expression()); | 5662 Load(node->expression()); |
| 5663 LoadGlobal(); | |
| 5664 | 5663 |
| 5665 // Push the arguments ("left-to-right") on the stack. | 5664 // Push the arguments ("left-to-right") on the stack. |
| 5666 ZoneList<Expression*>* args = node->arguments(); | 5665 ZoneList<Expression*>* args = node->arguments(); |
| 5667 int arg_count = args->length(); | 5666 int arg_count = args->length(); |
| 5668 for (int i = 0; i < arg_count; i++) { | 5667 for (int i = 0; i < arg_count; i++) { |
| 5669 Load(args->at(i)); | 5668 Load(args->at(i)); |
| 5670 } | 5669 } |
| 5671 | 5670 |
| 5672 // Call the construct call builtin that handles allocation and | 5671 // Call the construct call builtin that handles allocation and |
| 5673 // constructor invocation. | 5672 // constructor invocation. |
| 5674 CodeForSourcePosition(node->position()); | 5673 CodeForSourcePosition(node->position()); |
| 5675 Result result = frame_->CallConstructor(arg_count); | 5674 Result result = frame_->CallConstructor(arg_count); |
| 5676 // Replace the function on the stack with the result. | 5675 frame_->Push(&result); |
| 5677 frame_->SetElementAt(0, &result); | |
| 5678 } | 5676 } |
| 5679 | 5677 |
| 5680 | 5678 |
| 5681 void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) { | 5679 void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) { |
| 5682 ASSERT(args->length() == 1); | 5680 ASSERT(args->length() == 1); |
| 5683 Load(args->at(0)); | 5681 Load(args->at(0)); |
| 5684 Result value = frame_->Pop(); | 5682 Result value = frame_->Pop(); |
| 5685 value.ToRegister(); | 5683 value.ToRegister(); |
| 5686 ASSERT(value.is_valid()); | 5684 ASSERT(value.is_valid()); |
| 5687 Condition is_smi = masm_->CheckSmi(value.reg()); | 5685 Condition is_smi = masm_->CheckSmi(value.reg()); |
| (...skipping 7167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12855 #undef __ | 12853 #undef __ |
| 12856 | 12854 |
| 12857 void RecordWriteStub::Generate(MacroAssembler* masm) { | 12855 void RecordWriteStub::Generate(MacroAssembler* masm) { |
| 12858 masm->RecordWriteHelper(object_, addr_, scratch_); | 12856 masm->RecordWriteHelper(object_, addr_, scratch_); |
| 12859 masm->ret(0); | 12857 masm->ret(0); |
| 12860 } | 12858 } |
| 12861 | 12859 |
| 12862 } } // namespace v8::internal | 12860 } } // namespace v8::internal |
| 12863 | 12861 |
| 12864 #endif // V8_TARGET_ARCH_X64 | 12862 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |