OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 DCHECK(cell->value()->IsTheHole()); | 207 DCHECK(cell->value()->IsTheHole()); |
208 __ Move(scratch, cell); | 208 __ Move(scratch, cell); |
209 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), | 209 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), |
210 masm->isolate()->factory()->the_hole_value()); | 210 masm->isolate()->factory()->the_hole_value()); |
211 __ j(not_equal, miss); | 211 __ j(not_equal, miss); |
212 } | 212 } |
213 | 213 |
214 | 214 |
215 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 215 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
216 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 216 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
217 Handle<JSFunction> setter) { | 217 Register holder, int accessor_index, int expected_arguments) { |
218 // ----------- S t a t e ------------- | 218 // ----------- S t a t e ------------- |
219 // -- rsp[0] : return address | 219 // -- rsp[0] : return address |
220 // ----------------------------------- | 220 // ----------------------------------- |
221 { | 221 { |
222 FrameScope scope(masm, StackFrame::INTERNAL); | 222 FrameScope scope(masm, StackFrame::INTERNAL); |
223 | 223 |
224 // Save value register, so we can restore it later. | 224 // Save value register, so we can restore it later. |
225 __ Push(value()); | 225 __ Push(value()); |
226 | 226 |
227 if (!setter.is_null()) { | 227 if (accessor_index >= 0) { |
228 // Call the JavaScript setter with receiver and value on the stack. | 228 // Call the JavaScript setter with receiver and value on the stack. |
229 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 229 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
230 // Swap in the global receiver. | 230 // Swap in the global receiver. |
231 __ movp(receiver, | 231 __ movp(receiver, |
232 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 232 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
233 } | 233 } |
234 __ Push(receiver); | 234 __ Push(receiver); |
235 __ Push(value()); | 235 __ Push(value()); |
236 ParameterCount actual(1); | 236 ParameterCount actual(1); |
237 ParameterCount expected(setter); | 237 ParameterCount expected(expected_arguments); |
238 __ InvokeFunction(setter, expected, actual, CALL_FUNCTION, | 238 Register scratch = holder; |
| 239 __ movp(scratch, FieldOperand(holder, HeapObject::kMapOffset)); |
| 240 __ LoadInstanceDescriptors(scratch, scratch); |
| 241 __ movp(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset( |
| 242 accessor_index))); |
| 243 __ movp(rdi, FieldOperand(scratch, AccessorPair::kSetterOffset)); |
| 244 __ InvokeFunction(rdi, expected, actual, CALL_FUNCTION, |
239 NullCallWrapper()); | 245 NullCallWrapper()); |
240 } else { | 246 } else { |
241 // If we generate a global code snippet for deoptimization only, remember | 247 // If we generate a global code snippet for deoptimization only, remember |
242 // the place to continue after deoptimization. | 248 // the place to continue after deoptimization. |
243 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 249 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
244 } | 250 } |
245 | 251 |
246 // We have to return the passed value, not the return value of the setter. | 252 // We have to return the passed value, not the return value of the setter. |
247 __ Pop(rax); | 253 __ Pop(rax); |
248 | 254 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // Return the generated code. | 753 // Return the generated code. |
748 return GetCode(kind(), Code::NORMAL, name); | 754 return GetCode(kind(), Code::NORMAL, name); |
749 } | 755 } |
750 | 756 |
751 | 757 |
752 #undef __ | 758 #undef __ |
753 } | 759 } |
754 } // namespace v8::internal | 760 } // namespace v8::internal |
755 | 761 |
756 #endif // V8_TARGET_ARCH_X64 | 762 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |