OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3363 // Deoptimize if the receiver is not a JS object. | 3363 // Deoptimize if the receiver is not a JS object. |
3364 __ SmiTst(receiver, scratch); | 3364 __ SmiTst(receiver, scratch); |
3365 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); | 3365 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); |
3366 | 3366 |
3367 __ GetObjectType(receiver, scratch, scratch); | 3367 __ GetObjectType(receiver, scratch, scratch); |
3368 DeoptimizeIf(lt, instr->environment(), | 3368 DeoptimizeIf(lt, instr->environment(), |
3369 scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); | 3369 scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); |
3370 __ Branch(&result_in_receiver); | 3370 __ Branch(&result_in_receiver); |
3371 | 3371 |
3372 __ bind(&global_object); | 3372 __ bind(&global_object); |
| 3373 CallStubCompiler::FetchGlobalProxy(masm(), receiver, function); |
3373 | 3374 |
3374 __ lw(result, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3375 __ lw(result, ContextOperand(result, Context::GLOBAL_OBJECT_INDEX)); | |
3376 __ lw(result, | |
3377 FieldMemOperand(result, JSGlobalObject::kGlobalReceiverOffset)); | |
3378 if (result.is(receiver)) { | 3375 if (result.is(receiver)) { |
3379 __ bind(&result_in_receiver); | 3376 __ bind(&result_in_receiver); |
3380 } else { | 3377 } else { |
3381 Label result_ok; | 3378 Label result_ok; |
3382 __ Branch(&result_ok); | 3379 __ Branch(&result_ok); |
3383 __ bind(&result_in_receiver); | 3380 __ bind(&result_in_receiver); |
3384 __ mov(result, receiver); | 3381 __ mov(result, receiver); |
3385 __ bind(&result_ok); | 3382 __ bind(&result_ok); |
3386 } | 3383 } |
3387 } | 3384 } |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3910 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3907 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3911 } | 3908 } |
3912 | 3909 |
3913 | 3910 |
3914 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3911 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
3915 ASSERT(ToRegister(instr->context()).is(cp)); | 3912 ASSERT(ToRegister(instr->context()).is(cp)); |
3916 ASSERT(ToRegister(instr->function()).is(a1)); | 3913 ASSERT(ToRegister(instr->function()).is(a1)); |
3917 ASSERT(ToRegister(instr->result()).is(v0)); | 3914 ASSERT(ToRegister(instr->result()).is(v0)); |
3918 | 3915 |
3919 int arity = instr->arity(); | 3916 int arity = instr->arity(); |
3920 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 3917 CallFunctionFlags flags = |
| 3918 instr->hydrogen()->IsContextualCall() ? |
| 3919 RECEIVER_IS_IMPLICIT : NO_CALL_FUNCTION_FLAGS; |
| 3920 CallFunctionStub stub(arity, flags); |
3921 if (instr->hydrogen()->IsTailCall()) { | 3921 if (instr->hydrogen()->IsTailCall()) { |
3922 if (NeedsEagerFrame()) __ mov(sp, fp); | 3922 if (NeedsEagerFrame()) __ mov(sp, fp); |
3923 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 3923 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
3924 } else { | 3924 } else { |
3925 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3925 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
3926 } | 3926 } |
3927 } | 3927 } |
3928 | 3928 |
3929 | 3929 |
3930 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 3930 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5808 __ Subu(scratch, result, scratch); | 5808 __ Subu(scratch, result, scratch); |
5809 __ lw(result, FieldMemOperand(scratch, | 5809 __ lw(result, FieldMemOperand(scratch, |
5810 FixedArray::kHeaderSize - kPointerSize)); | 5810 FixedArray::kHeaderSize - kPointerSize)); |
5811 __ bind(&done); | 5811 __ bind(&done); |
5812 } | 5812 } |
5813 | 5813 |
5814 | 5814 |
5815 #undef __ | 5815 #undef __ |
5816 | 5816 |
5817 } } // namespace v8::internal | 5817 } } // namespace v8::internal |
OLD | NEW |