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 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 // Handle store cache miss. | 2468 // Handle store cache miss. |
2469 __ bind(&miss); | 2469 __ bind(&miss); |
2470 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2470 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2471 __ Jump(ic, RelocInfo::CODE_TARGET); | 2471 __ Jump(ic, RelocInfo::CODE_TARGET); |
2472 | 2472 |
2473 // Return the generated code. | 2473 // Return the generated code. |
2474 return GetCode(Code::CALLBACKS, name); | 2474 return GetCode(Code::CALLBACKS, name); |
2475 } | 2475 } |
2476 | 2476 |
2477 | 2477 |
2478 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( | 2478 #undef __ |
2479 Handle<String> name, | 2479 #define __ ACCESS_MASM(masm) |
2480 Handle<JSObject> receiver, | 2480 |
2481 Handle<JSObject> holder, | 2481 |
| 2482 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2483 MacroAssembler* masm, |
2482 Handle<JSFunction> setter) { | 2484 Handle<JSFunction> setter) { |
2483 // ----------- S t a t e ------------- | 2485 // ----------- S t a t e ------------- |
2484 // -- rax : value | 2486 // -- rax : value |
2485 // -- rcx : name | 2487 // -- rcx : name |
2486 // -- rdx : receiver | 2488 // -- rdx : receiver |
2487 // -- rsp[0] : return address | 2489 // -- rsp[0] : return address |
2488 // ----------------------------------- | 2490 // ----------------------------------- |
2489 Label miss; | |
2490 | |
2491 // Check that the maps haven't changed. | |
2492 __ JumpIfSmi(rdx, &miss); | |
2493 CheckPrototypes(receiver, rdx, holder, rbx, r8, rdi, name, &miss); | |
2494 | |
2495 { | 2491 { |
2496 FrameScope scope(masm(), StackFrame::INTERNAL); | 2492 FrameScope scope(masm, StackFrame::INTERNAL); |
2497 | 2493 |
2498 // Save value register, so we can restore it later. | 2494 // Save value register, so we can restore it later. |
2499 __ push(rax); | 2495 __ push(rax); |
2500 | 2496 |
2501 // Call the JavaScript setter with the receiver and the value on the stack. | 2497 if (setter.is_null()) { |
2502 __ push(rdx); | 2498 // If we generate a global code snippet for deoptimization only, remember |
2503 __ push(rax); | 2499 // the place to continue after deoptimization. |
2504 ParameterCount actual(1); | 2500 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
2505 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | 2501 } else { |
2506 CALL_AS_METHOD); | 2502 // Call the JavaScript setter with receiver and value on the stack. |
| 2503 __ push(rdx); |
| 2504 __ push(rax); |
| 2505 ParameterCount actual(1); |
| 2506 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), |
| 2507 CALL_AS_METHOD); |
| 2508 } |
2507 | 2509 |
2508 // We have to return the passed value, not the return value of the setter. | 2510 // We have to return the passed value, not the return value of the setter. |
2509 __ pop(rax); | 2511 __ pop(rax); |
2510 | 2512 |
2511 // Restore context register. | 2513 // Restore context register. |
2512 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2514 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2513 } | 2515 } |
2514 __ ret(0); | 2516 __ ret(0); |
| 2517 } |
| 2518 |
| 2519 |
| 2520 #undef __ |
| 2521 #define __ ACCESS_MASM(masm()) |
| 2522 |
| 2523 |
| 2524 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( |
| 2525 Handle<String> name, |
| 2526 Handle<JSObject> receiver, |
| 2527 Handle<JSObject> holder, |
| 2528 Handle<JSFunction> setter) { |
| 2529 // ----------- S t a t e ------------- |
| 2530 // -- rax : value |
| 2531 // -- rcx : name |
| 2532 // -- rdx : receiver |
| 2533 // -- rsp[0] : return address |
| 2534 // ----------------------------------- |
| 2535 Label miss; |
| 2536 |
| 2537 // Check that the maps haven't changed. |
| 2538 __ JumpIfSmi(rdx, &miss); |
| 2539 CheckPrototypes(receiver, rdx, holder, rbx, r8, rdi, name, &miss); |
| 2540 |
| 2541 GenerateStoreViaSetter(masm(), setter); |
2515 | 2542 |
2516 __ bind(&miss); | 2543 __ bind(&miss); |
2517 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); | 2544 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss(); |
2518 __ Jump(ic, RelocInfo::CODE_TARGET); | 2545 __ Jump(ic, RelocInfo::CODE_TARGET); |
2519 | 2546 |
2520 // Return the generated code. | 2547 // Return the generated code. |
2521 return GetCode(Code::CALLBACKS, name); | 2548 return GetCode(Code::CALLBACKS, name); |
2522 } | 2549 } |
2523 | 2550 |
2524 | 2551 |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4050 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 4077 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
4051 } | 4078 } |
4052 } | 4079 } |
4053 | 4080 |
4054 | 4081 |
4055 #undef __ | 4082 #undef __ |
4056 | 4083 |
4057 } } // namespace v8::internal | 4084 } } // namespace v8::internal |
4058 | 4085 |
4059 #endif // V8_TARGET_ARCH_X64 | 4086 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |