| 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 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3337 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE)); | 3337 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE)); |
| 3338 | 3338 |
| 3339 if (RecordCallTarget()) { | 3339 if (RecordCallTarget()) { |
| 3340 GenerateRecordCallTarget(masm); | 3340 GenerateRecordCallTarget(masm); |
| 3341 } | 3341 } |
| 3342 | 3342 |
| 3343 // Fast-case: Invoke the function now. | 3343 // Fast-case: Invoke the function now. |
| 3344 // a1: pushed function | 3344 // a1: pushed function |
| 3345 ParameterCount actual(argc_); | 3345 ParameterCount actual(argc_); |
| 3346 | 3346 |
| 3347 __ InvokeFunction(a1, | 3347 __ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 3348 actual, | |
| 3349 JUMP_FUNCTION, | |
| 3350 NullCallWrapper(), | |
| 3351 CALL_AS_FUNCTION); | |
| 3352 | 3348 |
| 3353 // Slow-case: Non-function called. | 3349 // Slow-case: Non-function called. |
| 3354 __ bind(&slow); | 3350 __ bind(&slow); |
| 3355 if (RecordCallTarget()) { | 3351 if (RecordCallTarget()) { |
| 3356 // If there is a call target cache, mark it megamorphic in the | 3352 // If there is a call target cache, mark it megamorphic in the |
| 3357 // non-function case. MegamorphicSentinel is an immortal immovable | 3353 // non-function case. MegamorphicSentinel is an immortal immovable |
| 3358 // object (undefined) so no write barrier is needed. | 3354 // object (undefined) so no write barrier is needed. |
| 3359 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 3355 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 3360 masm->isolate()->heap()->undefined_value()); | 3356 masm->isolate()->heap()->undefined_value()); |
| 3361 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 3357 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 3362 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); | 3358 __ sw(at, FieldMemOperand(a2, Cell::kValueOffset)); |
| 3363 } | 3359 } |
| 3364 // Check for function proxy. | 3360 // Check for function proxy. |
| 3365 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); | 3361 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 3366 __ push(a1); // Put proxy as additional argument. | 3362 __ push(a1); // Put proxy as additional argument. |
| 3367 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE32)); | 3363 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE32)); |
| 3368 __ li(a2, Operand(0, RelocInfo::NONE32)); | 3364 __ li(a2, Operand(0, RelocInfo::NONE32)); |
| 3369 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | 3365 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); |
| 3370 __ SetCallKind(t1, CALL_AS_FUNCTION); | |
| 3371 { | 3366 { |
| 3372 Handle<Code> adaptor = | 3367 Handle<Code> adaptor = |
| 3373 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 3368 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 3374 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 3369 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
| 3375 } | 3370 } |
| 3376 | 3371 |
| 3377 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 3372 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 3378 // of the original receiver from the call site). | 3373 // of the original receiver from the call site). |
| 3379 __ bind(&non_function); | 3374 __ bind(&non_function); |
| 3380 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); | 3375 __ sw(a1, MemOperand(sp, argc_ * kPointerSize)); |
| 3381 __ li(a0, Operand(argc_)); // Set up the number of arguments. | 3376 __ li(a0, Operand(argc_)); // Set up the number of arguments. |
| 3382 __ mov(a2, zero_reg); | 3377 __ mov(a2, zero_reg); |
| 3383 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); | 3378 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); |
| 3384 __ SetCallKind(t1, CALL_AS_FUNCTION); | |
| 3385 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3379 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 3386 RelocInfo::CODE_TARGET); | 3380 RelocInfo::CODE_TARGET); |
| 3387 } | 3381 } |
| 3388 | 3382 |
| 3389 | 3383 |
| 3390 void CallConstructStub::Generate(MacroAssembler* masm) { | 3384 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 3391 // a0 : number of arguments | 3385 // a0 : number of arguments |
| 3392 // a1 : the function to call | 3386 // a1 : the function to call |
| 3393 // a2 : cache cell for call target | 3387 // a2 : cache cell for call target |
| 3394 Label slow, non_function_call; | 3388 Label slow, non_function_call; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3418 __ bind(&slow); | 3412 __ bind(&slow); |
| 3419 __ Branch(&non_function_call, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); | 3413 __ Branch(&non_function_call, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 3420 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 3414 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
| 3421 __ jmp(&do_call); | 3415 __ jmp(&do_call); |
| 3422 | 3416 |
| 3423 __ bind(&non_function_call); | 3417 __ bind(&non_function_call); |
| 3424 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 3418 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 3425 __ bind(&do_call); | 3419 __ bind(&do_call); |
| 3426 // Set expected number of arguments to zero (not changing r0). | 3420 // Set expected number of arguments to zero (not changing r0). |
| 3427 __ li(a2, Operand(0, RelocInfo::NONE32)); | 3421 __ li(a2, Operand(0, RelocInfo::NONE32)); |
| 3428 __ SetCallKind(t1, CALL_AS_METHOD); | |
| 3429 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3422 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 3430 RelocInfo::CODE_TARGET); | 3423 RelocInfo::CODE_TARGET); |
| 3431 } | 3424 } |
| 3432 | 3425 |
| 3433 | 3426 |
| 3434 // StringCharCodeAtGenerator. | 3427 // StringCharCodeAtGenerator. |
| 3435 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 3428 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 3436 Label flat_string; | 3429 Label flat_string; |
| 3437 Label ascii_string; | 3430 Label ascii_string; |
| 3438 Label got_char_code; | 3431 Label got_char_code; |
| (...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5601 __ mov(a1, v0); | 5594 __ mov(a1, v0); |
| 5602 int parameter_count_offset = | 5595 int parameter_count_offset = |
| 5603 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 5596 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 5604 __ lw(a0, MemOperand(fp, parameter_count_offset)); | 5597 __ lw(a0, MemOperand(fp, parameter_count_offset)); |
| 5605 // The parameter count above includes the receiver for the arguments passed to | 5598 // The parameter count above includes the receiver for the arguments passed to |
| 5606 // the deoptimization handler. Subtract the receiver for the parameter count | 5599 // the deoptimization handler. Subtract the receiver for the parameter count |
| 5607 // for the call. | 5600 // for the call. |
| 5608 __ Subu(a0, a0, 1); | 5601 __ Subu(a0, a0, 1); |
| 5609 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5602 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5610 ParameterCount argument_count(a0); | 5603 ParameterCount argument_count(a0); |
| 5611 __ InvokeFunction( | 5604 __ InvokeFunction(a1, argument_count, JUMP_FUNCTION, NullCallWrapper()); |
| 5612 a1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
| 5613 } | 5605 } |
| 5614 | 5606 |
| 5615 | 5607 |
| 5616 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5608 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5617 if (masm->isolate()->function_entry_hook() != NULL) { | 5609 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5618 ProfileEntryHookStub stub; | 5610 ProfileEntryHookStub stub; |
| 5619 __ push(ra); | 5611 __ push(ra); |
| 5620 __ CallStub(&stub); | 5612 __ CallStub(&stub); |
| 5621 __ pop(ra); | 5613 __ pop(ra); |
| 5622 } | 5614 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5978 __ bind(&fast_elements_case); | 5970 __ bind(&fast_elements_case); |
| 5979 GenerateCase(masm, FAST_ELEMENTS); | 5971 GenerateCase(masm, FAST_ELEMENTS); |
| 5980 } | 5972 } |
| 5981 | 5973 |
| 5982 | 5974 |
| 5983 #undef __ | 5975 #undef __ |
| 5984 | 5976 |
| 5985 } } // namespace v8::internal | 5977 } } // namespace v8::internal |
| 5986 | 5978 |
| 5987 #endif // V8_TARGET_ARCH_MIPS | 5979 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |