| 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" |
| 11 #include "src/ic/ic.h" | 11 #include "src/ic/ic.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 #define __ ACCESS_MASM(masm) | 16 #define __ ACCESS_MASM(masm) |
| 17 | 17 |
| 18 | 18 |
| 19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
| 20 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 20 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
| 21 Register holder, int accessor_index, int expected_arguments) { | 21 Register holder, int accessor_index, int expected_arguments, |
| 22 Register scratch) { |
| 22 { | 23 { |
| 23 FrameScope scope(masm, StackFrame::INTERNAL); | 24 FrameScope scope(masm, StackFrame::INTERNAL); |
| 24 | 25 |
| 25 if (accessor_index >= 0) { | 26 if (accessor_index >= 0) { |
| 27 DCHECK(!holder.is(scratch)); |
| 28 DCHECK(!receiver.is(scratch)); |
| 26 // Call the JavaScript getter with the receiver on the stack. | 29 // Call the JavaScript getter with the receiver on the stack. |
| 27 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 30 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 28 // Swap in the global receiver. | 31 // Swap in the global receiver. |
| 29 __ mov(receiver, | 32 __ mov(scratch, |
| 30 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 33 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 34 receiver = scratch; |
| 31 } | 35 } |
| 32 __ push(receiver); | 36 __ push(receiver); |
| 33 ParameterCount actual(0); | 37 ParameterCount actual(0); |
| 34 ParameterCount expected(expected_arguments); | 38 ParameterCount expected(expected_arguments); |
| 35 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER); | 39 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER); |
| 36 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, | 40 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, |
| 37 NullCallWrapper()); | 41 NullCallWrapper()); |
| 38 } else { | 42 } else { |
| 39 // If we generate a global code snippet for deoptimization only, remember | 43 // If we generate a global code snippet for deoptimization only, remember |
| 40 // the place to continue after deoptimization. | 44 // the place to continue after deoptimization. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 Immediate(the_hole)); | 228 Immediate(the_hole)); |
| 225 } else { | 229 } else { |
| 226 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); | 230 __ cmp(Operand::ForCell(cell), Immediate(the_hole)); |
| 227 } | 231 } |
| 228 __ j(not_equal, miss); | 232 __ j(not_equal, miss); |
| 229 } | 233 } |
| 230 | 234 |
| 231 | 235 |
| 232 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 236 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
| 233 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 237 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
| 234 Register holder, int accessor_index, int expected_arguments) { | 238 Register holder, int accessor_index, int expected_arguments, |
| 239 Register scratch) { |
| 235 // ----------- S t a t e ------------- | 240 // ----------- S t a t e ------------- |
| 236 // -- esp[0] : return address | 241 // -- esp[0] : return address |
| 237 // ----------------------------------- | 242 // ----------------------------------- |
| 238 { | 243 { |
| 239 FrameScope scope(masm, StackFrame::INTERNAL); | 244 FrameScope scope(masm, StackFrame::INTERNAL); |
| 240 | 245 |
| 241 // Save value register, so we can restore it later. | 246 // Save value register, so we can restore it later. |
| 242 __ push(value()); | 247 __ push(value()); |
| 243 | 248 |
| 244 if (accessor_index >= 0) { | 249 if (accessor_index >= 0) { |
| 250 DCHECK(!holder.is(scratch)); |
| 251 DCHECK(!receiver.is(scratch)); |
| 252 DCHECK(!value().is(scratch)); |
| 245 // Call the JavaScript setter with receiver and value on the stack. | 253 // Call the JavaScript setter with receiver and value on the stack. |
| 246 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 254 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 247 // Swap in the global receiver. | 255 // Swap in the global receiver. |
| 248 __ mov(receiver, | 256 __ mov(scratch, |
| 249 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 257 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 258 receiver = scratch; |
| 250 } | 259 } |
| 251 __ push(receiver); | 260 __ push(receiver); |
| 252 __ push(value()); | 261 __ push(value()); |
| 253 ParameterCount actual(1); | 262 ParameterCount actual(1); |
| 254 ParameterCount expected(expected_arguments); | 263 ParameterCount expected(expected_arguments); |
| 255 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER); | 264 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER); |
| 256 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, | 265 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, |
| 257 NullCallWrapper()); | 266 NullCallWrapper()); |
| 258 } else { | 267 } else { |
| 259 // If we generate a global code snippet for deoptimization only, remember | 268 // If we generate a global code snippet for deoptimization only, remember |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // Return the generated code. | 765 // Return the generated code. |
| 757 return GetCode(kind(), Code::NORMAL, name); | 766 return GetCode(kind(), Code::NORMAL, name); |
| 758 } | 767 } |
| 759 | 768 |
| 760 | 769 |
| 761 #undef __ | 770 #undef __ |
| 762 } | 771 } |
| 763 } // namespace v8::internal | 772 } // namespace v8::internal |
| 764 | 773 |
| 765 #endif // V8_TARGET_ARCH_X87 | 774 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |