OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 // -- edx : receiver | 2575 // -- edx : receiver |
2576 // -- esp[0] : return address | 2576 // -- esp[0] : return address |
2577 // ----------------------------------- | 2577 // ----------------------------------- |
2578 Label miss; | 2578 Label miss; |
2579 | 2579 |
2580 // Check that the map of the global has not changed. | 2580 // Check that the map of the global has not changed. |
2581 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), | 2581 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), |
2582 Immediate(Handle<Map>(object->map()))); | 2582 Immediate(Handle<Map>(object->map()))); |
2583 __ j(not_equal, &miss, not_taken); | 2583 __ j(not_equal, &miss, not_taken); |
2584 | 2584 |
2585 // Store the value in the cell. | 2585 |
| 2586 // Compute the cell operand to use. |
| 2587 Operand cell_operand = Operand::Cell(Handle<JSGlobalPropertyCell>(cell)); |
2586 if (Serializer::enabled()) { | 2588 if (Serializer::enabled()) { |
2587 __ mov(ecx, Immediate(Handle<JSGlobalPropertyCell>(cell))); | 2589 __ mov(ecx, Immediate(Handle<JSGlobalPropertyCell>(cell))); |
2588 __ mov(FieldOperand(ecx, JSGlobalPropertyCell::kValueOffset), eax); | 2590 cell_operand = FieldOperand(ecx, JSGlobalPropertyCell::kValueOffset); |
2589 } else { | |
2590 __ mov(Operand::Cell(Handle<JSGlobalPropertyCell>(cell)), eax); | |
2591 } | 2591 } |
2592 | 2592 |
| 2593 // Check that the value in the cell is not the hole. If it is, this |
| 2594 // cell could have been deleted and reintroducing the global needs |
| 2595 // to update the property details in the property dictionary of the |
| 2596 // global object. We bail out to the runtime system to do that. |
| 2597 __ cmp(cell_operand, Factory::the_hole_value()); |
| 2598 __ j(equal, &miss); |
| 2599 |
| 2600 // Store the value in the cell. |
| 2601 __ mov(cell_operand, eax); |
| 2602 |
2593 // Return the value (register eax). | 2603 // Return the value (register eax). |
2594 __ IncrementCounter(&Counters::named_store_global_inline, 1); | 2604 __ IncrementCounter(&Counters::named_store_global_inline, 1); |
2595 __ ret(0); | 2605 __ ret(0); |
2596 | 2606 |
2597 // Handle store cache miss. | 2607 // Handle store cache miss. |
2598 __ bind(&miss); | 2608 __ bind(&miss); |
2599 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); | 2609 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); |
2600 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2610 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2601 __ jmp(ic, RelocInfo::CODE_TARGET); | 2611 __ jmp(ic, RelocInfo::CODE_TARGET); |
2602 | 2612 |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3639 | 3649 |
3640 return GetCode(flags); | 3650 return GetCode(flags); |
3641 } | 3651 } |
3642 | 3652 |
3643 | 3653 |
3644 #undef __ | 3654 #undef __ |
3645 | 3655 |
3646 } } // namespace v8::internal | 3656 } } // namespace v8::internal |
3647 | 3657 |
3648 #endif // V8_TARGET_ARCH_IA32 | 3658 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |