| 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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2330 Label success; | 2330 Label success; |
| 2331 // Check that the object is a boolean. | 2331 // Check that the object is a boolean. |
| 2332 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 2332 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
| 2333 __ Branch(&success, eq, object, Operand(at)); | 2333 __ Branch(&success, eq, object, Operand(at)); |
| 2334 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 2334 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 2335 __ Branch(miss, ne, object, Operand(at)); | 2335 __ Branch(miss, ne, object, Operand(at)); |
| 2336 __ bind(&success); | 2336 __ bind(&success); |
| 2337 } | 2337 } |
| 2338 | 2338 |
| 2339 | 2339 |
| 2340 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | 2340 void CallStubCompiler::PatchImplicitReceiver(Handle<Object> object) { |
| 2341 Handle<JSFunction> function) { | |
| 2342 if (object->IsGlobalObject()) { | 2341 if (object->IsGlobalObject()) { |
| 2343 const int argc = arguments().immediate(); | 2342 const int argc = arguments().immediate(); |
| 2344 const int receiver_offset = argc * kPointerSize; | 2343 const int receiver_offset = argc * kPointerSize; |
| 2345 __ li(a3, handle(function->context()->global_proxy())); | 2344 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
| 2346 __ sw(a3, MemOperand(sp, receiver_offset)); | 2345 __ sw(a3, MemOperand(sp, receiver_offset)); |
| 2347 } | 2346 } |
| 2348 } | 2347 } |
| 2349 | |
| 2350 | |
| 2351 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | |
| 2352 Register function) { | |
| 2353 if (object->IsGlobalObject()) { | |
| 2354 FetchGlobalProxy(masm(), a3, function); | |
| 2355 const int argc = arguments().immediate(); | |
| 2356 const int receiver_offset = argc * kPointerSize; | |
| 2357 __ sw(a3, MemOperand(sp, receiver_offset)); | |
| 2358 } | |
| 2359 } | |
| 2360 | 2348 |
| 2361 | 2349 |
| 2362 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2350 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
| 2363 Handle<JSObject> holder, | 2351 Handle<JSObject> holder, |
| 2364 Handle<Name> name, | 2352 Handle<Name> name, |
| 2365 CheckType check, | 2353 CheckType check, |
| 2366 Label* miss) { | 2354 Label* miss) { |
| 2367 // ----------- S t a t e ------------- | 2355 // ----------- S t a t e ------------- |
| 2368 // -- a2 : name | 2356 // -- a2 : name |
| 2369 // -- ra : return address | 2357 // -- ra : return address |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2445 return reg; | 2433 return reg; |
| 2446 } | 2434 } |
| 2447 | 2435 |
| 2448 | 2436 |
| 2449 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2437 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
| 2450 Register function, | 2438 Register function, |
| 2451 Label* miss) { | 2439 Label* miss) { |
| 2452 ASSERT(function.is(a1)); | 2440 ASSERT(function.is(a1)); |
| 2453 // Check that the function really is a function. | 2441 // Check that the function really is a function. |
| 2454 GenerateFunctionCheck(function, a3, miss); | 2442 GenerateFunctionCheck(function, a3, miss); |
| 2455 PatchGlobalProxy(object, function); | 2443 PatchImplicitReceiver(object); |
| 2444 |
| 2456 // Invoke the function. | 2445 // Invoke the function. |
| 2457 __ InvokeFunction(a1, arguments(), JUMP_FUNCTION, | 2446 __ InvokeFunction(a1, arguments(), JUMP_FUNCTION, NullCallWrapper()); |
| 2458 NullCallWrapper(), call_kind()); | |
| 2459 } | 2447 } |
| 2460 | 2448 |
| 2461 | 2449 |
| 2462 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2450 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
| 2463 Handle<JSObject> holder, | 2451 Handle<JSObject> holder, |
| 2464 Handle<Name> name) { | 2452 Handle<Name> name) { |
| 2465 Label miss; | 2453 Label miss; |
| 2466 | 2454 |
| 2467 GenerateNameCheck(name, &miss); | 2455 GenerateNameCheck(name, &miss); |
| 2468 | 2456 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2563 | 2551 |
| 2564 // Return the generated code. | 2552 // Return the generated code. |
| 2565 return GetCode(kind(), Code::FAST, name); | 2553 return GetCode(kind(), Code::FAST, name); |
| 2566 } | 2554 } |
| 2567 | 2555 |
| 2568 | 2556 |
| 2569 #undef __ | 2557 #undef __ |
| 2570 #define __ ACCESS_MASM(masm) | 2558 #define __ ACCESS_MASM(masm) |
| 2571 | 2559 |
| 2572 | 2560 |
| 2573 void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm, | |
| 2574 Register target, | |
| 2575 Register function) { | |
| 2576 __ lw(target, FieldMemOperand(function, JSFunction::kContextOffset)); | |
| 2577 __ lw(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX)); | |
| 2578 __ lw(target, FieldMemOperand(target, GlobalObject::kGlobalReceiverOffset)); | |
| 2579 } | |
| 2580 | |
| 2581 | |
| 2582 void StoreStubCompiler::GenerateStoreViaSetter( | 2561 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2583 MacroAssembler* masm, | 2562 MacroAssembler* masm, |
| 2584 Handle<JSFunction> setter) { | 2563 Handle<JSFunction> setter) { |
| 2585 // ----------- S t a t e ------------- | 2564 // ----------- S t a t e ------------- |
| 2586 // -- a0 : value | 2565 // -- a0 : value |
| 2587 // -- a1 : receiver | 2566 // -- a1 : receiver |
| 2588 // -- a2 : name | 2567 // -- a2 : name |
| 2589 // -- ra : return address | 2568 // -- ra : return address |
| 2590 // ----------------------------------- | 2569 // ----------------------------------- |
| 2591 { | 2570 { |
| 2592 FrameScope scope(masm, StackFrame::INTERNAL); | 2571 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2593 | 2572 |
| 2594 // Save value register, so we can restore it later. | 2573 // Save value register, so we can restore it later. |
| 2595 __ push(a0); | 2574 __ push(a0); |
| 2596 | 2575 |
| 2597 if (!setter.is_null()) { | 2576 if (!setter.is_null()) { |
| 2598 // Call the JavaScript setter with receiver and value on the stack. | 2577 // Call the JavaScript setter with receiver and value on the stack. |
| 2599 __ push(a1); | 2578 __ push(a1); |
| 2600 __ push(a0); | 2579 __ push(a0); |
| 2601 ParameterCount actual(1); | 2580 ParameterCount actual(1); |
| 2602 ParameterCount expected(setter); | 2581 ParameterCount expected(setter); |
| 2603 __ InvokeFunction(setter, expected, actual, | 2582 __ InvokeFunction(setter, expected, actual, |
| 2604 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2583 CALL_FUNCTION, NullCallWrapper()); |
| 2605 } else { | 2584 } else { |
| 2606 // If we generate a global code snippet for deoptimization only, remember | 2585 // If we generate a global code snippet for deoptimization only, remember |
| 2607 // the place to continue after deoptimization. | 2586 // the place to continue after deoptimization. |
| 2608 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 2587 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| 2609 } | 2588 } |
| 2610 | 2589 |
| 2611 // We have to return the passed value, not the return value of the setter. | 2590 // We have to return the passed value, not the return value of the setter. |
| 2612 __ pop(v0); | 2591 __ pop(v0); |
| 2613 | 2592 |
| 2614 // Restore context register. | 2593 // Restore context register. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 // ----------------------------------- | 2705 // ----------------------------------- |
| 2727 { | 2706 { |
| 2728 FrameScope scope(masm, StackFrame::INTERNAL); | 2707 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2729 | 2708 |
| 2730 if (!getter.is_null()) { | 2709 if (!getter.is_null()) { |
| 2731 // Call the JavaScript getter with the receiver on the stack. | 2710 // Call the JavaScript getter with the receiver on the stack. |
| 2732 __ push(receiver); | 2711 __ push(receiver); |
| 2733 ParameterCount actual(0); | 2712 ParameterCount actual(0); |
| 2734 ParameterCount expected(getter); | 2713 ParameterCount expected(getter); |
| 2735 __ InvokeFunction(getter, expected, actual, | 2714 __ InvokeFunction(getter, expected, actual, |
| 2736 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2715 CALL_FUNCTION, NullCallWrapper()); |
| 2737 } else { | 2716 } else { |
| 2738 // If we generate a global code snippet for deoptimization only, remember | 2717 // If we generate a global code snippet for deoptimization only, remember |
| 2739 // the place to continue after deoptimization. | 2718 // the place to continue after deoptimization. |
| 2740 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 2719 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 2741 } | 2720 } |
| 2742 | 2721 |
| 2743 // Restore context register. | 2722 // Restore context register. |
| 2744 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2723 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2745 } | 2724 } |
| 2746 __ Ret(); | 2725 __ Ret(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 // ----------------------------------- | 2884 // ----------------------------------- |
| 2906 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2885 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2907 } | 2886 } |
| 2908 | 2887 |
| 2909 | 2888 |
| 2910 #undef __ | 2889 #undef __ |
| 2911 | 2890 |
| 2912 } } // namespace v8::internal | 2891 } } // namespace v8::internal |
| 2913 | 2892 |
| 2914 #endif // V8_TARGET_ARCH_MIPS | 2893 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |