OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 Immediate(the_hole)); | 229 Immediate(the_hole)); |
230 } else { | 230 } else { |
231 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); | 231 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); |
232 } | 232 } |
233 __ j(not_equal, miss); | 233 __ j(not_equal, miss); |
234 } | 234 } |
235 | 235 |
236 | 236 |
237 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 237 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
238 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 238 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
239 Handle<JSFunction> setter) { | 239 Register holder, int accessor_index, int expected_arguments) { |
240 // ----------- S t a t e ------------- | 240 // ----------- S t a t e ------------- |
241 // -- esp[0] : return address | 241 // -- esp[0] : return address |
242 // ----------------------------------- | 242 // ----------------------------------- |
243 { | 243 { |
244 FrameScope scope(masm, StackFrame::INTERNAL); | 244 FrameScope scope(masm, StackFrame::INTERNAL); |
245 | 245 |
246 // Save value register, so we can restore it later. | 246 // Save value register, so we can restore it later. |
247 __ push(value()); | 247 __ push(value()); |
248 | 248 |
249 if (!setter.is_null()) { | 249 if (accessor_index >= 0) { |
250 // Call the JavaScript setter with receiver and value on the stack. | 250 // Call the JavaScript setter with receiver and value on the stack. |
251 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 251 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
252 // Swap in the global receiver. | 252 // Swap in the global receiver. |
253 __ mov(receiver, | 253 __ mov(receiver, |
254 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 254 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
255 } | 255 } |
256 __ push(receiver); | 256 __ push(receiver); |
257 __ push(value()); | 257 __ push(value()); |
258 ParameterCount actual(1); | 258 ParameterCount actual(1); |
259 ParameterCount expected(setter); | 259 ParameterCount expected(expected_arguments); |
260 __ InvokeFunction(setter, expected, actual, CALL_FUNCTION, | 260 Register scratch = holder; |
| 261 __ mov(scratch, FieldOperand(holder, HeapObject::kMapOffset)); |
| 262 __ LoadInstanceDescriptors(scratch, scratch); |
| 263 __ mov(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset( |
| 264 accessor_index))); |
| 265 __ mov(edi, FieldOperand(scratch, AccessorPair::kSetterOffset)); |
| 266 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, |
261 NullCallWrapper()); | 267 NullCallWrapper()); |
262 } else { | 268 } else { |
263 // If we generate a global code snippet for deoptimization only, remember | 269 // If we generate a global code snippet for deoptimization only, remember |
264 // the place to continue after deoptimization. | 270 // the place to continue after deoptimization. |
265 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 271 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
266 } | 272 } |
267 | 273 |
268 // We have to return the passed value, not the return value of the setter. | 274 // We have to return the passed value, not the return value of the setter. |
269 __ pop(eax); | 275 __ pop(eax); |
270 | 276 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 // Return the generated code. | 766 // Return the generated code. |
761 return GetCode(kind(), Code::NORMAL, name); | 767 return GetCode(kind(), Code::NORMAL, name); |
762 } | 768 } |
763 | 769 |
764 | 770 |
765 #undef __ | 771 #undef __ |
766 } | 772 } |
767 } // namespace v8::internal | 773 } // namespace v8::internal |
768 | 774 |
769 #endif // V8_TARGET_ARCH_X87 | 775 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |