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 5384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5395 // function stub. | 5395 // function stub. |
5396 if (ReceiverMightBeImplicit()) { | 5396 if (ReceiverMightBeImplicit()) { |
5397 Label call; | 5397 Label call; |
5398 // Get the receiver from the stack. | 5398 // Get the receiver from the stack. |
5399 // function, receiver [, arguments] | 5399 // function, receiver [, arguments] |
5400 __ lw(t0, MemOperand(sp, argc_ * kPointerSize)); | 5400 __ lw(t0, MemOperand(sp, argc_ * kPointerSize)); |
5401 // Call as function is indicated with the hole. | 5401 // Call as function is indicated with the hole. |
5402 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5402 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5403 __ Branch(&call, ne, t0, Operand(at)); | 5403 __ Branch(&call, ne, t0, Operand(at)); |
5404 // Patch the receiver on the stack with the global receiver object. | 5404 // Patch the receiver on the stack with the global receiver object. |
5405 __ lw(a2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 5405 __ lw(a3, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
5406 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); | 5406 __ lw(a3, FieldMemOperand(a3, GlobalObject::kGlobalReceiverOffset)); |
5407 __ sw(a2, MemOperand(sp, argc_ * kPointerSize)); | 5407 __ sw(a3, MemOperand(sp, argc_ * kPointerSize)); |
5408 __ bind(&call); | 5408 __ bind(&call); |
5409 } | 5409 } |
5410 | 5410 |
5411 // Check that the function is really a JavaScript function. | 5411 // Check that the function is really a JavaScript function. |
5412 // a1: pushed function (to be verified) | 5412 // a1: pushed function (to be verified) |
5413 __ JumpIfSmi(a1, &non_function); | 5413 __ JumpIfSmi(a1, &non_function); |
5414 // Get the map of the function object. | 5414 // Get the map of the function object. |
5415 __ GetObjectType(a1, a2, a2); | 5415 __ GetObjectType(a1, a3, a3); |
5416 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE)); | 5416 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE)); |
| 5417 |
| 5418 if (RecordCallTarget()) { |
| 5419 GenerateRecordCallTarget(masm); |
| 5420 } |
5417 | 5421 |
5418 // Fast-case: Invoke the function now. | 5422 // Fast-case: Invoke the function now. |
5419 // a1: pushed function | 5423 // a1: pushed function |
5420 ParameterCount actual(argc_); | 5424 ParameterCount actual(argc_); |
5421 | 5425 |
5422 if (ReceiverMightBeImplicit()) { | 5426 if (ReceiverMightBeImplicit()) { |
5423 Label call_as_function; | 5427 Label call_as_function; |
5424 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 5428 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
5425 __ Branch(&call_as_function, eq, t0, Operand(at)); | 5429 __ Branch(&call_as_function, eq, t0, Operand(at)); |
5426 __ InvokeFunction(a1, | 5430 __ InvokeFunction(a1, |
5427 actual, | 5431 actual, |
5428 JUMP_FUNCTION, | 5432 JUMP_FUNCTION, |
5429 NullCallWrapper(), | 5433 NullCallWrapper(), |
5430 CALL_AS_METHOD); | 5434 CALL_AS_METHOD); |
5431 __ bind(&call_as_function); | 5435 __ bind(&call_as_function); |
5432 } | 5436 } |
5433 __ InvokeFunction(a1, | 5437 __ InvokeFunction(a1, |
5434 actual, | 5438 actual, |
5435 JUMP_FUNCTION, | 5439 JUMP_FUNCTION, |
5436 NullCallWrapper(), | 5440 NullCallWrapper(), |
5437 CALL_AS_FUNCTION); | 5441 CALL_AS_FUNCTION); |
5438 | 5442 |
5439 // Slow-case: Non-function called. | 5443 // Slow-case: Non-function called. |
5440 __ bind(&slow); | 5444 __ bind(&slow); |
| 5445 if (RecordCallTarget()) { |
| 5446 // If there is a call target cache, mark it megamorphic in the |
| 5447 // non-function case. MegamorphicSentinel is an immortal immovable |
| 5448 // object (undefined) so no write barrier is needed. |
| 5449 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5450 masm->isolate()->heap()->undefined_value()); |
| 5451 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5452 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); |
| 5453 } |
5441 // Check for function proxy. | 5454 // Check for function proxy. |
5442 __ Branch(&non_function, ne, a2, Operand(JS_FUNCTION_PROXY_TYPE)); | 5455 __ Branch(&non_function, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); |
5443 __ push(a1); // Put proxy as additional argument. | 5456 __ push(a1); // Put proxy as additional argument. |
5444 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE)); | 5457 __ li(a0, Operand(argc_ + 1, RelocInfo::NONE)); |
5445 __ li(a2, Operand(0, RelocInfo::NONE)); | 5458 __ li(a2, Operand(0, RelocInfo::NONE)); |
5446 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | 5459 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); |
5447 __ SetCallKind(t1, CALL_AS_METHOD); | 5460 __ SetCallKind(t1, CALL_AS_METHOD); |
5448 { | 5461 { |
5449 Handle<Code> adaptor = | 5462 Handle<Code> adaptor = |
5450 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 5463 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
5451 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 5464 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
5452 } | 5465 } |
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7663 __ Ret(USE_DELAY_SLOT); | 7676 __ Ret(USE_DELAY_SLOT); |
7664 __ mov(v0, a0); | 7677 __ mov(v0, a0); |
7665 } | 7678 } |
7666 | 7679 |
7667 | 7680 |
7668 #undef __ | 7681 #undef __ |
7669 | 7682 |
7670 } } // namespace v8::internal | 7683 } } // namespace v8::internal |
7671 | 7684 |
7672 #endif // V8_TARGET_ARCH_MIPS | 7685 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |